Skip to content

Commit 62bb5b0

Browse files
committed
build(docs): bump RTD Python to 3.12, switch lock tool to uv
Read the Docs default runtime moved past 3.10; pydata-sphinx-theme's pinned Sphinx no longer builds under 3.13+, so pin RTD to 3.12 explicitly instead of trusting the default. pip-compile has a compatibility bug with recent pip, so lock regeneration now uses `uv pip compile`. Unpin sphinx-external-toc in requirements.in so uv can resolve a compatible version, and regenerate requirements_lock.txt accordingly. Add `make venv` (docs/Makefile) to encapsulate venv creation + locked-deps install, since the interpreter and lock tool are no longer implied by a bare `pip install`. Exclude `build`, `.venv*`, and `venv` in conf.py so a local virtualenv or prior build output isn't picked up as source on a second run. Add `.venv/` to .gitignore. Update docs/README.md to match the new venv/lock workflow. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
1 parent 61026eb commit 62bb5b0

7 files changed

Lines changed: 318 additions & 288 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,5 @@ MODULE.bazel.lock
110110

111111
# python venv
112112
venv/
113+
.venv/
113114
tmp/

‎.readthedocs.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-22.04
1010
tools:
11-
python: "3.10"
11+
python: "3.12"
1212

1313
# Build documentation in the "docs/" directory with Sphinx
1414
sphinx:

‎docs/Makefile‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR =
99
BUILDDIR = build
10+
# Read the Docs builds with 3.12 (see .readthedocs.yaml); override if you want
11+
# a specific interpreter locally.
12+
PYTHON ?= python3
1013

1114
# Put it first so that "make" without argument is like "make help".
1215
help:
1316
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1417

15-
.PHONY: help Makefile
18+
# Create a local virtualenv and install the hash-pinned doc-build dependencies.
19+
venv:
20+
$(PYTHON) -m venv .venv
21+
.venv/bin/pip install -r requirements_lock.txt
22+
23+
.PHONY: help Makefile venv
1624

1725
# Catch-all target: route all unknown targets to Sphinx using the new
1826
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

‎docs/README.md‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,33 @@ repository and is published at
1111

1212
### Requires
1313

14-
- Python 3.10 — the version Read the Docs builds with (see `.readthedocs.yaml`).
15-
The pinned Sphinx release does not run on Python 3.13 or newer.
14+
- Python 3.10+ (tested through 3.14) — Read the Docs builds with 3.12 (see
15+
`.readthedocs.yaml`); any recent `python3` on PATH works locally.
1616
- `pip`
1717
- `virtualenv` (or the standard-library `venv`)
1818

1919
### Install prerequisites
2020

21-
Run from the repository root:
21+
Run from `docs/`:
2222

2323
``` shell
24-
virtualenv .venv
24+
make venv
2525
source .venv/bin/activate
26-
pip install -r docs/requirements_lock.txt
2726
```
2827

28+
`make venv` just runs `python3 -m venv .venv && .venv/bin/pip install -r
29+
requirements_lock.txt`; pass `PYTHON=/path/to/python3` to use a specific
30+
interpreter instead of whatever `python3` resolves to on your PATH.
31+
2932
`docs/requirements_lock.txt` is the hash-pinned lock file that Read the Docs
3033
installs, so a local build matches the published one. The direct dependencies
3134
are listed in `docs/requirements.in`; after editing that file, regenerate the
32-
lock with:
35+
lock with [`uv`](https://docs.astral.sh/uv/) (`pip-compile` from `pip-tools`
36+
is a documented alternative, but at time of writing has a compatibility bug
37+
with recent `pip` releases):
3338

3439
``` shell
35-
pip-compile --generate-hashes --output-file=docs/requirements_lock.txt docs/requirements.in
40+
uv pip compile --upgrade --generate-hashes --output-file=docs/requirements_lock.txt docs/requirements.in
3641
```
3742

3843
### Build
@@ -62,7 +67,7 @@ It exits non-zero when any link is unreachable.
6267
`SupportedOS.md`, `Manpage.md`, `mainREADME.md`, and — because it is fetched
6368
rather than authored here — the tracked file `contrib/GitGuide.md`. Do not
6469
commit those changes; `git checkout docs/contrib/GitGuide.md` after a build.
65-
- Always `rm -rf docs/build` before rebuilding. The output directory is
66-
`build/`, but `conf.py`'s `exclude_patterns` only excludes `_build`, so a
67-
second run picks up the Markdown files written under `build/html/` as if they
68-
were source pages.
70+
- `conf.py`'s `exclude_patterns` excludes `build` (the actual output directory
71+
— Sphinx's own default is `_build`) and any local `.venv`/`venv`, so re-running
72+
a build, or building from a checkout with a local virtualenv already in
73+
`docs/`, does not pick that up as source content.

‎docs/conf.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
# This pattern also affects html_static_path and html_extra_path.
7171
exclude_patterns = [
7272
"_build",
73+
# The Makefile's actual BUILDDIR ("build", not the Sphinx-default "_build")
74+
# and any local virtualenv -- without these, a second build treats its own
75+
# previous output and installed packages' bundled images as source pages.
76+
"build",
77+
".venv*",
78+
"venv",
7379
# Verbatim copies of OpenROAD files; conf.py splices them into ORFS pages
7480
# rather than publishing them directly. See docs/_vendor/openroad/README.md.
7581
"_vendor",

‎docs/requirements.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sphinx-external-toc==0.3.1
1+
sphinx-external-toc
22
sphinx
33
sphinx-autobuild
44
myst-parser

0 commit comments

Comments
 (0)