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

Move setup.cfg to pyproject.toml #15247

Merged
merged 6 commits into from
Sep 21, 2023
Merged

Conversation

WilliamJamieson
Copy link
Contributor

Description

This pull request moves all the package configuration options from setup.cfg to pyproject.toml to bring astropy inline with PEP621.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions
Copy link

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • Is a milestone set? Milestone must be set but we cannot check for it on Actions; do not let the green checkmark fool you.
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions
Copy link

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@pllim pllim added this to the v6.0 milestone Aug 29, 2023
@pllim pllim requested a review from a team August 29, 2023 20:06
@WilliamJamieson WilliamJamieson force-pushed the feature/pyproject branch 2 times, most recently from b3f5edf to 66c2655 Compare August 29, 2023 20:40
@WilliamJamieson
Copy link
Contributor Author

I have made #15254 to get the changes black wants into astropy first. So I'll leave this in draft until #15254 gets merged.

Note that I have based this branch on the changes proposed by #15254 so commit 667bfd4 can be ignored as it will be rebased out once #15254 is merged.

Copy link
Member

@nstarman nstarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫰

docs/conf.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
Copy link
Member

@nstarman nstarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @WilliamJamieson! It’s great to migrate away from legacy config files. Aside from the changelog check not passing, let’s get this merged!

@pllim
Copy link
Member

pllim commented Aug 31, 2023

Would be nice if @astropy/astropy-project-release-team also get a chance to review. Let's wait a bit more. Thanks!

@pllim pllim requested a review from saimn August 31, 2023 15:33
@nstarman
Copy link
Member

Also, squash merge?

@astrofrog
Copy link
Member

I thought we did enforce 100 character line lengths?

@nstarman
Copy link
Member

AFAIK that was entirely done by human review. I can't find anything in a quick perusal of the git history.

@pllim
Copy link
Member

pllim commented Sep 20, 2023

Re: pep8speaks -- someone must have accidentally re-enabled it for this repo. I disabled it again but it is still enabled in the org for astroquery and photutils. FYI.

@pllim
Copy link
Member

pllim commented Sep 20, 2023

Back to the topic at hand, would be nice to get approval from @saimn since he had concerns before.

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks, @WilliamJamieson!

.pycodestyle Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, see my comment on .flake8.

@@ -6,7 +6,7 @@
import warnings

# First, the top-level packages:
# TODO: This list is a duplicate of the dependencies in setup.cfg "all", but
# TODO: This list is a duplicate of the dependencies in pyproject.toml "all", but
# some of the package names are different from the pip-install name (e.g.,
# beautifulsoup4 -> bs4).
_optional_deps = [
Copy link
Member

@nstarman nstarman Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a followup PR we could handle this more automatically if python>=3.11, using tomllib & importlib.metadata

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

Copy link
Member

@nstarman nstarman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @WilliamJamieson for biting the bullet and leading this long-desired transition.
I have dug up contentious conversations from 2021 asking for cfg->toml.

.flake8 Show resolved Hide resolved
Copy link
Contributor

@saimn saimn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small comment, LGTM otherwise.

pyproject.toml Outdated
authors = [
{ name = "The Astropy Developers", email = "astropy.team@gmail.com" }
]
license = { file = "LICENSE.rst" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to retain the SPDX identifier that was added some time ago.

license = { text = "BSD-3-Clause" }

Seems more informative. I'm not sure if we can put both in license, and I cannot find a clear recommendation (https://peps.python.org/pep-0621/#license). We can also use setuptools' license-files to specify the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we cannot do both, per PEP621 (last sentence):

The table may have one of two keys. The file key has a string value that is a relative file path to the file which contains the license for the project. Tools MUST assume the file’s encoding is UTF-8. The text key has a string value which is the license of the project whose meaning is that of the License field from the core metadata. These keys are mutually exclusive, so a tool MUST raise an error if the metadata specifies both keys.

So I had to use the tool.setuptools.liscense-files to specify the actual files, see 608019c

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since @saimn 's last comment is addressed, I am going to squash and merge. Thanks, everyone!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, sounds good then, thanks @WilliamJamieson.

@saimn
Copy link
Contributor

saimn commented Sep 21, 2023

Also would be great to stop polluting PRs with unrelated discussions on config files and tools. The main concern here is packaging, and if a mistake slips in the noise we will have to deal with it when the release is out.

@nstarman
Copy link
Member

nstarman commented Sep 21, 2023

Agreed we don't want to have a packaging problem! @saimn are you concerned about the failing weekly cron jobs?

@pllim
Copy link
Member

pllim commented Sep 21, 2023

are you concerned about the failing weekly cron jobs?

Those are also being discussed separately over at #15351 . I plan to look into the mess that is devdeps separately today (#15363).

@pllim pllim enabled auto-merge (squash) September 21, 2023 15:37
@pllim pllim disabled auto-merge September 21, 2023 15:45
@pllim pllim merged commit 98710e2 into astropy:main Sep 21, 2023
50 of 55 checks passed
@WilliamJamieson WilliamJamieson deleted the feature/pyproject branch September 21, 2023 16:14
pllim added a commit that referenced this pull request Sep 22, 2023
because it does not exist anymore after #15247 .

This is similar to that patch in #15370 for v5.3.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build all wheels Run all the wheel builds rather than just a selection Extra CI Run cron CI as part of PR installation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants