Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get pip to work with git and github repository

I'm writting a python app that depends on another one that is hosted on a github repository (never in pypi) for development reasons.

Lets call them:

  • App being written: AppA
  • App in github: AppB

In App A, the setup.py is like:

# coding=utf-8
import sys
try:
    from setuptools import setup, find_packages
except ImportError:
    import distribute_setup
    distribute_setup.use_setuptools()
    from setuptools import setup, find_packages

setup(
    ...
    install_requires=[
        # other requirements that install correctly
        'app_b==0.1.1'
    ],
    dependency_links=[
        'git+https://github.com/user/[email protected]#egg=app_b-0.1.1'
    ]
)

Now AppA is being built by Jenkins CI with every push and I get a failure because of the next error is thrown:

error: Download error for git+https://github.com/user/[email protected]: unknown url type: git+https

Funny thing is that this only happens in Jenkins, it works perfectly on my computer. I tried both of the other SSH urls that github gives and those are not even considered for download.

Now, AppA is included in the requirements file of a project also being built by Jenkins, so installing the dependencies manually via pip install AppA pip install AppB is not an option, the dependencies are automatically installed by being included in the requirements.txt.

Is there any way to make pip and git with github urls work together?

Any help will be very appreciated :)

Thanks in advance!

like image 524
Gerard Avatar asked Feb 06 '13 19:02

Gerard


2 Answers

The problem is not with pip, is with setuptools. The responsible for the setup() call is setuptools package (setuptools or distribute project).

Neither setuptools or distribute understand that kind of url, they understand tarballs/zip files.

Try pointing to Github's download url - usually a zip file.

Your dependency_links entry is probably going to look like:

dependency_links=[
    'https://github.com/user/app_b/archive/0.1.1.zip#egg=app_b-0.1.1'
]

For more information take a look at http://peak.telecommunity.com/DevCenter/setuptools#dependencies-that-aren-t-in-pypi

like image 179
Hugo Tavares Avatar answered Oct 30 '22 19:10

Hugo Tavares


From pip documentation -

pip currently supports cloning over git, git+http and git+ssh:

git+git://git.myproject.org/MyProject#egg=MyProject
git+http://git.myproject.org/MyProject#egg=MyProject
git+ssh://git.myproject.org/MyProject#egg=MyProject

Try replacing git+https with git+git.

like image 22
Bibhas Debnath Avatar answered Oct 30 '22 17:10

Bibhas Debnath