Support for `--config` in pyproject.toml
Author: grazhopperCreated Nov 18, 2020Updated Sep 13, 2026
LabelsT: enhancementC: configuration
I am often dealing with projects that produce multiple libraries from the same repository, which looks a bit like:
src/lib1/pyproject.toml
src/lib1/setup.py
src/lib2/pyproject.toml
src/lib2/setup.pyAll libs need to follow the same formatting rules, which means that the black configuration has to be duplicated in each pyproject.toml file.
A possible way to avoid the duplication could be to teach black to handle the already existing --config option when it is provided inside the normal pyproject.toml. Basically something like:
src/lib1/pyproject.toml
src/lib1/setup.py
src/lib2/pyproject.toml
src/lib2/setup.py
src/black.tomlwith each pyproject.toml containing:
[tool.black]
config = '../black.toml'A relative path would be interpreted relative to the folder containing the pyproject.toml file.
Thoughts? Would this be a welcome contribution?
Source: psf/black