Search code examples
pipdependenciespipenvpython-packagingpipfile

pipenv/pip install from git commit/revision id


I would like to install a package from a git repository specifying a commit id using pipenv (I belive it should be very similar If I would use pip)

so far I tried:

pipenv install "git+ssh://[email protected]/<username>/<repository>.git/<commit_id>#egg=mypackage"

which is apending the following line to the Pipfile & provides no errors

<package-name> = {git = "ssh://[email protected]/<username>/<repository>.git/<commit_id>"}

If I import the package import mypackage it detects it but its dependencies are missing.

The setup.py of mypackage looks like;

import setuptools

with open("README.md", "r") as readme:
    long_description = readme.read()
with open("./requirements.txt", "r") as fh:
requirements = fh.readlines()

setuptools.setup(
    name='mypackage',
    url='https://bitbucket.org/<username>/<repositroy>',
    packages=setuptools.find_packages(),
    install_requires=[req for req in requirements if req[0] not in ["#", "-"]],

)


Solution

  • Just figured it out by reading this that the revision id should be specified after a @

    pipenv install "git+ssh://[email protected]/<username>/<repository>.git@<commit_id>#egg=<package_name>"