Reputation: 1363
I'm using versioneer
to manage versions, ala PEP 440.
I have uploaded a few versions to a private repository:
0.0.1
0.0.2
0.0.2+0.0.2+18.g5a127f2.dirty
My problem is that now when I use
pip install mypackage==0.0.2
I get version 0.0.2+0.0.2+18.g5a127f2.dirty
when I expected to get 0.0.2
.
Is there a way to have have pip ignore the "local version" and just install the exact version, without me having to upload to different indices (ie. staging and stable)?
Edit:
I have tried using the --no-cache-dir
and -I
flags, but the issue persists; pip is preferring the 0.0.2+ version to the 0.0.2 version.
Additional Edit:
I'm using pip 18.0
and Python 2.7
Upvotes: 2
Views: 2647
Reputation: 1363
According to distutils:
Following a release number, you can have either a pre-release or post-release tag. Pre-release tags make a version be considered older than the version they are appended to. So, revision 2.4 is newer than revision 2.4c1, which in turn is newer than 2.4b1 or 2.4a1. Postrelease tags make a version be considered newer than the version they are appended to. So, revisions like 2.4-1 and 2.4pl3 are newer than 2.4, but are older than 2.4.1 (which has a higher release number).
So, while not the solution I'm looking for (full answer below) it looks like this works:
pip install "mypackage<=0.0.2"
The distutils blurb about post-releases seems to go against what is specified in PEP440
[Examples: ...] == 3.1: specifically version 3.1 (or 3.1.0), excludes all pre-releases, post releases, developmental releases and any 3.1.x maintenance releases.
...but I'm still a little fuzzy on how it's determined whether something is a "post" or "pre" release.
Nevertheless, the answer to my problem appears to be: use Aribitrary Equality:
pip install mypackage===0.0.2
This gives me exactly the version specified, ignoring versions with any pre/post/dev details.
Upvotes: 2