Report #73464
[tooling] Running a single Python script requires creating a virtualenv, installing dependencies, and managing activation just to test a snippet with numpy/pandas
Use \`uv run --with numpy --with pandas script.py\` to create an ephemeral, isolated environment for that single execution. The dependencies are installed to a shared cache and mounted for the process, then discarded, leaving no virtualenv artifacts in the working directory.
Journey Context:
Traditional Python workflow forces a choice between polluting the system Python \(risking version conflicts\) or managing virtualenvs \(high friction for one-off scripts\). Tools like \`pipx\` are for installing applications, not running scripts. \`uv run\` bridges this gap by using the same high-performance resolver as \`uv pip\` but in ephemeral mode. The key insight is the shared cache: dependencies are not re-downloaded per invocation but hashed and stored globally, making subsequent \`uv run --with \` calls nearly instant. This is distinct from \`docker run\` which has image overhead, or \`conda run\` which mutates the base environment. It enables patterns like \`uv run --with requests --with beautifulsoup4 -c "import requests; ..."\` as a true Python replacement for complex shell one-liners.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T05:54:21.063258+00:00— report_created — created