3

I am using a private github repository in order to install packages:

pip install --upgrade git+ssh://git@github.com/myuser/mypackage.git#egg=mypackage

In the requirements.txt it looks as the following:

git+ssh://git@github.com/myuser/mypackage.git#egg=mypackage

Afterwards, I added git tags for the versioning such as:

git+ssh://git@github.com/myuser/mypackage.git@0.1.9#egg=mypackage

How can I define a version range such as from 0.1.9 to 1.0.0 like this example:

git+ssh://git@github.com/myuser/mypackage.git@0.1.9<1.0.0#egg=mypackage

Or is it possible to use git master branch and define the version range with pip as described here: How to pip install a package with min and max version range?

Rene B.
  • 6,557
  • 7
  • 46
  • 72
  • Git tags are not version specifiers made in package metadata and can be anything, so there's no comparison mechanism provided for them. – hoefling Jan 26 '18 at 16:04
  • @hoefling do you know if it is possible to use git master branch and define the version range with pip as described here: https://stackoverflow.com/questions/8795617/how-to-pip-install-a-package-with-min-and-max-version-range – Rene B. Jan 28 '18 at 11:32
  • 1
    If you install from git branch, this means you install from the exact commit this branch is currently pointing to. There is no room for any version range. – hoefling Jan 28 '18 at 15:22

1 Answers1

2

As there is no room for any version range with pip+git, I will use a workaround and write a python script that will do it. This is not the most elegant way but it will work and maybe somebody finds a better approach.

Here is my workround for those facing the same issue:

  1. Writing a pthon script that runs through my requirements.txt

  2. Extract own git-repos with the <git-repo> and <version range>

  3. The python script will call a subprocess to get a list of tags of the repo:

    git ls-remote -t <git-repo>

  4. Extract the tags in the python script that are in the defined range as a list and take the maximum

  5. Install the extracted Version which is the highest in a given range

Community
  • 1
  • 1
Rene B.
  • 6,557
  • 7
  • 46
  • 72