brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: pip can install straight from a Git tag or commit

Pip
~/tips/tip-pip-install-from-git-tag

python3 -m pip install "git+https://example.com/team/[email protected]"

Install a fix that isn't released yet, pinned to an exact point.

The fix you need is merged but not released. pip can install from the repository itself, as long as Git is on the machine.

python3 -m pip install "git+https://example.com/team/[email protected]"

The part after the @ can be a tag, a branch or a commit hash. For anything you want to repeat later, I use the full commit hash, because a branch moves and a tag can be moved. The same form works in a requirements file:

tool @ git+https://example.com/team/[email protected]

If the Python package sits in a subfolder of the repository, say which one:

python3 -m pip install "git+https://example.com/team/mono.git#subdirectory=packages/tool"

Quote the URL, or your shell may trip over the special characters. Private repositories work through git+ssh:// with your usual SSH key, which keeps tokens out of the requirements file.

This builds the package on your machine, so you may need build tools that a normal wheel install would not. It also runs whatever that repository contains, so only point it at code you trust. When the real release arrives, switch back to a version number so updates are visible again.

Further reading: pip VCS support

More Pip tips urllib3<2 python3 -m pip download -r requirements.txt -d ./wheels python3 -m pip config set global.timeout 60 python3 -m pip index versions requests python3 -m pip download requests==X.Y.Z --no-deps -d ./pkgs All Pip tips (9) All topics

Link