Pip: Specifying minor version

Question:

In my requirements.txt file I want to specify that my app needs Django version 1.3.x. That is, either 1.3.0, or 1.3.1, or 1.3.2, etc. (When these come out.) But not 1.4, when it comes out.

What’s the syntax for this?

Asked By: Ram Rachum

||

Answers:

According to Ian Bicking:

Django>=1.3,<1.4

However, it’s apparently safer to do:

Django>=1.3,<1.3.99
Answered By: quasistoic

my app needs Django version 1.3.x

In your case, use one of:


Compatible release

Django~=1.3.0

Ref: PEP 440 Compatible release


Version matching

Django==1.3.*

Ref: PEP 440 Version matching


Ordered comparison

Django>=1.3,<1.4

Note: ordered operators work for your case after the change introduced in this commit in 2015

Ref: PEP 440 Inclusive ordered comparison

Ref: PEP 440 Exclusive ordered comparison


Answered By: catwith
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.