sphinx_polyversion.api

API to use in config files like conf.py.

Functions

apply_overrides(namespace)

Override global config vars with values provided from the cmd line.

load([namespace])

Load metadata and sphinx config vars.

sphinx_polyversion.api.apply_overrides(namespace: dict[str, Any]) dict[str, Any][source]

Override global config vars with values provided from the cmd line.

You will usually want to pass globals().

Parameters:

namespace (dict[str, Any]) – The dictionary to alter.

Returns:

The values that were applied to the namespace.

Return type:

dict[str, Any]

sphinx_polyversion.api.load(namespace: dict[str, Any] | None = None) Any[source]

Load metadata and sphinx config vars.

This loads the polyversion metadata about the current revision and more from the POLYVERSION_DATA environment variable. You can pass this method the globals() dictionary to load the needed sphinx config vars and make them available as global variables.

Parameters:

namespace (dict[str, Any] | None, optional) – The dictionary to load the data into, by default None

Returns:

The data loaded from the env var.

Return type:

Any

Raises:

LoadError – The environment variable isn’t set.