Get pip to work with git and github repository

后端 未结 3 1375
一生所求
一生所求 2020-12-19 05:31

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:

  • A
相关标签:
3条回答
  • 2020-12-19 05:36

    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.

    0 讨论(0)
  • 2020-12-19 05:38

    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

    0 讨论(0)
  • 2020-12-19 06:00

    I had the same issue in 2019, but due to different reasons. dependency_links are not supported in pip anymore (tested with pip>=20.0.0). For my case I solved this issue using install_requirements and defining a direct reference (see pip manual direct reference).

    ...
    install_requirements = [
        <dependencyname> @ git+<url of dependency repository>@<branchname or tag>
    ]
    

    I made an puplic example repository named thepackage at https://gitlab.rhrk.uni-kl.de/scheliga/thepackage for more details.

    0 讨论(0)
提交回复
热议问题