Skip to content Skip to sidebar Skip to footer

What Does The "py Version" In Pypi Project Page Mean? And Does It Matter?

I notice that, most projects released on PyPI contain a 'Py Version' meta data in their project page, but their values vary. If the package is not a universal package or not a pure

Solution 1:

Anywhere you see 2.7 or 3.5 or another Python version, that column was set by the bdist_wheel command, based on the current Python version used to build with, but this is the wrong value. This is bug 102 in the Wheels project issue tracker.

This was also reported as a bug in the PyPI project. It really should say py2.py3 for all those projects. Luckily, it doesn't matter to the tools used to install wheels what that column says, you still have a universal wheel, it'll be used for installations on either Python 2 or Python 3.

This is not PyPI's fault however, the field is set by the tool doing the uploading. The file_upload() XML-RPC handler takes the value unchanged from the uploader and inserts that into the database for later display. When using setuptools upload that value is ultimately sourced from the code that built the distribution file, so bdist_wheel in this case.

If you care deeply about your own project listing the correct information there, then I recommend you use the twine uploader instead; this package extracts the pyversion field from the wheel filename. Any project that has py2.py3 set in the Py Version column, used that tool to do the uploading. Twine has many other advantages, not least that you can use it to securely upload your files over HTTPS.

As for the any value, that's either set by manually uploading a file in the PyPI interface , or perhaps another tool or a previous version of twine or setuptools bdist_wheel I'm not aware about.

Solution 2:

Since this question was asked, the PyPI design has removed "Py Version" from project pages; the Py Version seems to have been related to the wheel tags or the version of Python used to upload the package, and would not affect which versions of Python can download a source package.

PyPI does feature the Requires-Python metadata Requires: Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* if it is available. This tag is independent of the package format, and a relatively new feature in pip, that controls whether or not the installer will attempt to install a particular project in the target version of Python.

Post a Comment for "What Does The "py Version" In Pypi Project Page Mean? And Does It Matter?"