Browse the online documentation, including the Python API and methods and C++ API reference.
Start with the documentation index, installation, or Python quickstart. Maintainers can find hosting options and wheel packaging in the developer guide.
The documentation index collects the guide sources. The online site
is currently hosted by the Ruochun fork. GitHub Actions rebuilds and publishes
it on pushes to the branch selected by that repository's DOCS_PUBLISH_BRANCH
variable. See Hosting for setup and switching publication
to main. The C++ reference is generated from headers; the Python reference must
be regenerated and committed when bindings change.
The documentation site combines:
- authored Sphinx pages for installation, concepts, and Python usage;
- a C++ API reference generated by Doxygen and Breathe; and
- a static Python API reference generated from the installed pybind11 module.
Generated HTML, Doxygen XML, and other files under docs/_build/ are ignored
by Git.
Doxygen must be installed as an executable. Create a Python environment and install the Sphinx dependencies:
python3 -m venv .venv-docs
source .venv-docs/bin/activate
python -m pip install -r docs/requirements.txtInstall Doxygen through the operating system or Conda if it is not already available:
conda install -c conda-forge doxygenCheck the toolchain:
doxygen --version
sphinx-build --versionFrom the repository root:
/usr/bin/make -C docs htmlUsing /usr/bin/make is helpful on machines where make is aliased to
ninja. This command:
- syntax-checks the Python examples;
- generates Doxygen XML for the C++ public API; and
- builds the complete Sphinx HTML site with warnings treated as errors.
The resulting entry page is:
docs/_build/html/index.html
To remove generated output:
/usr/bin/make -C docs cleanThe equivalent CMake documentation target is:
cmake -S . -B build-docs -DDEME_BUILD_DOCS=ON
cmake --build build-docs --target docsNormal HTML builds use the committed docs/python/reference.rst and therefore
do not import DEME or require a CUDA GPU.
Regenerate that file after changing pybind11 signatures or docstrings. From the repository root, activate the Python environment used to build the extension and run this complete sequence. Doxygen and Sphinx must also be available:
# Build and stage the current Python extension.
cmake -S . -B build-python \
-DDEME_BUILD_PYTHON=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-python --target _deme --parallel
cmake --install build-python \
--component python \
--prefix /tmp/deme-python-reference
# Generate the reference using the same Python interpreter.
PYTHONPATH=/tmp/deme-python-reference \
/usr/bin/make -C docs python-reference PYTHON="$(command -v python)"
# Rebuild the documentation (requires Doxygen and Sphinx).
/usr/bin/make -C docs html
# Review the generated changes.
git diff -- docs/python/reference.rstDo not edit docs/python/reference.rst directly. Improve the corresponding
docstring in src/DEM/python/bindings.cpp, rebuild the extension, and
regenerate the page.
In Settings → Secrets and variables → Actions → Variables, create or update
the repository variable DOCS_PUBLISH_BRANCH to the branch that should publish
the documentation. Set it to develop to publish from develop instead of
DEME3_docs. This must be a repository variable, not a secret or an
environment variable: the workflow reads vars.DOCS_PUBLISH_BRANCH.
Set Settings → Pages → Build and deployment → Source to GitHub Actions,
and allow the selected branch in the github-pages environment's deployment
branch rules under Settings → Environments.
Commit the documentation sources, including the regenerated Python reference,
and push to the selected branch. The Build and publish documentation workflow
builds and publishes the site automatically. Keep generated docs/_build/
files out of Git.
An unset variable or a branch mismatch causes push and manual runs to skip the build and deployment. Changing the variable alone does not trigger a build; push a new commit or, when Run workflow is available, select the matching branch and run it manually. Pull requests build for validation without deploying. See hosting options for the full setup details.
Run a local HTTP server from the repository root:
python3 -m http.server 8000 \
--bind 127.0.0.1 \
--directory docs/_build/htmlOpen http://127.0.0.1:8000/ in a browser. Stop the server with Ctrl+C.
Start the same loopback-only HTTP server on the remote build machine. From the local workstation, create an SSH tunnel:
ssh -L 8000:127.0.0.1:8000 username@remote-hostKeep the SSH connection open and visit http://127.0.0.1:8000/ locally.
For a trusted local network, the server can instead listen on every interface:
python3 -m http.server 8000 \
--bind 0.0.0.0 \
--directory docs/_build/htmlThe site is then available at http://HOST_IP:8000/, subject to firewall
rules. Prefer SSH forwarding when the remote host should not expose the
documentation server publicly.