pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.72k stars 211 forks source link

Update package metadata #551

Open ofek opened 2 years ago

ofek commented 2 years ago

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

Future

ionelmc commented 2 years ago

What exactly is hatch-autorun? How does it work? I don't get how this replaces the pth file we use.

ofek commented 2 years ago

It essentially does the current logic of executing the src/pytest-cov.embed in a PTH file.

ofek commented 2 years ago

CI passing btw

ofek commented 2 years ago

Just let me know if I can help!

ionelmc commented 1 year ago

I'll be honest here I'm not a fan of redoing something that works. But I am also curious how well this could work so how about this: release it as pytest-cov 5.0.0a (or beta) and we keep this in a special "alpha" branch till people try it out enough? This can only work if you pledge yourself to maintain pytest-cov's packaging from here on out :-)

RonnyPfannschmidt commented 1 year ago

I'm also in on this, starting with pluggy, then going for other pytest projects

I like hatch enough that i decided to let my own tool die in favour of it.

ofek commented 1 year ago

I rebased to fix conflicts. Would you mind triggering the CI with that button below?

ofek commented 1 year ago

I rebased again, accounting for https://github.com/pytest-dev/pytest-cov/pull/553#issuecomment-1284912148

ofek commented 1 year ago

flake?

ofek commented 1 year ago

I rebased again, accounting for https://github.com/pytest-dev/pytest-cov/pull/556

ofek commented 1 year ago

Would you mind triggering the CI with that button below?

ofek commented 1 year ago

Passing 🙂

cclauss commented 1 year ago

Please rebase.