Skip to content

Commit 1e17cca

Browse files
committed
incremental and current builds added for dev env
1 parent b303972 commit 1e17cca

4 files changed

Lines changed: 304 additions & 41 deletions

File tree

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,47 @@ python run.py build
6868
python run.py build-docs
6969
```
7070

71-
The documentation version switcher (`switcher.json`) is automatically generated from git tags and `version.json` during the build process.
71+
The documentation version switcher (`switcher.json`) is automatically generated from git tags during the build process. Only tagged versions are included by default to ensure all links work correctly.
7272

7373
Options:
7474
- `--skip-build` (`-s`): Skip building before generating docs
7575
- `--local` (`-l`): Build documentation locally for a single version (skips multi-version build)
7676
- `--skip-switcher`: Skip generating switcher.json (useful for offline builds or custom switcher configurations)
77+
- `--include-current`: Include current working tree version from version.json in switcher (useful during development before tagging)
78+
- `--incremental`: Only build versions that don't have existing output directories (speeds up development by skipping already-built versions)
7779

7880
**Debug command:** To manually generate `switcher.json` without building docs:
7981
```sh
8082
python run.py generate-switcher
8183
```
8284

85+
**Development workflow:** When working on a version bump before tagging:
86+
```sh
87+
# Build docs including your current unreleased version
88+
# This will:
89+
# 1. Build all tagged versions via sphinx_multiversion
90+
# 2. Build current working tree version via sphinx
91+
# 3. Add current version to switcher.json as latest
92+
python run.py build-docs --include-current
93+
```
94+
95+
**Note:** By default, if `version.json` contains a version newer than the latest git tag, it will be validated but NOT added to the switcher (to prevent broken links). Use `--include-current` to build and include it during development, or create a git tag to include it permanently.
96+
97+
**Fast development iteration:**
98+
```sh
99+
# First build (builds all versions)
100+
python run.py build-docs --include-current
101+
102+
# Subsequent builds (only rebuilds current version, skips existing tagged versions)
103+
python run.py build-docs --include-current --incremental
104+
```
105+
106+
**How `--incremental` works:**
107+
- Checks which version directories already exist in `docs/build/html/`
108+
- For missing tagged versions: checks out each tag, builds docs, then restores your branch
109+
- For current version (with `--include-current`): only builds if directory doesn't exist
110+
- Useful during development to avoid rebuilding all historical versions every time
111+
83112
The documentation can be accessed locally by serving the docs/build/html/ folder:
84113
```sh
85114
cd docs/build/html

docs/source/readme.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,10 +1260,28 @@ The project includes a ``run.py`` script with several useful commands:
12601260
- ``--skip-build`` (``-s``): Skip building the package before generating docs
12611261
- ``--local`` (``-l``): Build documentation locally for a single version (skips multi-version build)
12621262
- ``--skip-switcher``: Skip generating switcher.json (useful for offline builds or custom switcher configurations)
1263+
- ``--include-current``: Build and include current working tree version from version.json (useful during development before tagging)
1264+
- ``--incremental``: Only build versions that don't have existing output directories (speeds up development by skipping already-built versions)
12631265

12641266
.. note::
12651267
The documentation version switcher (``switcher.json``) is automatically generated from
1266-
git tags and ``version.json`` during the build process.
1268+
git tags during the build process. Only tagged versions are included to ensure all
1269+
documentation links work correctly. If ``version.json`` is newer than the latest tag,
1270+
create a git tag to include it in the version switcher.
1271+
1272+
**Incremental Builds for Development:**
1273+
1274+
For faster iteration during development, combine ``--include-current`` with ``--incremental``:
1275+
1276+
.. code-block:: bash
1277+
1278+
# First build (builds all versions)
1279+
python run.py build-docs --include-current
1280+
1281+
# Subsequent builds (only rebuilds current version)
1282+
python run.py build-docs --include-current --incremental
1283+
1284+
The ``--incremental`` flag preserves existing version builds and only builds what's missing, significantly speeding up documentation updates during development.
12671285

12681286
**Viewing Documentation Locally**
12691287

0 commit comments

Comments
 (0)