python.pip的Requirements.txt中来自ruby的gem的twiddle-wakka(〜>)等效于什么? [英] What is the equivalent of twiddle-wakka (~>) from ruby's gem in requirements.txt for python's pip?

查看:63
本文介绍了python.pip的Requirements.txt中来自ruby的gem的twiddle-wakka(〜>)等效于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了ruby的gem文件中使用的twiddle-wakka运算符(〜>)(文档)来指定兼容的最后一个点版本:

I've seen the twiddle-wakka operator (~>) used in ruby's gem file (documentation) to specify the last point version compatible like this:

'~> 0.3.1' is satisfied by 0.3.1, 0.3.2, 0.3.3, etc.
'~> 0.3.1' is not satisfied by 0.3.0
'~> 0.3' is satisfied by 0.3.1, 0.4.0, 0.5.1, etc.
'~> 0.3' is not satisfied by 0.2.0, 0.2.1, etc.

我看到requirements.txt中有一个>=运算符,可用于指定比此更好的任何东西,但我希望避免以后的任何软件包更新(主要版本更新)都不能与我的向后兼容.已经有代码了-因此我为什么要旋转-Wakka.

I see that there's a >= operator in the requirements.txt that can be used to specify anything better than that, but I'm hoping to avoid any future package updates (major version updates) not being backwards compatible with my code already -- hence why I want a twiddle-wakka.

pip中是否有等效的运算符?

Is there an equivalent operator in for pip?

推荐答案

总有一天~=

Someday it will be ~= the compatible-release operator specified by PEP 440, but none of the common Python tooling supports it yet—not pip, nor the newly-reborn setuptools unfork.

现在,您必须手动指定它,例如

For now you’ll have to manually specify it, e.g.,

Django >= 1.4.3, < 1.5

这篇关于python.pip的Requirements.txt中来自ruby的gem的twiddle-wakka(〜&gt;)等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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