oct.docs.oct_docs module#
Purpose#
Provide documentation generation pipelines for Option C projects:
oct docs --sphinx, oct docs --doxygen, oct docs --all,
and oct docs --clean.
Responsibilities#
Set up Sphinx configuration in the project’s
docs/directory (if not already present).Discover markdown documentation files already in
docs/.Generate API reference pages from Python module docstrings via autodoc.
Generate dependency graph pages via
oct deps.Populate
index.rstwith all discovered content.Run
sphinx-buildto generate HTML output.Check for required Sphinx dependencies and emit a clear error if missing.
Run Doxygen with a patched Doxyfile (correcting stale INPUT paths).
Clean generated documentation artifacts while preserving user-authored files.
Diagnostics#
Domain: OCT-DOCS Levels:
L2 — lifecycle L3 — semantic details L4 — deep tracing
Contracts#
Must not overwrite existing
conf.pyif already present.index.rstis regenerated on every build (auto-generated content).Must exit 1 with a helpful message if Sphinx dependencies are not installed.
Template files are bundled in
oct/templates/sphinx/.Doxygen runs on a temporary copy of the Doxyfile; the original is never modified.
--cleanpreserves_sphinx/,_static/,_templates/,doxygen_work_dir/, and user-authored markdown files.
Dependencies#
oct.deps.oct_deps (dependency graph generation)
oct.core.exclusions (directory exclusion lists)
- oct.docs.oct_docs.run_docs_all(root: Path) int[source]#
Run both Sphinx and Doxygen pipelines.
Returns 0 if both succeed, 1 if either fails.
- oct.docs.oct_docs.run_docs_clean(root: Path, *, dry_run: bool = False) int[source]#
Remove generated documentation artifacts from docs/.
- Cleans: html/, doctrees/, _api/, doxygen_output/,
index.rst, dependencies.rst
- Preserves: _sphinx/ (user conf.py), _static/, _templates/,
user-authored .md files, doxygen_work_dir/Doxyfile
Returns 0 always.
- oct.docs.oct_docs.run_docs_doxygen(root: Path) int[source]#
Full oct docs –doxygen pipeline.
Check doxygen is installed (shutil.which)
Find existing Doxyfile in docs/doxygen_work_dir/
Create patched temp copy with correct INPUT
Run doxygen on the temp Doxyfile
Clean up temp Doxyfile
Report output location (docs/doxygen_output/)
Returns exit code: 0 on success, 1 on failure.
- oct.docs.oct_docs.run_docs_sphinx(root: Path) int[source]#
Full oct docs –sphinx pipeline.
Check dependencies
Set up Sphinx config (one-time)
Load .octrc.json docs configuration
Discover markdown files
Generate API reference (autodoc)
Generate dependency graph
Write populated index.rst
Run sphinx-build
Returns exit code.
- oct.docs.oct_docs.run_sphinx_build(docs_dir: Path, config: dict) int[source]#
Run sphinx-build to generate HTML output.
Returns exit code: 0 on success, 1 on failure.
- oct.docs.oct_docs.setup_sphinx(root: Path) Path[source]#
Set up Sphinx configuration in the project’s docs/ directory.
Uses docs/ as the Sphinx source directory directly — markdown files already present in docs/ are included without copying.
Sphinx config files (conf.py, Makefile, make.bat) live in docs/_sphinx/ to keep the docs/ root clean. The
-cflag inrun_sphinx_buildpoints Sphinx at this configuration directory.Returns the path to the docs directory.