How to include git dependencies in setup.py for pip installation
<p>I need to include Python packages available via public Github repositories along with my Python (2.7) package. My package should be installable via <code>pip</code> using <code>setup.py</code>.</p>

<p>So far, this could be done using <code>dependency_links</code> in the <code>setup.py</code> file:</p>

<pre class="lang-py prettyprint-override"><code>setuptools.setup(
   name="my_package",
   version="1.0",
   install_requires=[
       "other_package==1.2"
   ],
   dependency_links=[
      "https://github.com/user/other_package/tarball/master#egg=other_package-1.2"
   ]    
)
</code></pre>

<p>This still works when the package gets installed with the <code>--process-dependency-links</code> flag, but the <code>dependency_links</code> functionality seems to be deprecated, since:</p>

<pre class="lang-none prettyprint-override"><code>pip install git+https://github.com/user/my_package@master#egg=my_package-1.0 --process-dependency-links
</code></pre>

<p>gives me the following warning:</p>

<pre class="lang-none prettyprint-override"><code>DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release.
</code></pre>

<p>Is there an alternative way to include <code>git</code> dependencies in the <code>setup.py</code> file with support for pip installation?</p>

<p>Edit (10/17/2016) to clarify my use case:</p>

<p>Let's say I find a bug in <code>other_package</code>. I fork the respective repo on Github, fix the bug and make a pull request. My pull request doesn't get immediately accepted (or never will be because the package is no longer actively maintained). I would like to distribute <code>my_package</code> together with my fork of <code>other_package</code> and want users to be able to pip install <code>my_package</code> without any further knowledge about the details of this requirement and without having to provide any additional flags upon installation. Users of <code>my_package</code> should further be able to include <code>my_package</code> as a requirement in their own custom packages.</p>

<p>How can this be achieved bearing compatibly with different modes of installation (wheels, eggs, develop, ...) in mind?</p>

<p>I always create a <code>requirements.txt</code> which contains all of my dependencies which can then be installed using <code>pip install -r requirements.txt</code>.
A usual <code>requirements.txt</code> looks like this (this is just an example):</p>

<pre><code>pytz==2016.4
six==1.10.0
SQLAlchemy==1.0.13
watchdog==0.8.3
Werkzeug==0.11.10
</code></pre>

<p>If you want to add a Git dependency (e.g. from Github), add a line like this to your <code>requirements.txt</code>:</p>

<pre><code>git+https://github.com/user/project.git@branch#egg=eggname
</code></pre>

<p>Replace the url with your required project, <code>branch</code> with the desired Git branch (or tag, which should also work) and <code>eggname</code> with the name of the directory where the dependency should be installed to at <code>.../python3.x/site-packages/eggname</code>.</p>

<p>My <code>setup.py</code> looks like this:</p>

<pre><code>#!/usr/bin/env python

from pip.req import parse_requirements
from setuptools import setup

requirements = parse_requirements('./requirements.txt', session=False)

setup(
    name='myproject',
    # ...
    # Stuff like version, author, packages, include_package_data,
    # entry_points, test_suite, ...
    # ...
    install_requires=[str(requirement.req) for requirement in requirements],
)
</code></pre>

<p>I am using Python >= 3.4, btw.</p>

python git pip setup.py