Search code examples
pythonpipsetuptools

How to write setup.py to include a specific git repo as a dependency


My package has a dependency to a another git repo. My current setup.py file is the following:

#!/usr/bin/env python
# coding: utf-8

from setuptools import setup, find_packages

setup(
  name='myapp', 
  url='[email protected]/dummy/myapp.git',
  packages=find_packages(), 
  install_requires = [
     'base @ git+ssh://[email protected]/dummy/base.git'
  ]
)

When I run the command "pip3 install . --user" to execute the setup.py file a base module is installed at userbase/lib/python3.6/site-packages, but this modul is not my base module. The first line in the console after running the pip3 install command is

Collecting base@ git+ssh://[email protected]/dummy/base.git (from myapp==0.0.0)
Downloading https://files.pythonhosted.org/packages/1b/e5/464fcdb2cdbafc65f0b2da261dda861fa51d80e1a4985a2bb00ced080549/base-1.0.4.tar.gz"
Installing collected packages: base, myapp

It seems to me that pip3 is installing another base module, because the download path is not my git path. After that, the base folder in site-packages includes among other files a "taobao.py" and "seo.py" file.

Is there an option that pip3 is installing my base and not another base module?

I'm using pip 19.03.


Solution

  • The syntax 'base @ git+ssh://[email protected]/dummy/base.git' is supported by pip 19.1+:

    Since version 19.1, pip also supports direct references like so:

    SomeProject @ file:///somewhere/...