sphinx-pyproject
Move some of your Sphinx configuration into pyproject.toml
Docs |
|
|---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
Installation
sphinx-pyproject can be installed from PyPI or Anaconda.
To install with pip:
$ python -m pip install sphinx-pyproject
To install with conda:
First add the required channels
$ conda config --add channels https://conda.anaconda.org/conda-forge $ conda config --add channels https://conda.anaconda.org/domdfcoding
Then install
$ conda install sphinx-pyproject
Usage
The SphinxConfig class will load the configuration from pyproject.toml. By passing globalns=globals() to the class constructor, the keys parsed from the pyproject.toml file will be added to the global namespace of the conf.py file.
For example:
# conf.py
from sphinx_pyproject import SphinxConfig
config = SphinxConfig("../pyproject.toml", globalns=globals())
author # This name *looks* to be undefined, but it isn't.
The SphinxConfig class also provides a collections.abc.Mapping interface. If you are going to override or modify one of the configuration values after parsing it, the recommended approach is to explicitly assign the name:
extensions = config["extensions"]
extensions.append("sphinx.ext.autodoc")
This will prevent warnings from linters etc., but is not necessary for Sphinx to see the configuration.
Additionally the SphinxConfig class takes an optional parameter config_overrides that can be used to dynamically update values from pyproject.toml. This can be helpful for setting dynamic values like version.
# conf.py
from sphinx_pyproject import SphinxConfig
from myproject import __version__ as myproject_version
config = SphinxConfig("../pyproject.toml", globalns=globals(), config_overrides = {"version": myproject_version})
Configuration
sphinx-pyproject parses the configuration from the [project] and [tool.sphinx-pyproject] tables in pyproject.toml. The [project] table is defined in PEP 621. sphinx-pyproject only uses the following keys:
name – The name of the project.
version – The version of the project.
description – The summary description of the project.
One of authors/maintainers.
The remaining Sphinx configuration values can be provided in the [tool.sphinx-pyproject] table.
See this project’s pyproject.toml file for an example of this configuration.
Metadata
Release files for sphinx-pyproject 0.3.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_pyproject-0.3.0.tar.gz | 7.7 kB | Without provenance | Details for sphinx_pyproject-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_pyproject-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for sphinx_pyproject-0.3.0-py3-none-any.whl |
Total release size: 30.8 kB
Release files / sphinx_pyproject-0.3.0.tar.gz
| Download URL | sphinx_pyproject-0.3.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efc4ee9d96f579c4e4ed1ac273868c64565e88c8e37fe6ec2dc59fbcd57684ab
|
|
BLAKE2b-256 checksum How to use checksums |
3997aa8cec3da3e78f2c396b63332e2fe92fe43f7ff2ad19b3998735f28b0a7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / sphinx_pyproject-0.3.0-py3-none-any.whl
| Download URL | sphinx_pyproject-0.3.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3aca968919f5ecd390f96874c3f64a43c9c7fcfdc2fd4191a781ad9228501b52
|
|
BLAKE2b-256 checksum How to use checksums |
90d589cb47c6399fd57ca451af15361499813c5d53e588cb6e00d89411ce724f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for sphinx-pyproject 0.3.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.