Build This Doc Site#
This guide walks through building the TVM FFI documentation locally. Building the docs requires the Python package to be installed first; see Build from Source for instructions.
Prerequisite
uv manages the Python environment for all docs commands.
Ensure you are in the repository root before running the commands below.
Optional: install
Doxygenif you plan to generate the C++ API reference (see Build with C++ Docs).
Interactive Build (Auto-Reload)#
Rebuilds and serves the documentation locally with live reload:
uv run --group docs sphinx-autobuild docs docs/_build/html \
--ignore docs/reference/cpp/generated
By default, open http://127.0.0.1:8000 in your browser after the initial
build completes.
One-Off Build#
Generates the HTML documentation once, without running a server:
uv run --group docs sphinx-build -M html docs docs/_build
Build with C++ Docs#
Generating the C++ reference takes longer and requires Doxygen:
brew install doxygen # macOS
sudo apt install doxygen # Linux
Set BUILD_CPP_DOCS=1 on the desired build command to enable the extra step:
# Interactive build with auto-rebuild on C++ header changes
BUILD_CPP_DOCS=1 uv run --group docs sphinx-autobuild docs docs/_build/html \
--ignore docs/reference/cpp/generated --watch include
# One-off build
BUILD_CPP_DOCS=1 uv run --group docs sphinx-build -M html docs docs/_build
Build with Rust Docs#
Generating the Rust reference requires cargo to be installed:
# Install Rust toolchain if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Set BUILD_RUST_DOCS=1 on the desired build command to enable Rust
documentation:
# Interactive build with auto-rebuild on Rust source changes
BUILD_RUST_DOCS=1 uv run --group docs sphinx-autobuild docs docs/_build/html \
--ignore docs/reference/rust/generated --watch rust
# One-off build
BUILD_RUST_DOCS=1 uv run --group docs sphinx-build -M html docs docs/_build
Build All Documentation#
To build documentation with all language references enabled:
# Interactive build
BUILD_CPP_DOCS=1 BUILD_RUST_DOCS=1 uv run --group docs sphinx-autobuild \
docs docs/_build/html \
--ignore docs/reference/cpp/generated \
--ignore docs/reference/rust/generated \
--watch include --watch rust
# One-off build
BUILD_CPP_DOCS=1 BUILD_RUST_DOCS=1 uv run --group docs sphinx-build \
-M html docs docs/_build
Cleanup#
Remove generated artifacts when they are no longer needed:
rm -rf docs/_build/
rm -rf docs/reference/python/generated
rm -rf docs/reference/cpp/generated
rm -rf docs/reference/rust/generated