Skip to content

Support configuration files for sphinx-build to specify common options #9473

@kasium

Description

@kasium

Hello,
I'm not sure if this was already requested or discussed somehow but I just couldn't find anything.

Currently, in order to execute my sphinx build I use the setuptools integration which has the big benefit that I have a configuration file which "replaces" cli flags. If I would use sphinx-build I need to specify the source/build dir and all other flags on the CLI which are not supported in conf.py. However, I prefer to have just a simple command like sphinx-build and all other options a picked from a file like setup.cfg.

With the setuptools integration it's not possible to use any other file as far as I know, but I would like to use pyproject.toml exclusively. Therefore my question: Can sphinx support a configuration file like pyproject.toml and just picks there all needed information to execute it's command.

[tool.sphinx]
source_dir = "docs"
build_dir = "docs/_build"

If a user just executes sphinx-build, the source/build dir are used from the config file. A user can also override them by using the related flag/option: sphinx-build -W docs2.

Please note, that this should not replace/extend conf.py but is an extensions before this file is even loaded.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions