uv run in the repo builds the whole C++ extension; use --no-project for helper scripts
PitfallVerified 8 Oct 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
uv run python script.py from a checkout or worktree prints Creating virtual environment at: .venv and Building dftracer-utils @ file:///..., then sits for minutes.
Cause#
uv installs the project into the venv before it runs the script, and the project is a native extension.
Fix#
Run stdlib-only helper scripts with uv run --no-project python script.py. If a stray run already made a .venv in the checkout, kill it (pkill -f "uv run python") and delete that .venv.
Evidence#
gen_tree.py hung over two minutes with uv run python; with --no-project it finished at once.
Also found by searching
- uv run hangs building dftracer-utils
- Building dftracer-utils @ file:/// when running a helper script
- uv run creates .venv in the repo