sphinx-reference-rename
This Sphinx extension allows you to rename a code reference prior to Intersphinx looking up the name. It exists to fix up some oddities that occur when you combine type hints (sphinx-autodoc-typehints) with Intersphinx references. For some objects defined in C extension modules, the fully-qualified name of the object is not the same as the one which is documented in the project’s objects.inv file.
For example, Pandas and Requests have some objects which are documented under a different name than their fully-qualified module name:
pandas.DataFrame is documented under that name, but when imported, it reports that its fully-qualified name is pandas.core.frame.DataFrame
requests.Request reports that it is requests.models.Request
>>> import pandas
>>> pandas.DataFrame
<class 'pandas.core.frame.DataFrame'>
>>> import requests
>>> requests.Request
<class 'requests.models.Request'>
Since sphinx-autodoc-typehints has to rely on this fully-qualified name, and the fully-qualified name doesn’t match the one in these projects’ documentation, the link won’t resolve. You can read more about the issue here.
Solving the Problem
To resolve this, install this module via pip:
pip install sphinx-reference-rename
Add the extension in your conf.py, and put it before sphinx.ext.intersphinx:
extensions = [
# ...
"sphinx_reference_rename",
"sphinx.ext.intersphinx",
# ...
]
Finally, create a dictionary named sphinx_reference_rename_mapping which maps fully-qualified names to the fixed names. For example, given the examples above:
sphinx_reference_rename_mapping = {
"pandas.core.frame.DataFrame": "pandas.DataFrame",
"requests.models.Request": "requests.Request",
}
Now, your sphinx build should succeed!
Metadata
Release files for sphinx-reference-rename 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx-reference-rename-0.1.0.tar.gz | 2.4 kB | Without provenance | Details for sphinx-reference-rename-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_reference_rename-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sphinx_reference_rename-0.1.0-py3-none-any.whl |
Total release size: 5.1 kB
Release files / sphinx-reference-rename-0.1.0.tar.gz
| Download URL | sphinx-reference-rename-0.1.0.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4faecb5eee611c2478439bf7dec5eef5e9a11d24f3972ef6c86130da0ba8e26
|
|
BLAKE2b-256 checksum How to use checksums |
d63ddf364aa7a30782a8ee2ee079af93e06a0fb1e13fd5727e006223abfa0967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / sphinx_reference_rename-0.1.0-py3-none-any.whl
| Download URL | sphinx_reference_rename-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a72542df4973ad0f843bb32227cc4df48d4840e715c2cb0e587a90212536162
|
|
BLAKE2b-256 checksum How to use checksums |
fab6cb0eca26ab54069b64ba808d40f78de2f1139104074ad0a94958d51a8d37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for sphinx-reference-rename 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.