pip3 setup.py install_requires PEP 508 git URL for private repo pip3 setup.py install_requires PEP 508 git URL for private repo git git

pip3 setup.py install_requires PEP 508 git URL for private repo


After checking pip source code I found the correct syntax for private BitBucket repositories.

The general form for the packages with URLs is <package name>@<URI> and the URI must start with a <scheme>://.

So I fixed it to:

anotherpackage@git+ssh://git@bitbucket.org:myorg/anotherpackage.git

and then I was getting a different error - this time git command (invoked by pip) was complaining about repository URL ssh://git@bitbucket.org:myorg/anotherpackage.git.

I checked the git documentation for the ssh:// URLs format and found out that hostname and organisation parts must be separated with / instead of ::

ssh://git@bitbucket.org/myorg/anotherpackage.git

This URL works fine. I also learned from the pip source code that the actual revision/branch/tag can be specified by appending @<rev-spec> so I can specify for example the tag 0.0.1 with the following in install_requires:

anotherpackage@git+ssh://git@bitbucket.org:myorg/anotherpackage.git@0.0.1

The only issue that I still have is that when I change the revision and run pip3 install -e . again it doesn't detect the change (even when run with --upgrade). I have to manually uninstall the package (pip3 uninstall anotherpackage) and run pip3 install -e . again.