pypi / warehouse

The Python Package Index
https://pypi.org
Apache License 2.0
3.54k stars 952 forks source link

PyPi assumes that a Release Version pertains to a particular Python version #16033

Open venkatkasirajan opened 3 months ago

venkatkasirajan commented 3 months ago

Describe the bug PyPi assumes that a Release Version pertains to a particular Python version. If I have a release version 0.5.0 and twine upload wheel files, some of them with a different Python version requirement, PyPi assumes that all wheel files uploaded under version 0.5.0 require the same Python version. This causes installation problems.

Expected behavior PyPi recognizes the Python version requirement for each wheel file under the same release version correctly. Pip install chooses the correct wheel files and installation proceeds normally.

To Reproduce Consider the following wheel files:

MyLib-0.5.0-cp311-cp311-manylinux_2_27_x86_64.whl MyLib-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl MyLib-0.5.0-cp311-cp311-win_amd64.whl MyLib-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl MyLib-0.5.0-cp36-cp36m-manylinux_2_28_x86_64.whl MyLib-0.5.0-cp312-cp312-manylinux_2_34_x86_64.whl

Each of these binary distribution wheel files have different Python requirement. However, the release version is 0.5.0.

PyPi assumes Python requirements for all these as 3.10.

If we examine the Jason response (https://pypi.org/pypi/MyLib/0.5.0/json), it is:

        "python_version": "cp311",
        "requires_python": "==3.10.*",

and so on.

This causes problems with pip, as it is not able to find the matching wheel files.

My Platform My Platforms are variant, Windows & several variants of Linux with varying Python and glibc installations.

Additional context Same release with wheel files having different Python requirements.

miketheman commented 3 months ago

Please provide a real example other than a sample mylib that doesn't have the issue you're showing to help reproduce the issue.

venkatkasirajan commented 3 months ago

Sure. I will upload the files again and send you the details.

Thanks and best regards, -Venkat-

venkatkasirajan commented 3 months ago

Please see this problem in the test environment:

https://test.pypi.org/pypi/QuantumRingsLib/0.5.0/json

You can see the same problem in the production environment as well.

Thanks and best regards -Venkat-

miketheman commented 3 months ago

Do you have an example from the production PyPI instead? The behaviors of TestPyPI may differ, specifically in the end user behavior, and are not always the same as a real production PyPI project.

venkatkasirajan commented 3 months ago

Hi Mike, Thanks for your attention on this problem. I deleted the 0.5.0 files, since we had to send the link to some of our users. The json link gives the same response, which means the internals of both PyPI and TestPyPI should be the same, for this problem.

I created some subversions where the wheel files for each corresponding Python version will reside. ex: 0.5.1 --> all Python 3.11 0.5.12 --> Python 3.12 0.5.6 --> Python 3.6 0.5.10 --> Python 3.10

This temporarily solves and pip is able to find the right wheel file and install.

I will upload again and let you know.

Thanks for the help.