Skip to main content

Python Project sphinx-pytype-substitution

codeship readthedocs license github_version pip_version py_version pypi_downloads

Introduction

sphinx-pytype-substitution generates restructuredtext substitutions for python cross references.

Once added to the extensions list of the Sphinx configuration file conf.py it adds short and handy substitutions for modules and classes.

So, on one side it becomes easy to add cross references to some api documentation in the project. And on the other side these references are still easy readable, even if the text is displayed directly (as it happens on GitHub.com or on PyPi.org).

Install

The latest stable version can always be installed or updated via pip:

$ pip install sphinx-pytype-substitution

Usage

Once available add the extension to then extensions list in config.py

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx_pytype_substitution',
    'sphinx_rtd_theme',
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.doctest',
    'sphinx.ext.mathjax',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon'
]

And add the modules or classes to reference to as

# -- Config for pytype_substitution extension ------------------------------

pytype_substitutions = pkg,  # package, module or class to reference to

Additional options let select specific references

pytype_match_pattern = ''  # regex to filter entities to ref to
pytype_exclude_pattern = ''  # regex to exclude entities to ref to

and decide if the substitution should have short or full format, i.e.

pytype_short_ref = True  # drop module from reference (if it does not conflict)

for |date()| rather than |datetime.date()|. Note, sometimes the defining module matters as for |open()| vs |gzip.open()|.

During initialisation process of Sphinx the list of substitutions is generated and added to rst_epilog.

So the substitutions are available for every page.

To see which substitutions are added add

pytype_show = True  # print out all pytype_substitutions

License

Code and documentation are available according to the license (see LICENSE file in repository).

Metadata

Release files for sphinx-pytype-substitution 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-pytype-substitution 0.1.2
File Size Uploaded Provenance Actions
sphinx_pytype_substitution-0.1.2.zip 18.3 kB Without provenance Details for sphinx_pytype_substitution-0.1.2.zip

Release files / sphinx_pytype_substitution-0.1.2.zip

Download URL sphinx_pytype_substitution-0.1.2.zip
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1f52113205545d191fed0f91e445411609f15d2a1cad20bb74aa4aff8e1a2711
BLAKE2b-256 checksum
How to use checksums
eb5dfeab982f5dce36abaa9a9c8a0aaefc3da1dc2cc44cbf0bdef2ad226cb46d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for sphinx-pytype-substitution 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page