Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 404
Nitrodist Avatar asked Mar 24 '23 10:03

Nitrodist


1 Answers

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
like image 116
andrewdotn Avatar answered Apr 07 '23 17:04

andrewdotn