-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for --config
in pyproject.toml
#1826
Comments
This seems like a reasonable idea for a solid use case 👌 |
I'm happy to support this use case, but I got some questions around the implementation here:
I lean towards: 1-yes, 2-maybe, 3-no, and 4-yes. Also, we might have to add cycle detection to avoid runaway recursion or infinite looping. |
This is exactly what To make pathing work, always do:
NOT
And you should be good. Having Unittests on Ubuntu / Windows will confirm. I did this all for bandersnatch ... and it all works in Winblows. |
You can now specify `config` key in pyproject.toml which does the same job as the CLI option `--config`. The path of config should be relative to the CWD it is running from. If the file is not found or is invalid i.e. it is a folder rather a TOML file it would raise `click.exceptions.FileError`, and if the file can't be parsed it would raise `tomli.TOMLDecodeError`. All black config keys in the custom config should be registered under `[black]` and they would overwrite the config specified in pyproject but not the one specified by `--config` flag while running black with the CLI. Closes psf#1826
You can now specify `config` key in pyproject.toml which does the same job as the CLI option `--config`. The path of config should be relative to the CWD it is running from. If the file is not found or is invalid i.e. it is a folder rather a TOML file it would raise `click.exceptions.FileError`, and if the file can't be parsed it would raise `tomli.TOMLDecodeError`. All black config keys in the custom config should be registered under `[black]` and they would overwrite the config specified in pyproject but not the one specified by `--config` flag while running black with the CLI. Closes psf#1826
You can now specify `config` key in pyproject.toml which does the same job as the CLI option `--config`. The path of config should be relative to the CWD it is running from. If the file is not found or is invalid i.e. it is a folder rather a TOML file it would raise `click.exceptions.FileError`, and if the file can't be parsed it would raise `tomli.TOMLDecodeError`. All black config keys in the custom config should be registered under `[black]` and they would overwrite the config specified in pyproject but not the one specified by `--config` flag while running black with the CLI. Closes psf#1826
Note with #4204 we now no longer look at pyproject.toml that is missing a I'm not sure we should implement this feature without biting the bullet and doing true hierarchical config, as requested in #3952. Given that we now have #4204, how many folks here have a reason to want just this without also #3952? |
I am often dealing with projects that produce multiple libraries from the same repository, which looks a bit like:
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 normalpyproject.toml
. Basically something like:with each
pyproject.toml
containing:A relative path would be interpreted relative to the folder containing the
pyproject.toml
file.Thoughts? Would this be a welcome contribution?
The text was updated successfully, but these errors were encountered: