Automate generation of switcher.json for Sphinx version dropdown and Introducing incremental documentation builds for dev productivity#68
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automation to generate the Sphinx version-switcher data (switcher.json) from git tags (and version.json), and wires it into the docs build so the dropdown is no longer maintained manually.
Changes:
- Introduces
scripts/generate_switcher.pyto generatedocs/source/_static/switcher.jsonfrom git tags (with version progression checks againstversion.json). - Extends
run.py build-docsto generate the switcher before building docs, plus addsrun.py generate-switcherand--skip-switcher. - Updates docs/README guidance and CI checkout behavior; removes the committed
switcher.jsonand ignores it going forward.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/generate_switcher.py | New script to generate switcher.json and validate version progression |
| run.py | Adds generate-switcher command + integrates switcher generation into build-docs |
| docs/source/readme.rst | Updates docs instructions to reflect auto-generation and new flag |
| docs/source/_static/switcher.json | Removes previously committed switcher.json (now generated) |
| README.md | Updates top-level docs build notes + adds debug command |
| .gitignore | Ignores generated switcher.json |
| .github/workflows/ci.yml | Ensures tags are available in CI docs build via fetch-depth: 0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @osinjoku, |
| """Fetch all git tags from the repository.""" | ||
| try: | ||
| result = subprocess.run( | ||
| ['git', 'tag', '-l'], cwd=ROOT_DIR, capture_output=True, text=True, check=True |
Description
This PR introduces the
generate_switcher.pyscript which reads the git tags available to generate theswitcher.jsonfile required by the sphinx documentation version switcher. The script validatesversion.jsonagainst the latest git tag on every run, with safeguards to block faulty version progressions (e.g.,27.0.0→27.0.2).Two new flags,
--incrementaland--include-current, are added tobuild-docsto speed up local development by skipping already-built tags and allowing the current working tree version to be previewed without creating a git tag.Fixes # (issue)
#67 - [FEATURE] Automatic generation of switcher.json for sphinx documentation
#69 - [FEATURE] Add --incremental and --include-current flags for faster local docs builds
Type of change
Checklist
Please delete options that are not relevant.
Changes in this PR
Version Rules
Legend