Skip to content

Support for --config in pyproject.toml #1826

@grazhopper

Description

@grazhopper

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.py

All 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.toml

with 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions