Pip and Github or Bitbucket

To use pip to install an app from Bitbucket, do this:

pip install git+ssh://git@bitbucket.org/my_username/my_repo.git@tagnumber

Or to install the latest:

pip install git+ssh://git@bitbucket.org/my_username/my_repo.git

To put it in your requirements file:

git+ssh://git@bitbucket.org/my_username/my_repo.git@tagnumber

Gotcha: Tag Numbers vs Version Numbers

Don’t forget that to be able to install a module this way, it needs to be a python package complete with a setup.py file. The setup.py file determines the version number for pip, NOT the repo tag number.

Lets say you have repo tag 0.1 with version number 0.1. Then you make some modifications, commit them, and tag them 0.2. Since you did not change the version number, when you do a pip update to tag number 0.2, pip will not update your code because the version number is still 0.1.

It probably is wise to make your version numbers match your repo tag number.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s