Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use pip to install the latest tag?

Tags:

python

pip

One can use pip to install a specific tag:

pip install -e git+ssh://[email protected]/{usr}/{repo}.git@{tag}#egg={egg}

However, I can't seem to find a way to make it point to the latest release (which would be releases/latest), and not just to the HEAD of master. Is it at all possible?

One constraint, it has to use ssh.

like image 277
vermillon Avatar asked Jan 31 '26 09:01

vermillon


1 Answers

If you are using python packages here is one way to do this:


setup.py

import setuptools
import urllib.request


deps = [
    {
        'name': 'gunicorn',
        'url': 'github.com/benoitc/gunicorn',
    },
]

for i in range(len(deps)):
    tag_url = urllib.request.urlopen(f"https://{deps[i]['url']}/releases/latest").geturl()
    latest_tag = tag_url.split('/')[-1]
    deps[i] = f"{deps[i]['name']} @ git+ssh://{deps[i]['url']}@{latest_tag}"

setuptools.setup(
    install_requires=deps,
)


And then install the package locally

python -m pip install .
like image 128
kruserr Avatar answered Feb 02 '26 00:02

kruserr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!