gpt4 book ai didi

python - 检查 python 3 支持的要求

转载 作者:太空宇宙 更新时间:2023-11-03 21:17:33 25 4
gpt4 key购买 nike

我有几个 python 项目,它们具有不同的依赖项,列于 pip requirements files 中。 。我已经开始考虑将代码移植到 python 3,但我需要知道我的依赖项是否已经存在。

是否可以检查 requirements.txt 文件中的哪些软件包支持 python 3,哪些不支持?

requirements.txt 内容示例:

mysql-python==1.2.5
lxml==3.3.4
Fabric==1.8.0

在此列表中,只有 lxml 支持 python 3。

<小时/>

只是一个旁注。

有一个Python 3 Wall of Superpowers ( python3wos 项目)显示流行 python 包的 python 3 支持。

据我了解,python3wos 定期解析 Python Package Index html 页面和 checks用于 Programming Language::Python::3 文本来定义包是否支持 python 3rd 分支。难道没有比在 PyPI 上抓取 html 更简单的事情了吗?

最佳答案

在@thefourtheye和py3readiness.org的帮助下来源,我已经找到了我需要的东西。

caniusepython3 Brett Cannon 的模块:

Determine what projects are blocking you from porting to Python 3

This script takes in a set of dependencies and then figures out which of them are holding you up from porting to Python 3.

示例(对于问题中的 requirements.txt):

$ caniusepython3 -r requirements.txt 
Finding and checking dependencies ...

You need 2 projects to transition to Python 3.
Of those 2 projects, 2 have no direct dependencies blocking their transition:

fabric
mysql-python

我应该注意到,它仍然使用与 python3wos 相同的方法 - 在包页面上查找 Programming Language::Python::3x 分类器。

还有一个web-interface您可以在其中键入依赖项或删除 requirements.txt 文件。

关于python - 检查 python 3 支持的要求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54569677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com