“Py 版本"是什么?在 PyPI 项目页面中是什么意思?这有关系吗? [英] What does the "Py Version" in PyPI project page mean? And does it matter?

查看:74
本文介绍了“Py 版本"是什么?在 PyPI 项目页面中是什么意思?这有关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在 PyPI 上发布的大多数项目在其项目页面中都包含Py 版本"元数据,但它们的值各不相同.

I notice that, most projects released on PyPI contain a "Py Version" meta data in their project page, but their values vary.

如果包不是通用包或者不是纯python包,它们的值是可以理解的不同,以表示它们的目标平台,比如这个nose page 和这个 简单的json 页面.

If the package is not a universal package or not a pure python package, their values are understandably different, in order to denote their targeted platform, such as this nose page and this simplejson page.

但其他一些通用的纯 Python 包(据我所知)仍然包含略有不同的内容.例如:

But some other universal pure (as far as I can tell) Python packages still contain slightly different content. For example:

  • search "Py Version" in this requests PyPI page you will find "2.7"
  • In this rsa page you will find "3.5"
  • In six page it is "py2.py3"
  • In python-dateutil page you will see "any"

所以我的问题是,它们是由作者用来构建发布包的不同工具链引起的吗?我尝试运行 python2 setup.py sdist bdist_wheel --universal upload 给了我一个2.7"Py 版本值.下次我会尝试 python3 ... 然后 twine ... 看看我会得到什么.

So my question is, are they caused by different tool chain the author use to build their release package? My attempt of running python2 setup.py sdist bdist_wheel --universal upload gives me a "2.7" Py Version value. Next time I will try python3 ... and then twine ... to see what I will get.

更重要的是,所有这些都重要吗?我前面提到的命令行仍然构建了一个适合其他人在 Python 2 和 Python 3 环境中使用的通用包,不是吗?

More importantly, do all these matter? My aforementioned command line still builds a universal package suitable to be consumed by others on Python 2 AND Python 3 environment, doesn't it?

推荐答案

在任何您看到 2.73.5 或其他 Python 版本的地方,该列都被设置为 bdist_wheel 命令,基于用于构建的当前 Python 版本,但这是错误的值.这是 Wheels 项目问题跟踪器中的错误 102.

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.

这也在 PyPI 项目中报告为错误.对于所有这些项目,它真的应该说 py2.py3.幸运的是,用于安装轮子的工具与该专栏所说的无关,您仍然拥有一个通用轮子,它将用于在 Python 2 或 Python 3 上进行安装.

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.

这不是 PyPI 的错,但该字段是上传工具设置的.file_upload-() XMLhandler 从上传器获取未更改的值并将其插入到数据库中以供以后显示.使用 setuptools upload 时,该值最终来自构建分发文件的代码,因此在本例中为 bdist_wheel.

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.

如果您非常关心在那里列出正确信息的自己的项目,那么我建议您使用 twine 上传器代替;这个包提取pyversion轮文件名中的字段.任何在 Py 版本 列中设置了 py2.py3 的项目,都使用该工具进行上传.Twine 具有许多其他优势,尤其是您可以使用它安全通过 HTTPS 上传文件.

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.

至于 any 值,可以通过在 PyPI 界面中手动上传文件来设置,或者可能是其他工具或 twine 的先前版本setuptools bdist_wheel 我不知道.

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.

这篇关于“Py 版本"是什么?在 PyPI 项目页面中是什么意思?这有关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆