Skip to content
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

Black not using global config when running on internal packages #2920

Closed
ronyis opened this issue Sep 4, 2022 · 5 comments
Closed

Black not using global config when running on internal packages #2920

ronyis opened this issue Sep 4, 2022 · 5 comments
Labels
build & infra Issues related to build & infrastructure. meta Related to repo itself, process, community, ... style

Comments

@ronyis
Copy link
Contributor

ronyis commented Sep 4, 2022

Running black tool locally, on internal packages which include a pyproject.toml file, do not use the global config defined in the main pyproject.toml (under root).

This issue was introduced since #2884, after adding pyproject.toml to all packages, which do not include black config.

When black is executed over files in the root directory, it does use the global config, since it ever uses only a single pyproject.toml each run (see Black lookup-hierarchy). This is still the case when running tox -e lint.

This issue makes it hard to execute black on changed files during development.
A possible workaround is to add a command arg black --config pyproject.toml to make black use the root config file. Though this is a bit cumbersome, and not documented.


Steps to reproduce
Run .tox/lint/bin/black ./opentelemetry-sdk --check (on a clean repo clone).

What is the expected behavior?
No files would be reformatted.

What is the actual behavior?

Oh no! 💥 💔 💥
49 files would be reformatted, 31 files would be left unchanged.
@srikanthccv srikanthccv added meta Related to repo itself, process, community, ... style build & infra Issues related to build & infrastructure. labels Sep 4, 2022
@ofek
Copy link
Contributor

ofek commented Sep 9, 2022

@ronyis
Copy link
Contributor Author

ronyis commented Sep 20, 2022

Do you think it's needed to update docs on how to properly run it? (@ofek)
Maybe CONTRIBUTING.md#development is a good place for that

@ofek
Copy link
Contributor

ofek commented Sep 20, 2022

@srikanthccv
Copy link
Member

This was addressed in #2929. Please re-open if it's not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build & infra Issues related to build & infrastructure. meta Related to repo itself, process, community, ... style
Projects
None yet
Development

No branches or pull requests

3 participants