Skip to content

Replace setuptools build backend with hatchling#551

Closed
ofek wants to merge 1 commit intopytest-dev:masterfrom
ofek:modernize-metadata
Closed

Replace setuptools build backend with hatchling#551
ofek wants to merge 1 commit intopytest-dev:masterfrom
ofek:modernize-metadata

Conversation

@ofek
Copy link
Contributor

@ofek ofek commented Aug 26, 2022

cc @graingert as requested!

Background

Hello there! The Python packaging ecosystem has standardized on the interface for build backends (PEP 517/PEP 660) and the format for metadata declaration (PEP 621/PEP 631). As a result, the execution of setup.py files is now deprecated.

So, I'm spending my free time updating important projects so that they are modernized and set an example for others 😄

Summary of changes

This implements PEP 621, obviating the need for setup.py and MANIFEST.in. The build backend hatchling (of which I am a maintainer in the PyPA) is now used as that is the default in the official Python packaging tutorial. Hatchling is available on all the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, Alpine Linux, FreeBSD/OpenBSD, Gentoo Linux, MacPorts, OpenEmbedded, Spack, MSYS2, etc.

Python support

The earliest supported Python 3 version of Hatchling is 3.7, therefore I've also set that as the minimum here. Python 3.6 is EOL and other build backends like flit-core and setuptools also dropped support. Python 3.6 accounted for 6-8% of downloads in the last month: https://pypistats.org/packages/pytest-cov

Notes

  • The source distributions on PyPI are erroneously shipping a build artifact *.egg-info from python setup.py develop; this is now fixed
  • The CHANGELOG.rst regex substitution was doing nothing so the PyPI landing page continues to be simply README.rst + CHANGELOG.rst
  • The generated pytest-cov.pth was being checked into the repo but is not necessary now so I've removed it

Future

  • Move config for tools like pytest out of setup.cfg and into pyproject.toml

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants