rtk icon indicating copy to clipboard operation
rtk copied to clipboard

Add handler for `uv run` (Python; high-frequency, currently unhandled)

Open abhinavmathur-atlan opened this issue 4 months ago • 4 comments

Summary

uv run is the most frequent unhandled command in rtk discover output — 1505 invocations over 30 days in my history — but rtk has no dedicated filter for it, so its output passes through raw.

TOP UNHANDLED COMMANDS -- open an issue?
Command       Count    Example
uv run         1505    AGENT_MODEL_PUBLIC_NAME=gpt-5.5 ANSWER... uv run ...

Why it matters

uv is now the dominant Python runner in many toolchains (replacing python -m/.venv/bin/python). rtk already special-cases npx with intelligent routing (tsc/eslint/prisma → specialized filters). uv run deserves the same: it commonly wraps pytest, ruff, mypy, and plain scripts that rtk already has filters for.

Suggested behavior

Route uv run <tool> … to the existing specialized filter when <tool> is recognized (pytest → pytest filter, ruff → ruff, mypy → mypy, python script → generic run filter), mirroring the existing rtk npx dispatch. Fall back to tracked passthrough otherwise.

Related friction (separate, not blocking)

Leading env-var assignments (AGENT_MODEL=… uv run …, CTX=… kubectl …, PYTHONPATH=… python …) defeat the PreToolUse hook because the leading token is VAR=val, not the tool. If the hook rewriter could skip leading NAME=value assignments and rewrite the first real command token, adoption would jump substantially (my last-30d hook adoption was 0.1% largely due to this pattern). Happy to file that separately if useful.

Environment: rtk 0.43.0 (Homebrew), macOS.

abhinavmathur-atlan avatar Jul 05 '26 16:07 abhinavmathur-atlan

wshm · Automated triage by AI

🔍 Automated Triage

✨ Category feature
🟠 Priority high
🎯 Confidence 90%

Summary

Add a dedicated uv run dispatcher (mirroring the existing npx routing) that forwards to pytest/ruff/mypy/generic-run filters based on the wrapped tool, since it's the top unhandled command (1505 invocations/30d) with no current handling.


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

pszymkowiak avatar Jul 05 '26 16:07 pszymkowiak

Hey @abhinavmathur-atlan this is already on develop branch and will be in next release !

aeppling avatar Jul 06 '26 06:07 aeppling

This looks resolved on the current code (src/cmds/python/uv_cmd.rs on develop), but it could not be fully reproduced here. Marking it resolved-pending-close: it will be closed in a while unless someone reports it still happening on the latest version.

KuSh avatar Sep 05 '26 12:09 KuSh

uv run now has a dedicated handler that routes the wrapped tool to the matching filter, shipped in v0.44.0. uv run pytest tests/ rewrites to uv run rtk pytest tests/, uv run ruff check . to uv run rtk ruff check ., and uv run python -m pytest -q to uv run rtk pytest -q; leading env-var assignments like AGENT_MODEL=x uv run pytest -q are also handled by the rewriter now. Please comment or reopen if you still see raw passthrough on the latest version.

KuSh avatar Sep 13 '26 00:09 KuSh