Test Python-only changes of a native-extension package without a C++ rebuild (overlay), and avoid fish shell traps
RecipeVerified 1 Oct 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.
When to use#
A Python package has a compiled extension (dftracer-utils) and you changed only .py files, or you must test a library change against a consumer (dfanalyzer) before a release. The user's shell is fish.
Steps#
- Copy the installed package dir (venv/lib/python*/site-packages/dftracer) to a temp overlay dir.
- Copy the changed .py files over it before each run.
- Run the venv python with PYTHONPATH=
; verify with python -c 'import dftracer.utils.x; print(x.__file__)'.- Do not reinstall or rebuild. When you must reinstall:
uv pip install --reinstall --no-cache --no-deps <path>(a plain reinstall reuses a stale wheel). Fish traps: heredocs,sed -iand bash globs fail in fish. Wrap the command inbash -c '...'or write a small python script.import pkg.mod as Ccan return a function when the package re-exports a name: use importlib.import_module. A compiled extension older than the Python source gives false test failures (here: test_stage_of_a_later_release). Run the same test on the untouched package to confirm it is not a regression.Evidence#
Used in the dftracer-utils parity-gaps work, 2026-10-01: full suite ~1960 passed through the overlay; analyzer suites 171 smoke / 197 non-slow passed against it.
- Do not reinstall or rebuild. When you must reinstall: