How to point pip at a Mercurial branch?
Question:
I’m trying to install my application via pip to a virtualenv for testing.
Works fine for installing the default
or tip
like so:
pip install -e hg+https://[email protected]/username/app_name#egg=app_name
But is there any way to point to a branch, rather than just getting the tip. Not sure if this would be a mercurial thing, bitbucket, or pip.
Bitbucket allows for downloading of a tagged version of the code, but I can only get it to work while logged into the browser. I tried installing from a tag
tar.gz like so:
pip install https://[email protected]/username/app_name/get/bbc4286a75db.tar.gz
but even after entering my password it returns a 401 Unauthorized (Its a Private Repo)
Answers:
In official pip documentation in section VCS Support:
Mercurial
The supported schemes are: hg+http, hg+https, hg+static-http and
hg+ssh:
-e hg+http://hg.myproject.org/MyProject/#egg=MyProject
-e hg+https://hg.myproject.org/MyProject/#egg=MyProject
-e hg+ssh://[email protected]/MyProject/#egg=MyProject
You can also specify a revision number, a revision hash, a tag name or
a local branch name:
-e hg+http://hg.myproject.org/MyProject/@da39a3ee5e6b#egg=MyProject
-e hg+http://hg.myproject.org/MyProject/@2019#egg=MyProject
-e hg+http://hg.myproject.org/MyProject/@v1.0#egg=MyProject
-e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject
The syntax is the same when specifying repo at the command line
pip install -e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject
and it works when not using -e
option starting from version 0.8.2.
I’m trying to install my application via pip to a virtualenv for testing.
Works fine for installing the default
or tip
like so:
pip install -e hg+https://[email protected]/username/app_name#egg=app_name
But is there any way to point to a branch, rather than just getting the tip. Not sure if this would be a mercurial thing, bitbucket, or pip.
Bitbucket allows for downloading of a tagged version of the code, but I can only get it to work while logged into the browser. I tried installing from a tag
tar.gz like so:
pip install https://[email protected]/username/app_name/get/bbc4286a75db.tar.gz
but even after entering my password it returns a 401 Unauthorized (Its a Private Repo)
In official pip documentation in section VCS Support:
Mercurial
The supported schemes are: hg+http, hg+https, hg+static-http and
hg+ssh:-e hg+http://hg.myproject.org/MyProject/#egg=MyProject -e hg+https://hg.myproject.org/MyProject/#egg=MyProject -e hg+ssh://[email protected]/MyProject/#egg=MyProject
You can also specify a revision number, a revision hash, a tag name or
a local branch name:-e hg+http://hg.myproject.org/MyProject/@da39a3ee5e6b#egg=MyProject -e hg+http://hg.myproject.org/MyProject/@2019#egg=MyProject -e hg+http://hg.myproject.org/MyProject/@v1.0#egg=MyProject -e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject
The syntax is the same when specifying repo at the command line
pip install -e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject
and it works when not using -e
option starting from version 0.8.2.