Skip to main content

Inject Sphinx Configuration from pyproject.toml

Project description

sphinx-autopyproject

Move as much Sphinx configuration as possible from conf.py to pyproject.toml! Might even be ... everything

(If you are interested in more automatically generated API documentation, check out sphinx-automagicdoc as well.)

Usage

Either run spinx-autopyproject-build to run sphinx-build without the need for a conf.py to exist, or if you want to use a conf.py, add the line:

from sphinx_autopyproject.auto import *

To configure, set the [tool.sphinx-autopyproject] section:

[tool.sphinx-autopyproject]
extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.doctest",
    "sphinx_rtd_theme",
]

language = "en"
source_suffix = ['.rst']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_theme = "sphinx_rtd_theme"

The [tool.sphinx-autopyproject.autopyproject] section is to configure sphinx-autopyproject if desired. Supported is the dynamic subsection, which allows to automatically fetch configuration values from other sources, such as the package metadata. Multiple dynamic fetchers are supported: for type="package", the local package will be built (using build), for type="token", a variable assignment will be searched via plain file reading (e.g. to extract __version__), or for type="python", the given package/variable will be imported via Python.

[tool.sphinx-autopyproject.autopyproject.dynamic]
project = { type="package", value="name"}
copyright = { type="package", value="author"}
author = { type="package", value="author"}
version = { type="package", value="version"}

The sys_path list can be used to add directories to sys.path.

License

MIT

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

sphinx-autopyproject-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

sphinx_autopyproject-0.0.2-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinx-autopyproject-0.0.2.tar.gz.

File metadata

  • Download URL: sphinx-autopyproject-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for sphinx-autopyproject-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7b4e5662f63d972797e3e1240186d54941b39d12ca0dd9fd2ee43e0937f03b95
MD5 c665ba7bd06cabb25869edd8d43a100e
BLAKE2b-256 e1144967dfbdadf3909a971e5dd9c7f09d06cd0b8974685ded4652f49e1f9b94

See more details on using hashes here.

File details

Details for the file sphinx_autopyproject-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_autopyproject-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cefacef45bcfb17c694a41b4bf9dc3714f52f2d6b2fc6b3dd1e8eec9612013c0
MD5 e694fe50a61c6db87848cfa684f5f9cf
BLAKE2b-256 73b15ef6c3670690b0d53f094c46cd0d615e660f000c81e63d96e5937941cb7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page