Depend on git repository in setup.py

后端 未结 1 1197
慢半拍i
慢半拍i 2020-12-30 06:05

I\'m trying to make a project depend on a git dependency. However, I can\'t seem to get it to work. What I basically want to achieve is the following, but it doesn\'t work:<

1条回答
  •  说谎
    说谎 (楼主)
    2020-12-30 06:31

    Pip >= 9.1 (commit 6ec559) will have support for the new @ syntax as described in PEP508, which takes the format: pkgname@url#sum - e.g.:

    pip install --no-index packaging@https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4
    

    This will also be useable in setup.py in the same way, e.g.:

    install_requires=['packaging@https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4']
    

    You can try this out just now with the latest commit to pip master (updating pip the 'wrong' way!):

    $ pip install https://github.com/pypa/pip/archive/master.zip
    $ pip install --no-index packaging@https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4
    Collecting packaging@ https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4 
    from https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl#sha256=ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4
    Downloading https://files.pythonhosted.org/packages/2f/2b/c681de3e1dbcd469537aefb15186b800209aa1f299d933d23b48d85c9d56/packaging-15.3-py2.py3-none-any.whl
    Installing collected packages: packaging
    Successfully installed packaging-15.3
    

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