Releases: ComPWA/sphinx-api-relink
sphinx-api-relink 0.0.2
✨ New features
#1 makes it possible to generate an API through sphinx.ext.autodoc
by adding this to your conf.py
:
api_package_path = "../src/my_package" # relative to conf.py
More configuration values can be found in README.md
.
The full changelog as commits can be found here.
sphinx-api-relink 0.0.1
First release: the docs/_relink_references.py
scripts are now available as a Sphinx extension 🎉
Installation
Just install through PyPI with pip
:
pip install sphinx-api-relink
Next, in your Sphinx configuration file (conf.py
), add "sphinx_api_relink"
to your extensions
:
extensions = [
"sphinx_api_relink",
]
Usage
There are two ways to relink type hint references in your API. The first one, api_target_substitutions
, should be used when the target is different than the type hint itself:
api_target_substitutions: dict[str, str | tuple[str, str]] = {
"sp.Expr": "sympy.core.expr.Expr",
"Protocol": ("obj", "typing.Protocol"),
}
The second, api_target_types
, is useful when you want to redirect the reference type. This is for instance useful when Sphinx thinks the reference is a class
, but it should be an obj
:
api_target_types: dict[str, str] = {
"RangeDefinition": "obj",
}