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
uvfor 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=jsonautomatically - Rule grouping: Groups violations by rule code
- Fix hints: Shows which errors are auto-fixable
- Exit code preservation: Safe for CI/CD
Implementation
Fromsrc/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 -qfor compact output - Failure details: Preserves assertion messages and tracebacks
- Tee recovery: Full output saved to file on failure
Implementation
Fromsrc/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 ofuv.
Usage
Auto-detection
RTK automatically detects and usesuv if available:
Examples
rtk pip outdated
Show outdated packages with upgrade suggestions.Features
- JSON parsing: Uses
--format=jsonfor structured output - Grouping: Groups packages by category (Core, Data, Testing, etc.)
- Upgrade hints: Generates upgrade commands
- uv support: Seamlessly uses
uv pipwhen available
Implementation
Fromsrc/pip_cmd.rs:
rtk mypy
Mypy type checker with error grouping.Usage
Examples
Features
- File grouping: Group errors by file
- Line numbers: Compact
:lineformat - Error messages: Preserve full error text
- Exit codes: Safe for CI/CD
CI/CD Integration
All Python tools preserve exit codes:Token Savings Summary
| Command | Standard Tokens | RTK Tokens | Savings |
|---|---|---|---|
ruff check (5 errors) | 300 | 60 | -80% |
pytest (2 fail, 23 pass) | 800 | 80 | -90% |
pip list (127 packages) | 400 | 120 | -70% |
pip outdated (3 packages) | 200 | 30 | -85% |
mypy (5 errors) | 350 | 70 | -80% |
Next Steps
Go
Go development tools
Testing
Cross-language test runners
