wheel icon indicating copy to clipboard operation
wheel copied to clipboard

Warn on universal=1 and Requires.Python not allowing Python 2.

Open henryiii opened this issue 4 years ago • 2 comments

Currently, packages often forget to remove universal=1 when upgrading to Python 3.x+ (not following the four step sequence described by @jaraco here), causing Python 3 only packages to have py2.py3 tags on PyPI (see pre-commit for a high profile example of a Python 3 only package with py2.py3). Another one is setuptools 45.0 (fixed in 45.1).

This is a simpler request than #336: I think it would useful to add a warning when these mismatch. The simplest check would be to see if python 2.7.18 passes python_requires; if it does not, then warn if universal is set.

Other options include making it an error (I don't believe people read warnings, but this would break a lot), or to ignore the setting when Python 2 is excluded. The later would prompt leaving "dirty" setup files, but would keep py2 tags out of py3 only projects.

How long is Python 2 going to be supported, by the way? pypa/packaging is a dep and is dropping Python 2 in the next release. Assuming you could still build universal=1 wheels from Python 3 after Python 2 is dropped, so it would still be better as the above warning rather than always warning on Python 3 only wheel versions. (?)

henryiii avatar Mar 09 '21 18:03 henryiii

How long is Python 2 going to be supported, by the way?

2.7 and 3.6 were dropped in December in https://github.com/pypa/wheel/commit/2fae593de291a9963f932ffe0e18241b9f95e5c8, not yet released.

hugovk avatar Feb 19 '22 17:02 hugovk

Not really relevant, though - you can still make a universal wheel that will load on Python 2, it just has to be built from Python 3. And setting universal=1 will still give both Python tags, sticking py2 in the filename. As it should, since that what universal=1 means. So it still is wrong to specify it as a user after dropping Python 2. We recently released another package with "wrong" tags because this was missed when removing Python 2.

If universal=1 was to be removed, it should then always produce a warning for a time, but I don't think it's slated for removal.

henryiii avatar Feb 24 '22 04:02 henryiii