Skip to main content

Overview

RTK provides comprehensive Python development tool support with 70-90% token savings through:
  • JSON parsing: Structured output from Ruff and pip
  • State machine parsing: Text-based pytest output
  • Error grouping: Group by file, rule, or error code
  • Auto-detection: Detects uv for faster pip operations

Supported Tools

Ruff

Fast linter/formatter (80% savings)

Pytest

Test runner with failures only (90% savings)

pip/uv

Package manager with JSON parsing (70-85% savings)

Mypy

Type checker with error grouping (80% savings)

rtk ruff

Ruff linter and formatter with JSON parsing.

Usage

Examples

Features

  • JSON parsing: Uses --output-format=json automatically
  • Rule grouping: Groups violations by rule code
  • Fix hints: Shows which errors are auto-fixable
  • Exit code preservation: Safe for CI/CD

Implementation

From src/ruff_cmd.rs:

rtk ruff format

Ruff formatter with compact output.

rtk pytest

Pytest test runner showing failures only.

Usage

Examples

Features

  • State machine parser: Parses text output (no JSON mode needed)
  • Auto-flags: Forces --tb=short -q for compact output
  • Failure details: Preserves assertion messages and tracebacks
  • Tee recovery: Full output saved to file on failure

Implementation

From src/pytest_cmd.rs:

Supported Options

  • -v: Verbose mode (passthrough)
  • -k <pattern>: Run tests matching pattern
  • -x: Stop on first failure
  • --tb=<style>: Traceback style (short/long/no)

rtk pip

Package manager with auto-detection of uv.

Usage

Auto-detection

RTK automatically detects and uses uv if available:

Examples

rtk pip outdated

Show outdated packages with upgrade suggestions.

Features

  • JSON parsing: Uses --format=json for structured output
  • Grouping: Groups packages by category (Core, Data, Testing, etc.)
  • Upgrade hints: Generates upgrade commands
  • uv support: Seamlessly uses uv pip when available

Implementation

From src/pip_cmd.rs:

rtk mypy

Mypy type checker with error grouping.

Usage

Examples

Features

  • File grouping: Group errors by file
  • Line numbers: Compact :line format
  • Error messages: Preserve full error text
  • Exit codes: Safe for CI/CD

CI/CD Integration

All Python tools preserve exit codes:

Token Savings Summary

Next Steps

Go

Go development tools

Testing

Cross-language test runners