rtk-ai/rtk

feat: add python3/pytest output filter — compress test results and script output

Open

#1,256 建立於 2026年4月13日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Rust (2,914 fork)batch import
area:clieffort-mediumenhancementhelp wantedplatform:macospriority:medium

倉庫指標

Star
 (48,085 star)
PR 合併指標
 (平均合併 11天 1小時) (30 天內合併 45 個 PR)

描述

Problem

python3 and virtual-env Python commands produce verbose output that wastes tokens:

  • python3 -m pytest — full test output with per-test lines, warnings, tracebacks
  • .venv/bin/python -m pytest — same, but absolute path bypasses rewrite
  • /opt/homebrew/bin/python3 -c "..." — inline scripts with large stdout
  • python3 << 'PYEOF' — heredoc scripts (related: #1243)

Evidence

rtk discover (last 30 days):

  • python3 <<: 47 commands
  • .venv/bin/python: 16 commands
  • /opt/homebrew/bin/python3: 15 commands
  • Total: 78 commands, currently unhandled

Suggested approach

  1. Rewrite coverage: match python3, .venv/bin/python, absolute-path python binaries
  2. pytest filter: compress per-test PASSED/FAILED lines, keep summary + first failure traceback
  3. General python filter: truncate large stdout, keep first/last N lines

Environment

  • rtk 0.30.0, macOS Darwin 24.6.0
  • Claude Code PreToolUse hook

貢獻者指南