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

StackOverflow https://stackoverflow.com/questions/17281998

  •  01-06-2022
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top