Skip to content

rtk should proxy generic python3 / python (58 unhandled calls/30d) #2312

Closed as duplicate

Description

@jakashop-kara

Summary

rtk discover flags python3 (30 direct + 28 heredoc invocations) as unhandled. Only pytest is currently mapped.

Observed

$ rtk hook check python3 --version
No rewrite for: python3 --version

$ rtk hook check python3 -c "print(1)"
No rewrite for: python3 -c "print(1)"

Use cases

  • python3 --version — single line, low value to wrap
  • python3 -m <module> ... — could map to rtk pytest when module=pytest, or new subcommands
  • python3 -c '<expr>' — typically short, low value
  • python3 <<EOF ... EOF — heredoc, often multi-line scripts, output unbounded
  • python3 script.py — script output unbounded

Proposal

Two-stage approach:

  1. Safe by default: pipe python3 output through rtk summary heuristic when output > 1KB
  2. Explicit: add rtk py alias for python3 with --summary / --raw flags

Known limitation

Heredoc forms (python3 <<EOF) — the hook parser does not currently rewrite these (verified echo $(cat ...) is similarly bypassed for safety). Issue only addresses the direct-invocation path.

Context

  • rtk 0.42.3
  • Most useful for: short one-off scripts where output is dominated by debug prints

Activity

  1. added
    enhancement
    help wanted
    on Jun 7, 2026
  2. pszymkowiak commented on Jun 7, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟢 Priority low
    🎯 Confidence 91%

    Summary

    Feature request to add a proxy/filter for generic python3/python invocations with output summarization; well-scoped proposal but low-value use cases acknowledged by author


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. lntutor commented on Jul 20, 2026

    @lntutor
    Contributor

    I am working on this against current develop. I will add rtk python routing for direct python/python3 invocations, preserve interactive and version modes as passthroughs, summarize only output larger than 1 KiB with full-output recovery, and cover module/script/inline routing plus stdin behavior.

  4. host-felice commented on Aug 26, 2026

    @host-felice

    Volume data point from another environment (Windows, rtk discover -a, 176 sessions / 10,086 Bash commands over the last 30 days):

    python is the top unhandled command with 634 invocations in 30 days — roughly 11x the 58 in the title. The dominant form by far is the heredoc one (python - <<'EOF'), which the issue body currently scopes out as a known limitation.

    Posting the count only, no input on the design.

  5. KuSh commented on Sep 13, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #928, which tracks the same request - rewrite and filter support for direct python/python3 invocations covering script, -m module and heredoc forms - and has the fullest breakdown and reproduction. The specifics raised here (usage counts, summarisation threshold, venv and absolute-path interpreters) are worth adding as a comment there so they are not lost. Please continue the discussion on #928.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions