Skip to content

PEP 621: Migrate from setup.{py, cfg} to pyproject.toml #914

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jun 30, 2025

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

Migrate setup.py to setup.cfg using setuptools-py2cfg plus manual modifications. Then migrate setup.cfg to pyproject.toml using ini2toml to do the file conversion and running pyproject-fmt and then validate-pyproject to validate the results.

uvx --with=oauthlib setuptools-py2cfg > setup.cfg
uvx 'ini2toml[full]' setup.cfg -o pyproject.toml
git add pyproject.toml
uvx pyproject-fmt pyproject.toml
uvx 'validate-pyproject[all]' pyproject.toml
migrate ruff.toml to pyproject.toml
ruff check
migrate requirements*.txt to pyproject.toml  # Tox still needs them :-(
git rm setup.py
git rm setup.cfg
git rm ruff.toml
edit GitHub Actions

Codespell and mypy settings (in GitHub Action) and tox.ini could also be migrated.

@cclauss
Copy link
Contributor Author

cclauss commented Jul 1, 2025

@webknjaz, your review would be greatly appreciated, esp. on the PyPI release bits.

Copilot

This comment was marked as outdated.

@cclauss cclauss requested a review from JonathanHuot July 11, 2025 05:18
Copilot

This comment was marked as outdated.

Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates project configuration from setup.py and setup.cfg to a PEP 621–compliant pyproject.toml and updates CI workflows accordingly.

  • Remove legacy setup.py and setup.cfg
  • Introduce pyproject.toml with build-system and project metadata
  • Adjust GitHub Actions workflows to install extras and reference matrix variables

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
setup.py Legacy setup script removed
setup.cfg Legacy configuration removed
pyproject.toml New PEP 621 configuration for build-system and project metadata
.github/workflows/python-build.yml Updated COVERALLS_FLAG_NAME reference
.github/workflows/lint_python.yml Changed editable install to include selected extras
Comments suppressed due to low confidence (2)

.github/workflows/python-build.yml:29

  • The workflow references matrix.python but the strategy matrix key is named python-version. It should use ${{ matrix.python-version }} to match the defined matrix.
          COVERALLS_FLAG_NAME: ${{ matrix.python }}

]
optional-dependencies.rsa = [ "cryptography>=3" ]
optional-dependencies.signals = [ "blinker>=1.4" ]
optional-dependencies.signedtoken = [ "cryptography>=3", "pyjwt>=2,<3" ]

Choose a reason for hiding this comment

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

I think you can use recursive refs like

Suggested change
optional-dependencies.signedtoken = [ "cryptography>=3", "pyjwt>=2,<3" ]
optional-dependencies.signedtoken = [ ". [rsa]", "PyJWT >=2, <3" ]

(but please test to make sure)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's revisit that in a separate PR. I find it to be unintuitive.

Copy link

@webknjaz webknjaz Jul 11, 2025

Choose a reason for hiding this comment

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

It belongs in this PR as the previous implementation used a common source for these, and now it's disconnected. I believe that such a PR shouldn't include a behavior change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your reformulation says to me we are going to install . (this whole project) and then rsa (which is an unintuitive alias for cryptography), and then PyJWT. Putting the . in there means that we are disabling any use of --group-only.

Copy link
Member

Choose a reason for hiding this comment

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

Agree - recursive deps seems more prone to error and harder to read & understand. Let's keep cryptography in both groups.

@@ -15,8 +15,7 @@ jobs:
- run: pip install codespell mypy pytest ruff safety

Choose a reason for hiding this comment

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

Wonder why these aren't in the dependency groups. They could probably be moved into a linters group.

Additionally, that pip install at the top doesn't need to install setuptools or wheel at all. Replace it with a pip install 'pip >= 25.1' # for dependency group support

Copy link
Contributor Author

@cclauss cclauss Jul 11, 2025

Choose a reason for hiding this comment

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

I would move codespell, ruff, and safety into pre-commit or pipx run them.
I see little value in moving them to a separate file from the file in which they are run.

Safety should probably be dropped.

Choose a reason for hiding this comment

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

But since you're already moving some of the deps to groups, move the rest.

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep that task until those are shif-lefted into a pre-commit, or if integrated into tox; or also wait until #916 is progressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy