Skip to content Skip to sidebar Skip to footer

Installing Dependency From A VCS Repo Subdirectory Using Setuptools

I'm trying use setuptools to install a dependency from a VCS and inside a subdirectory. My setup.py looks like this: #!/usr/bin/env python3 from setuptools import setup required

Solution 1:

dependency_links were declared obsolete and finally removed in pip 19.0. The replacement for it is install_requires with special syntax (supported since pip 19.1):

install_requires=[
    'package_name @ git+https://gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>'
]

See https://pip.readthedocs.io/en/stable/reference/pip_install/#requirement-specifiers and https://www.python.org/dev/peps/pep-0440/#direct-references

This requires pip install including pip install . and doesn't work with python setup.py install.

In your case:

install_requires=[
    "package @ git+ssh://git@host/repo.git@tag#subdirectory=subdir"
]

setup(install_requires=install_requires)

For example:

install_requires=[
    pycocotools @ git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI
]

Post a Comment for "Installing Dependency From A VCS Repo Subdirectory Using Setuptools"