Migrate to pyproject.toml
Updates:
- Fully migrated to pyproject.toml
- Added formatter and validator for pyproject.toml to pre-commit config
Ideas:
- We could use
hatchlingas 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.
Ping @bozhodimitrov
Which advantages/disadvantages can be expected with this approach?
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 supportssetuptools). - 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.
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.
Kindly pinging again @stefan6419846. If this project needs more love, I'd be more than happy to help with basic maintenance/triage.
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.