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

Migrating project metadata from setup.cfg to pyproject.toml triggers black changes #3859

Closed
WilliamJamieson opened this issue Aug 30, 2023 · 4 comments
Labels
T: bug Something isn't working

Comments

@WilliamJamieson
Copy link

Describe the bug

astropy is in the process of migrating its project metadata from the setup.cfg file to the pyproject.toml file in astropy/astropy#15247, as part of this process it triggered black making the changes in astropy/astropy#15254.

black making these changes was surprising as astropy has always configured black via the pyproject.toml file and no changes to the black configuration were made as part of astropy/astropy#15247. This seems like a bug if no changes to python files or the black configuration triggers black to make changes.

To Reproduce

Apply the changes from 3b9ceb1 (migration of project metatdata from setup.cfg to pyproject.toml) 7bc6005 (current head of astropy development) and then run black.

Expected behavior

No changes should be made by black.

Current behavior

The changes in 667bfd4 are made by black as part of the astropy pre-commit.

Environment

Additional context

I am not sure if this is an actual bug or just some flaw in the proposed migration of astropy's setup.cfg. In either case, it is surprising that a change unrelated to black or any python file triggers changes to be made by black.

@WilliamJamieson WilliamJamieson added the T: bug Something isn't working label Aug 30, 2023
@JelleZijlstra
Copy link
Collaborator

Probably due to #3219? You added requires_python= >=3.9 and I believe that triggers Black to format only in 3.9+ mode.

@WilliamJamieson
Copy link
Author

astropy's current configuration specifies python_requires = >=3.9 in the setup.cfg. This should do the same thing?

@JelleZijlstra
Copy link
Collaborator

No, Black only looks at pyproject.toml, not at the equivalent config in setup.cfg.

@WilliamJamieson
Copy link
Author

In that case this is likely the cause of the issue. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants