jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
784 stars 135 forks source link

PEP 621: Migrate from setup.py to pyproject.toml -- Part 2 #246

Closed cclauss closed 8 months ago

cclauss commented 10 months ago

How

Migrate setup.py to setup.cfg using setuptools-py2cfg plus manual modifications. Use setup-cfg-fmt to format the results.

Migrate settings from setup.cfg into pyproject.toml using ini2toml to do the file conversion and running pyproject-fmt and then validate-pyproject in pre-commit to validate the results.

Flake8 still does not support the use pyproject.toml so its configuration was moved to a .flake8 file.

Why

https://setuptools.pypa.io/en/latest/userguide/quickstart.html#basic-use

We recommend users expose as much as possible configuration in a more declarative way via the pyproject.toml or setup.cfg, and keep the setup.py minimal with only the dynamic parts (or even omit it completely if applicable).

From validate-pyproject README:

With the approval of PEP 517 and PEP 518, the Python community shifted towards a strong focus on standardization for packaging software, which allows more freedom when choosing tools during development and make sure packages created using different technologies can interoperate without the need for custom installation procedures.

This shift became even more clear when PEP 621 was also approved, as a standardized way of specifying project metadata and dependencies.

validate-pyproject was born in this context, with the mission of validating pyproject.toml files, and making sure they are compliant with the standards and PEPs.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e7b9365) 93.83% compared to head (6fb51b0) 93.83%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #246 +/- ## ======================================= Coverage 93.83% 93.83% ======================================= Files 11 11 Lines 535 535 Branches 87 87 ======================================= Hits 502 502 Misses 21 21 Partials 12 12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

claudep commented 8 months ago

I extracted just the PEP 621 part in #253, any review welcome. Of course, the rest of the patch is also valuable and could be pushed in a separate PR. By the way, I don't think we need both ruff and flake8. ruff only is fine.

cclauss commented 8 months ago

Closing in favor of #256