Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add dependency link to repo subdirectory in setup.py

I have following two repositories: one classic with setup.py, and second which looks like:

/repo /folder1 /folder2 /utils /setup.py

and in setup.py in first repo I want install utils from second repo. I tried following code:

install_requires=["repo"],
dependency_links=['git+ssh://[email protected]:0000/project/repo@master#egg=repo&subdirectory=folder2']

but after python setup.py develop I have following error:

unknown url type: git+ssh -- Some packages may not be found!

like image 444
kiui Avatar asked May 09 '18 09:05

kiui


2 Answers

I had the same issue.

janfreyberg answer does not work anymore because of a change in pip: since 19.0, dependency_links are now obsolete.

Since pip 18.1, we can put these dependencies in install_requires using a syntax introduced by PEP 508.

Here is the solution in your case:

install_requires=[
    'repo @ git+ssh://[email protected]:0000/project/repo@master#subdirectory=folder2'
]

setup(install_requires=install_requires)

Note that this requires using pip install . and doesn't work with python setup.py install.

If folder2 itself has dependencies, everything will be retrieved recursively.

like image 175
Didier Avatar answered Oct 13 '22 01:10

Didier


I found this works for me:

depndendcy_links=["git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI#egg=pycocotools-2.0"]

So, specify the subdirectory and version as #subdirectory=<sub_dir>#<packagename>-<version>

like image 31
janfreyberg Avatar answered Oct 13 '22 01:10

janfreyberg