Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point pip at a Mercurial branch?

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)

like image 284
MattoTodd Avatar asked Apr 21 '12 19:04

MattoTodd


People also ask

Where does pip install to?

To install modules locally, you need to create and activate what is called a virtual environment, so pip install installs to the folder where that virtual environment is located, instead of globally (which may require administrator privileges).

Is it possible to use pip to install a package from a private github repository?

Read the Docs uses pip to install your Python packages. If you have private dependencies, you can install them from a private Git repository or a private repository manager.

How install pip using setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.


1 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.

like image 183
Piotr Dobrogost Avatar answered Sep 29 '22 00:09

Piotr Dobrogost