name: uniqc-build-docs description: "Run the full UnifiedQuantum documentation build: execute all examples (pre-doc-execution), regenerate API reference via sphinx-apidoc, and build Sphinx HTML. Reports any warnings, errors, or diffs in example-exec-logs/."
UnifiedQuantum Documentation Build Skill
Use this skill when a developer wants to build the documentation locally. The build has two stages:
- Pre-doc-execution (
scripts/build_docs.py): runs everyexamples/<chapter>/*.py, captures stdout/stderr and matplotlib figures, generatesdocs/source/_generated/examples/Markdown pages, and refreshesexample-exec-logs/. - Sphinx HTML (
sphinx-build): builds the final site,{include}-ing the generated example pages.
make html runs both. make html-fast skips step 1 and trusts committed logs.
Steps
Step 1: Ensure the environment is up to date
cd /home/agony/projects/uniqc-skill-dev/UnifiedQuantum
uv sync --all-extras --group dev --group docs
If uv sync fails because of a missing optional extra (e.g. deprecated pyquafu), retry without --all-extras:
uv sync --group dev --group docs
Step 2: Run the full doc build
From the project root:
cd docs && uv run make html 2>&1
This runs (in order):
examplestarget — executesscripts/build_docs.pyand refreshesexample-exec-logs/apidoctarget — runssphinx-apidocto regenerate API rst stubs undersource/6_api/htmltarget — runssphinx-build -M html
Capture the full output and look for:
WARNINGorERRORlines from Sphinx- Traceback or Exception lines from example execution
- Non-zero exit code from
make html
Step 3: Check for example-exec-logs diffs
After a successful build, check whether the committed example outputs changed:
cd /home/agony/projects/uniqc-skill-dev/UnifiedQuantum
git diff --stat -- example-exec-logs/
- No diff: examples produced identical output to what is committed. No action needed.
- Diff present: an example's behaviour changed. Review the diff to confirm it is intentional (due to your code changes), then stage and commit the updated logs:
git add example-exec-logs/
Step 4: Check for generated-page diffs
git diff --stat -- docs/source/_generated/
Commit any intentional diffs:
git add docs/source/_generated/
Step 5: Report results
Report to the user:
- Whether the build succeeded (exit code 0) or failed.
- Number and category of warnings (if any).
- Whether
example-exec-logs/has uncommitted diffs (and whether they were committed). - Path to the built HTML:
docs/_build/html/index.html.
Fast rebuild (skip example re-execution)
If examples have not changed and only prose or API docs were edited, use the fast path:
cd docs && uv run make html-fast 2>&1
This skips scripts/build_docs.py and uses the already-committed example-exec-logs/.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
ModuleNotFoundError during example execution |
Missing optional dependency | uv sync --all-extras --group docs or install the specific package |
WARNING: unknown directive in Sphinx output |
Missing or renamed rst/md include path | Check docs/source/<chapter>/index.md for stale {include} paths |
example-exec-logs/ diff on CI but not locally |
Stale committed logs | Run make html locally, commit updated example-exec-logs/ |
sphinx-apidoc produces unexpected entries |
New module not excluded | Update APIDOC_EXCLUDE in docs/Makefile |