What is the equivalent of twiddle-wakka (~>) from ruby's gem in requirements.txt for python's pip?

无人久伴 提交于 2019-12-12 12:20:39

问题


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.

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.

Is there an equivalent operator in for pip?


回答1:


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


来源:https://stackoverflow.com/questions/17281998/what-is-the-equivalent-of-twiddle-wakka-from-rubys-gem-in-requirements-txt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!