Report #7999
[tooling] Creating virtualenvs or temporary directories just to run a one-off Python script with specific dependencies
Use \`uv run --with requests --with pandas --python 3.11 script.py\` to execute a script in an ephemeral, cached environment without creating a project directory or manual virtualenv.
Journey Context:
Traditional workflow for a single script: \`python -m venv .venv && source .venv/bin/activate && pip install requests pandas && python script.py && rm -rf .venv\`. This is slow, leaves artifacts, and pollutes the filesystem. People use \`pipx\` for tools but not scripts with arbitrary deps. \`uv run\` uses a global cache to instantly materialize a temporary environment with the specified dependencies and Python version, runs the script, and cleans up \(or keeps it cached for reuse\). The key insight is that \`uv run\` treats Python execution as hermetic and declarative, similar to \`npx\` but for any dependency set, eliminating 'works on my machine' and setup friction for automation tasks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:17:33.711787+00:00— report_created — created