Include source code from any Sphinx project using only its import path
Project description
sphinx-code-include is an extension for Sphinx that lets you render source-code of any class or function directly into your Sphinx documentation using only as string.
Free software: BSD 2-Clause License
Example
.. code-include :: :func:`os.path.join`
This code-include block renders as: (theme is sphinx_rtd_theme)
As long as the string you’ve chosen is either
is importable
is coming from a project that has sphinx.ext.viewcode enabled
then code-include can find it and render it in your documentation.
Installation
pip install sphinx-code-include
You can also install the in-development version with:
pip install https://github.com/ColinKennedy/sphinx-code-include/archive/master.zip
Documentation
Development
To run the all tests run:
tox
Changelog
2.0.1 (2025-01-08)
Dropped Python 2.7-3.8 support
Added better CI + mypy
1.4.0 (2024-03-16)
Added better CI, updated GitHub badges, various quality of life changes
1.3.0 (2024-03-14)
Added explicit, separate GitHub workflow actions
1.2.0 (2024-03-13)
Added Python 3.10 support
Added initial GitHub workflow actions
1.1.2 (2023-04-22)
Added missing user_agent information. See https://github.com/ColinKennedy/sphinx-code-include/issues/5
1.1.1 (2019-10-26)
Fixed the requirements of the PyPI package
1.1.0 (2019-10-26)
Added :link-to-source: and :link-to-documentation: options
Added support for the :obj: tag (which can be used in place of :class:, :func:, or :meth:)
1.0.0 (2019-10-20)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_code_include-2.0.0.tar.gz.
File metadata
- Download URL: sphinx_code_include-2.0.0.tar.gz
- Upload date:
- Size: 235.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4237f0d99be746beee3c555343907f03dae737bcc7f07671968ee291c2d7b6ce
|
|
| MD5 |
854661ab8abfdc24d22835b83c588deb
|
|
| BLAKE2b-256 |
a6dcf2303aa342411a6484bccdf7d194d9f4c0da105d79cdc1e0fe653bc01af4
|
Provenance
The following attestation bundles were made for sphinx_code_include-2.0.0.tar.gz:
Publisher:
pypi.yml on ColinKennedy/sphinx-code-include
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_code_include-2.0.0.tar.gz -
Subject digest:
4237f0d99be746beee3c555343907f03dae737bcc7f07671968ee291c2d7b6ce - Sigstore transparency entry: 160976604
- Sigstore integration time:
-
Permalink:
ColinKennedy/sphinx-code-include@6a6c3f88415fc847ae1415191d0a476162174da3 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/ColinKennedy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6a6c3f88415fc847ae1415191d0a476162174da3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_code_include-2.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: sphinx_code_include-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fce2765c8e6fa84b1f7a460412162e50a6b74e44ed7768873293fafc0c2a68c
|
|
| MD5 |
821b27ddce39134ac0776e0d1edc6e32
|
|
| BLAKE2b-256 |
9fe3140996a604ba498dad2d7c34ed3772168884f8664eb349003da424baef48
|
Provenance
The following attestation bundles were made for sphinx_code_include-2.0.0-py2.py3-none-any.whl:
Publisher:
pypi.yml on ColinKennedy/sphinx-code-include
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_code_include-2.0.0-py2.py3-none-any.whl -
Subject digest:
4fce2765c8e6fa84b1f7a460412162e50a6b74e44ed7768873293fafc0c2a68c - Sigstore transparency entry: 160976606
- Sigstore integration time:
-
Permalink:
ColinKennedy/sphinx-code-include@6a6c3f88415fc847ae1415191d0a476162174da3 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/ColinKennedy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6a6c3f88415fc847ae1415191d0a476162174da3 -
Trigger Event:
push
-
Statement type: