简体   繁体   中英

How to install Python package from specific GitHub HTTPS commit ID

I have a Python package configured like this:

# setup.py
from setuptools import setup

setup(
    name='python-package-test',
    version='0.0.1',
    packages=['python-package-test'],

    dependency_links=[
        # This repo actually exists
        'git+https://github.com/nhooey/tendo.git@increase-version-0.2.9#egg=tendo',
    ],
    install_requires=[
        'tendo',
    ],
)

When I install this package from setup.py :

$ virtualenv --python=python3 .venv && \
    source .venv/bin/activate && \
    python setup.py install

$ pip freeze | grep tendo
tendo==0.2.9  # Note that this is the *correct* version

It installs the correct version of tendo .

However, when I upload this package in a Git repository and install it with pip :

# The GitHub link doesn't exist as it's private
# and it's different from the repo mentioned above
virtualenv --python=python3 .venv && \
    source .venv/bin/activate && \
    pip install git+ssh://git@github.com/nhooey/package.git

$ pip freeze | grep tendo
tendo==0.2.8  # Note that this is the *wrong* version

It installs the wrong version of tendo .

Why is the setup.py installation behaving differently from pip + git ?

You must use the --process-dependency-links option when installing with Pip, since Pip no longer processes this automatically.

pip install --process-dependency-links 'git+ssh://git@github.com/nhooey/package.git'

You'd think Pip would print a warning, or the updated version of setuptools would also ignore dependency_links as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM