How to install a Git Repo using Pip
Pip is a package management system used to install and manage software packages written in Python . Its easy to use and provides an excellent way to deploy your code with minimal fuse.
Within this article we will show you how to install a git repo  directly via pip.
First of all add a setup.py file to your repo. This file will be read by pip at the point of installation.
Note : If you code is located within folders use the packages keyword instead of py_modules.
from setuptools import setup setup( name="<program_name>", version="<version>", author_email="<email>", description="<description>, py_modules = ['<filename>'] )
Additional documentation around building a setup.py file can be found here.
Once done you can then install.
To install via SSH the following syntax is used,
To install via HTTPS the following syntax is used,
sudo pip install git+https://github.com/<username>/<repo_name>.git
# pip install git+https://github.com/felix001/threader.git Downloading/unpacking git+https://github.com/felix001/threader.git Cloning https://github.com/felix001/threader.git to /tmp/pip-jrlnNB-build Running setup.py egg_info for package from git+https://github.com/felix001/threader.git Installing collected packages: threader Running setup.py install for threader Successfully installed threader Cleaning up...
# pip show threader --- Name: threader Version: 1.0 Location: /opt/lib/python2.7/site-packages Requires:
You may be now asking yourself "How is the module that I have installed from Git included within my requirements file?".
To ensure the correct entry is included within your requirements file add the egg switch to your pip command. Like so,
pip install -e git+https://github.com/felix001/commontools.git#egg=commontools
If you now run a git freeze you will see the correct entry,
# pip freeze