pip
package archives
In addition to Alex's excellent answer, you can also use pip
's "archive" format on a zipped copy of the repository. Several code hosts automatically provide zip files at predictable URLs.
Why would I do this?
The VCS installation works perfectly fine. This alternative is convenient if the machine you're installing on does not have Git, like a "slim" container image. Previous reports suggested that this method was faster than Git, but they seem comparable now.
Examples
Replace the tokens with the values you want in the code samples below.
Field |
Description |
<package> |
The name of the package. (Match the package's name from its setup.py !) |
<user> |
The repository owner |
<repo> |
The repository name |
<refname> |
Branch, tag, or commit SHA. Bitbucket can also use default for the default branch. |
Pipfile
[packages]
<package> = {file = "https://github.com/<user>/<repo>/archive/<refname>.zip"}
<package> = {file = "https://bitbucket.org/<user>/<repo>/get/<refname>.zip"}
<package> = {file = "https://codeberg.org/<user>/<repo>/archive/<refname>.zip"}
<package> = {file = "https://gitlab.com/<user>/<repo>/-/archive/<refname>/<repo>-<refname>.zip"}
CLI installation
pipenv install https://github.com/<user>/<repo>/archive/<refname>.zip
pipenv install https://bitbucket.org/<user>/<repo>/get/<refname>.zip
pipenv install https://codeberg.org/<user>/<repo>/archive/<refname>.zip
pipenv install https://gitlab.com/<user>/<repo>/-/archive/<refname>/<repo>-<refname>.zip
Warning
There are reports from 2017 and 2018 that unlike pip
, pipenv
will not recursively install dependencies from zips. Dependencies are working fine for me, though. This commit from September 2018 is my best guess for when things changed, but if you know otherwise, please comment or edit.