Installation¶
ndiffusion needs Python 3.9 or newer and numpy.
pip install ndiffusion
Wheels are published for Linux (x86_64, aarch64), macOS (Intel, Apple silicon) and Windows, for Python 3.9 to 3.14. Anywhere else pip builds from source, which needs a C++17 compiler and CMake; pip fetches pybind11 and scikit-build-core itself. To build from a checkout:
pip install .
Optional extras¶
Extra |
Installs |
Needed for |
|---|---|---|
|
scipy |
the method of nearby problems (Solution verification) |
|
gmsh |
|
|
pytest, scipy |
running the test suite |
|
pytest, scipy, ruff, matplotlib |
everything CI runs |
|
sphinx, furo, myst-parser and friends |
building this site |
pip install ".[nearby,mesh]"
Development install¶
pip install -e ".[dev]"
This is an editable install: Python edits under src/ndiffusion/ are picked up
immediately, but the compiled _core extension is not. After editing any C++
source, run pip install -e ".[dev]" again to rebuild it.
If an import still picks up old behavior after a rebuild, look for a stale
_core*.so left in src/ndiffusion/ or an older non-editable copy of the
package in site-packages; either one shadows the new build.
Running the tests¶
pytest
Optional dependencies are handled with pytest.importorskip, so a bare
pip install -e . gives a run that looks clean while quietly skipping tests.
Without scipy that is the point-kinetics reference comparisons in
tests/test_kinetics.py - the main kinetics validation - plus all of
tests/test_nearby_*.py. Run pytest -rs to see what was skipped and why.
tests/test_mesh_gmsh.py needs the mesh extra, which is heavier and not part
of dev.
The suite turns ndiffusion.ConvergenceWarning into an error, so a test that
stops at an iteration cap fails rather than passing on an unconverged answer.
Building the documentation¶
pip install -e ".[docs]"
sphinx-build -W --keep-going docs docs/_build/html
The C++ reference is generated separately with Doxygen (see C++ API).