epythet.confgen¶
Generate the Sphinx configuration from a DocsConfig.
sphinx_settings() returns the plain dict a conf.py would define. The
shim docsrc/conf.py that epythet.scaffold.make_docsrc() writes gets
it through from epythet.sphinx_conf import *; tests and tools call it
directly. Every value here is either verified in the v2 research (README
include, nested API tree, typed cross-references, agent twins) or a direct
consequence of the decision record.
>>> from epythet.config import DocsConfig
>>> cfg = DocsConfig(project_dir="/tmp/x", name="x", package_dir="x", theme="furo", api_generator="autosummary")
>>> s = sphinx_settings(cfg)
>>> s["html_theme"], s["default_role"], "sphinx.ext.autosummary" in s["extensions"]
('furo', 'code', True)
Module Attributes
Extensions every epythet site uses, whatever the API generator. |
|
Where the API pages live under |
Functions
|
The document |
|
Merge two settings dicts, concatenating list values instead of replacing them. |
|
The complete Sphinx |
- epythet.confgen.API_ROOT = 'api'¶
Where the API pages live under
docsrc(and in the site URL).
- epythet.confgen.BASE_EXTENSIONS: tuple[str, ...] = ('sphinx.ext.napoleon', 'sphinx_autodoc_typehints', 'sphinx.ext.intersphinx', 'sphinx.ext.doctest', 'sphinx.ext.viewcode', 'sphinx.ext.githubpages', 'myst_parser', 'sphinxcontrib.mermaid', 'sphinx_copybutton', 'epythet.sphinx_ext')¶
Extensions every epythet site uses, whatever the API generator.
- epythet.confgen.api_toctree_entry(config)[source]¶
The document
index.md’s toctree points at for the API pages.- Return type:
>>> from epythet.config import DocsConfig >>> api_toctree_entry(DocsConfig(project_dir="/tmp/x", name="x", api_generator="autosummary")) 'api' >>> api_toctree_entry(DocsConfig(project_dir="/tmp/x", name="x", api_generator="autoapi")) 'api/index'
- epythet.confgen.merge_settings(base, extra)[source]¶
Merge two settings dicts, concatenating list values instead of replacing them.
>>> merge_settings({"extensions": ["a"], "x": 1}, {"extensions": ["b"], "x": 2}) {'extensions': ['a', 'b'], 'x': 2}