Sphinx

The sphinx macro prepares registered cikit artifacts for documentation and builds the final HTML documentation.

Dependencies

Sphinx and its sphinx-build executable are required.

Themes and additional Sphinx extensions used by the target documentation must be installed by the consuming project. They are not dependencies of the cikit Sphinx macro itself.

Features

  • generated RST report integration

  • badge integration

  • static artifact integration

  • folder artifact integration

  • HTML documentation builds

  • HTML folder artifact registration

  • cikit Sphinx extension integration

Typical usage

from pathlib import Path

from cikit.macros import sphinx

docs_dir = Path("docs")

sphinx.prepare(env, docs_dir)
sphinx.generate_badges_include(env, docs_dir)
html_artifact = sphinx.sphinx(env, docs_dir, entry_point=Path("index.html"))

prepare() rebuilds the generated portions of the Sphinx source tree from registered cikit artifacts. RST artifacts are copied to <docs_dir>/_generated while other artifact types are placed below <docs_dir>/_static according to the common Sphinx artifact layout. generate_badges_include() optionally writes an RST include file referencing the registered badges.

The documentation itself is built in a temporary directory. The completed HTML tree is then registered as a folder artifact with the specified entry point. The default is index.html; pass entry_point=None to omit it.

See Sphinx Documentation Build for the complete documentation build workflow and Sphinx Extensions for the cikit-specific roles and directives.