skillfed

sphinx-pyproject

Move some of your Sphinx configuration into pyproject.toml

sphinx-pyproject v0.3.0 167.2K downloads/30d#10,477 on PyPI27
Permissive license MIT Active released

What it is and what it does

sphinx-pyproject is a Sphinx extension that reads your documentation configuration from pyproject.toml instead of requiring everything in conf.py. It parses the standard PEP 621 [project] table for basic metadata (name, version, description, authors) and reads additional Sphinx settings from a [tool.sphinx-pyproject] table, then injects those values into your conf.py namespace. This lets you consolidate project metadata in one place and avoid duplicating version numbers and author information across files.

The package provides a SphinxConfig class that acts as both a configuration loader and a Mapping interface, so you can read values, override them programmatically (useful for dynamic version injection), or append to lists like extensions. It's designed for projects that want to follow PEP 621 conventions and reduce boilerplate in their documentation setup.

Use it for:

  • Consolidate project name, version, and author metadata in pyproject.toml so Sphinx reads it without duplication
  • Inject dynamic version numbers into Sphinx config at build time using config_overrides parameter
  • Migrate an existing Sphinx project to PEP 621 structure while keeping conf.py minimal and readable
  • Manage Sphinx extensions and settings in a centralized [tool.sphinx-pyproject] table for easier maintenance
  • Avoid manual synchronization of author and project details between pyproject.toml and conf.py

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Loads Sphinx documentation configuration from pyproject.toml instead of keeping it all in conf.py, using PEP 621 project metadata and custom tool settings.

Yes, if you use Sphinx and want to follow PEP 621 conventions. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem—keeping project metadata in one place. The 1092 days since last release is not a concern given the recent repository activity and the narrow, stable scope of the tool.

Install

sphinx-pyproject on PyPI

pip

pip install sphinx-pyproject

uv

uv add sphinx-pyproject

poetry

poetry add sphinx-pyproject

Installing sphinx-pyproject

Before you install

Low install friction with only two runtime dependencies (dom-toml and domdf-python-tools). Repository is active with a recent commit on 2026-07-06, though the last release was 2023-08-18.

License in practice

MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.

Quickstart

# Install
python -m pip install sphinx-pyproject

# In conf.py
from sphinx_pyproject import SphinxConfig

config = SphinxConfig("../pyproject.toml", globalns=globals())

# Configuration values from pyproject.toml are now available

Requires Python 3.6 or later; your pyproject.toml must contain [project] table (PEP 621) with name, version, description, and author/maintainer fields, plus optional [tool.sphinx-pyproject] for additional Sphinx settings.

Verify before relying

  • Whether dom-toml and domdf-python-tools are stable and well-maintained (not stated in fact sheet)
  • How well this integrates with Sphinx extensions that modify conf.py dynamically
  • Performance impact when loading large or complex pyproject.toml files

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 2 — dom-toml, domdf-python-tools
Maintenance actively maintained — 1,092 days since the last release
Last repo commit
First released
Downloads 167,217/month — #10,477 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sphinx_pyproject-0.3.0-py3-none-any.whl

Keywords: documentation, pep621, sphinx, toml

Development Status :: 4 - BetaFramework :: SphinxIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DocumentationTopic :: Documentation :: SphinxTopic :: Software Development :: DocumentationTopic :: UtilitiesTyping :: Typed

Tags

sphinx configuration in pyproject.tomlmove sphinx config to pyprojectpep 621 sphinx setupsphinx conf.py pyprojectsphinx configuration loadertoml sphinx configsphinx pyproject integration
pep-621sphinx-configdocumentation-tooling

More Utilities packages