This is an automated email from the ASF dual-hosted git repository.
junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new 4f0b18c feat: Use uv-based workflow for doc building (#34)
4f0b18c is described below
commit 4f0b18c8d7536fbf5c51111c2acac84bf7eeaf58
Author: Junru Shao <[email protected]>
AuthorDate: Sat Sep 20 12:45:03 2025 -0700
feat: Use uv-based workflow for doc building (#34)
On `main`, doc building is managed by a relatively ad-hoc
`requirements.txt`-based workflow which could be a little bit less
convenient to control in CI. This PR introduces a modern uv-based flow
that makes the entire process one-liner:
```
uv run --group docs sphinx-autobuild docs docs/_build/html --ignore
docs/reference/cpp/generated
```
Later we could introduce uv lockfiles which updates regularly, as well
as CI options that monitor doc changes, etc.
---
docs/Makefile | 41 ---------------------------------------
docs/README.md | 53 ++++++++++++++++++++++++++++++++++++++-------------
docs/requirements.txt | 21 --------------------
pyproject.toml | 27 ++++++++++++++++++++++++--
4 files changed, 65 insertions(+), 77 deletions(-)
diff --git a/docs/Makefile b/docs/Makefile
deleted file mode 100644
index 51e4de2..0000000
--- a/docs/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# You can set these variables from the command line, and also
-# from the environment for the first two.
-SPHINXOPTS ?=
-SPHINXBUILD ?= python3 -m sphinx
-SOURCEDIR = .
-BUILDDIR = _build
-
-# Put it first so that "make" without argument is like "make help".
-help:
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-
-.PHONY: help Makefile livehtml clean
-
-livehtml:
- @sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--ignore reference/cpp/generated
-
-clean:
- rm -rf $(BUILDDIR)
- rm -rf reference/python/generated
- rm -rf reference/cpp/generated
-
-# Catch-all target: route all unknown targets to Sphinx using the new
-# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/README.md b/docs/README.md
index 39fff19..f0edc73 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -16,31 +16,58 @@
<!--- under the License. -->
# TVM FFI Documentation
-To build locally
+This guide walks through building and maintaining the TVM FFI documentation
set.
+
+## Prerequisites
+
+- [`uv`](https://docs.astral.sh/uv/) manages the Python environment for all
docs commands.
+- Ensure you are in the repository root before running the commands below.
+- Optional: Install `Doxygen` if you plan to generate the C++ API reference
(see "Build with C++ Docs").
+
+## Build Workflows
+
+### Interactive build (auto-reload)
+
+Rebuilds and serves the documentation locally with live reload:
+
+```bash
+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:
-First install the tvm-ffi package
```bash
-pip install ..
+uv run --group docs sphinx-build -M html docs docs/_build
```
-Install all the requirements to build docs
+### Build with C++ Docs
+
+Generating the C++ reference takes longer and requires Doxygen:
```bash
-pip install -r requirements.txt
+brew install doxygen # macOS
+sudo apt install doxygen # Linux
```
-Then build the doc
+Set `BUILD_CPP_DOCS=1` on the desired build command to enable the extra step:
+
```bash
-make livehtml
+# Interactive build
+BUILD_CPP_DOCS=1 uv run --group docs sphinx-autobuild docs docs/_build/html
--ignore docs/reference/cpp/generated
+# One-off build
+BUILD_CPP_DOCS=1 uv run --group docs sphinx-build -M html docs docs/_build
```
-## Build with C++ Docs
+## Cleanup
-To build with C++ docs, we need to first install Doxygen. Then
-set the environment variable `BUILD_CPP_DOCS=1`, to turn on c++ docs.
+Remove generated artifacts when they are no longer needed:
```bash
-BUILD_CPP_DOCS=1 make livehtml
+rm -rf docs/_build/
+rm -rf docs/reference/python/generated
+rm -rf docs/reference/cpp/generated
```
-
-Building c++ docs can take longer, so it is not on by default.
diff --git a/docs/requirements.txt b/docs/requirements.txt
deleted file mode 100644
index 55a8565..0000000
--- a/docs/requirements.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-autodocsumm
-breathe
-exhale
-linkify-it-py
-matplotlib
-myst-parser
-nbconvert
-nbsphinx
-nbstripout
-sphinx
-sphinx-autobuild
-sphinx-book-theme
-sphinx-copybutton
-sphinx-reredirects==0.1.2
-sphinx-tabs == 3.4.1
-sphinx-toolbox == 3.4.0
-sphinxcontrib-mermaid
-sphinxcontrib-napoleon==0.7
-sphinxcontrib_httpdomain==1.8.1
-tomli
-urllib3>=2.5.0
diff --git a/pyproject.toml b/pyproject.toml
index c7ebd39..4a6bd8e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,10 +32,8 @@ classifiers = [
]
keywords = ["machine learning", "inference"]
requires-python = ">=3.9"
-
dependencies = []
-
[project.urls]
Homepage = "https://github.com/apache/tvm-ffi"
GitHub = "https://github.com/apache/tvm-ffi"
@@ -46,6 +44,31 @@ torch = ["torch", "setuptools", "ninja"]
cpp = ["ninja"]
test = ["pytest", "numpy", "torch", "ninja"]
+[dependency-groups]
+docs = [
+ "autodocsumm",
+ "breathe",
+ "exhale",
+ "linkify-it-py",
+ "matplotlib",
+ "myst-parser",
+ "nbconvert",
+ "nbsphinx",
+ "nbstripout",
+ "sphinx",
+ "sphinx-autobuild",
+ "sphinx-book-theme",
+ "sphinx-copybutton",
+ "sphinx-reredirects==0.1.2",
+ "sphinx-tabs==3.4.1",
+ "sphinx-toolbox==3.4.0",
+ "sphinxcontrib-mermaid",
+ "sphinxcontrib-napoleon==0.7",
+ "sphinxcontrib_httpdomain==1.8.1",
+ "tomli",
+ "urllib3>=2.5.0",
+]
+
[project.scripts]
tvm-ffi-config = "tvm_ffi.config:__main__"