检查python 3支持的要求 [英] Check requirements for python 3 support

查看:121
本文介绍了检查python 3支持的要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 pip要求文件中列出了几个具有不同依赖关系的python项目. .我已经开始考虑将代码移植到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超级大国之墙( 用于Programming Language :: Python :: 3文本,以定义软件包是否支持python 3rd分支.没有比在PyPI上抓取HTML更简单的方法了吗?

解决方案

借助@thefourtheye和 py3readiness.org 资料来源,我已经找到了我真正需要的东西.

布雷特·坎农(Brett Cannon)的

caniusepython3 模块:

确定哪些项目阻止您移植到Python 3

此脚本采用一组依赖项,然后找出哪些依赖项 他们中的许多人阻止了您移植到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分类器.

还有一个网络界面,您可以在其中键入依赖项或删除requirements.txt文件.

I have several python projects with different set of dependencies listed in pip requirements files. I've started to think about porting the code to python 3, but I need to know if my dependencies are already there.

Is it possible to check what packages from a requirements.txt file support python 3 and what don't?

Example requirements.txt contents:

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

From this list, only lxml supports python 3.


Just a side note.

There is a Python 3 Wall of Superpowers (python3wos project) that shows python 3 support of popular python packages.

As far as I understand, python3wos periodically parses the Python Package Index html pages and checks for the Programming Language :: Python :: 3 text to define whether a packages supports python 3rd branch or not. Isn't there anything simpler than scraping the html on PyPI?

解决方案

With the help of @thefourtheye and py3readiness.org sources, I've found exactly what I needed.

caniusepython3 module by 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.

Example (for the requirements.txt from the question):

$ 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

I should note that it still uses the same approach as python3wos - looking for Programming Language :: Python :: 3x classifiers on the package page.

There is also a web-interface where you can type your dependencies or drop a requirements.txt file.

这篇关于检查python 3支持的要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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