httk.core.docs.sphinx_ext¶
Sphinx glue for version labels, development warnings, and the selector UI.
The module itself has no Sphinx import dependency. Sphinx is imported only by
setup(), allowing the rest of the documentation library to remain
stdlib-only and usable by release workflows.
Functions¶
|
Return a validated documentation label, defaulting to |
|
Return |
|
Return the URL path depth used by the selector for label. |
|
Render the tiny JSON configuration literal consumed by |
|
Return mapping with declared internal dependencies versioned. |
|
Register the extension with Sphinx and inject version-selector assets. |
Module Contents¶
- httk.core.docs.sphinx_ext.document_label(value)¶
Return a validated documentation label, defaulting to
dev:local.- Parameters:
value (str | None) – Requested release or development label.
- Returns:
Validated documentation label.
- Raises:
ValueError – If value is not a supported label.
- Return type:
- httk.core.docs.sphinx_ext.channel_for_label(label)¶
Return
releasefor a version tag anddevfor a development label.- Parameters:
label (str) – Documentation label to classify.
- Returns:
Channel associated with the label.
- Return type:
Literal[‘release’, ‘dev’]
- httk.core.docs.sphinx_ext.version_depth(label)¶
Return the URL path depth used by the selector for label.
- httk.core.docs.sphinx_ext.selector_config_literal(label)¶
Render the tiny JSON configuration literal consumed by
selector.js.- Parameters:
label (str) – Documentation label to encode.
- Returns:
JavaScript assignment containing selector configuration.
- Raises:
ValueError – If label is not a supported documentation label.
- Return type:
- httk.core.docs.sphinx_ext.derive_internal_intersphinx_mapping(mapping, config, pins, base_url, label, *, temporary_inventory_dir=None, committed_inventory_dir=None)¶
Return mapping with declared internal dependencies versioned.
The function is deliberately side-effect free. The Sphinx callback fetches the development inventories separately, then supplies their paths here.
dev:localis handled by the callback before this function is called so that the configuration object remains byte-for-byte untouched for local builds.- Parameters:
mapping (collections.abc.Mapping[str, tuple[str, str | list[str]]]) – Existing intersphinx mappings to copy and update.
config (httk.core.docs.config.VersioningConfig) – Configuration declaring internal dependencies.
pins (collections.abc.Mapping[str, str]) – Locked dependency versions for release mappings.
base_url (str) – Base URL containing dependency documentation sites.
label (str) – Release or development documentation label.
temporary_inventory_dir (str | pathlib.Path | None) – Directory for fetched development inventories.
committed_inventory_dir (str | pathlib.Path | None) – Directory containing committed release inventories.
- Returns:
Mapping with internal dependency targets and inventories updated.
- Raises:
ReleaseError – If a release dependency has no valid locked version.
ValueError – If the label or development inventory directory is invalid.
- Return type: