Run the Python suite and the docs build without installing anything
When to use#
Use this when you changed C++ that the Python extension builds, or Python code, and must run tests/python or the Sphinx docs, but the active environment has no editable install and you must not install tools (no pip install, no brew, no npm -g).
Steps#
Build the tests preset, which also builds the extension:
cmake --build --preset tests.Make a scratch package from the source tree and the built extension.
$SCRATCHis any scratch folder:&&Copy again after every edit to
python/or rebuild of the extension; the copy does not follow the tree.Run the suite in a throwaway
uvenvironment. SetDFTRACER_PLUGIN_INCLUDE, because the scratch package has noinclude/folder for the plugin build tests:DFTRACER_PLUGIN_INCLUDE=/include PYTHONPATH=/pypkg \Without
--with dask --with distributed, the distributed tests are skipped.The tests build is instrumented for coverage, so the run ends with many
profiling: ... .gcda: cannot merge previous GCDA filelines that push the pytest summary out oftail. Append2>&1 | grep -v '^profiling:' | tail -3to see the summary.Build the docs the same way:
PYTHONPATH=/pypkgCompare the warnings with a run before your change: the
autodoc: failed to import 'dfanalyzer...'warnings were already there.Run the linters with
uvx ruff check python/ tests/python/,uvx ruff format --check python/ tests/python/anduvx ty check python/.
Evidence#
- Plain
python3 -m pytest tests/python(system Python, no install) stops at collection:ModuleNotFoundError: No module named 'dftracer'.pythonis not on PATH. - Without
DFTRACER_PLUGIN_INCLUDE:PluginBuildError: cannot locate the plugin include dir; set DFTRACER_PLUGIN_INCLUDEintests/python/test_op_run.py. - Plain
sphinx-buildexited 127 (command not found); theuv run --with-requirements docs/requirements.txtform built with rc 0 and 16 warnings, all fromdfanalyzerautodoc imports. - Suite results on macOS with Python 3.14: 1102 passed, 52 skipped without dask; 1131 passed, 23 skipped with dask and distributed.