Installing dependency from a VCS repo subdirectory using setuptools

前端 未结 1 856
盖世英雄少女心
盖世英雄少女心 2020-12-22 07:47

I\'m trying use setuptools to install a dependency from a VCS and inside a subdirectory.

My setup.py looks like this:



        
相关标签:
1条回答
  • 2020-12-22 08:25

    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
    ]
    
    0 讨论(0)
提交回复
热议问题