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

Migrate to pyproject.toml #531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

egeakman
Copy link
Contributor

@egeakman egeakman commented Dec 29, 2023

Updates:

  • Fully migrated to pyproject.toml
  • Added formatter and validator for pyproject.toml to pre-commit config

Ideas:

  • We could use hatchling as the build backend

Here is an example project using hatchling and pyproject.toml.

To build:

python -m pip install build
python -m build

This builds a wheel and a tar under dist/, ready to ship.

@egeakman
Copy link
Contributor Author

egeakman commented Jan 5, 2024

Ping @bozhodimitrov

@stefan6419846
Copy link
Contributor

Which advantages/disadvantages can be expected with this approach?

@egeakman
Copy link
Contributor Author

egeakman commented Jan 5, 2024

Basically, pyproject.toml is the modern and standardized way for most Python packages.

Here are some more specific advantages and disadvantages of pyproject.toml:

Advantages:

  • All metadata and tool configuration in one place: less files (3 -> 1) to worry about.
  • Tool-agnostic: supports multiple build-backends like hatchling (unlike setup.py which only supports setuptools).
  • Tool integration: popular tools like black, isort, ruff, ... can be directly integrated.

Disadvantages:

  • Might not be the best option if dynamic or system-specific build logic is required (which is not for this project).
  • Requires an extra package to be installed: build, but it is already the recommended tool (by PyPA) for creating source distributions and wheels.

See also: Simon Willison's blog post, PEP 517, PEP 518

@egeakman
Copy link
Contributor Author

egeakman commented Jan 5, 2024

I'm more drawn to using hatchling these days. Here is an exhaustive answer to "Why Hatch?".

I can edit the PR to use hatchling instead of setuptools, just let me know.

@egeakman
Copy link
Contributor Author

egeakman commented Jan 8, 2024

Kindly pinging again @stefan6419846. If this project needs more love, I'd be more than happy to help with basic maintenance/triage.

@stefan6419846
Copy link
Contributor

I have no strong opinion on the build tools itself - if you have a look at my own repositories, you will see that I still mostly use the traditional setuptools approach with setup.py, although with the latest commands. For this reason, I personally do not see the direct need to migrate anything here unless there are actual maintenance benefits.

Leaving this aside: I am just a contributor here, no maintainer/collaborator, thus I am not able to decide this anyway ;) I am sure that the maintainers come back to you once they find appropriate time.

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.

None yet

2 participants