How to install from a private git repo from a pip requirements file?

Viewed 171

I can install from a private git repo perfectly by running:

pip install git+ssh://git@example.com/myaccount/myrepo.git@tagname

My Python package has a main folder called "mypackage", and after running this command, my virtual environment has that folder in <venv>/lib/python3.9/site-packages.

How do I run this same equivalent command from a pip requirements file?

If I create a requirements.txt file containing:

git+ssh://git@example.com/myaccount/myrepo.git@tagname

and run:

pip install -r requirements.txt

it succeeds and installs the packages, but it installs it into <venv>/lib/python3.9/src/mypackage and it contains my entire repo code, not just the main source file that my setup.py says should be exported.

How do I fix this so the install functions identically to the regular pip install command?

I also tried this line:

-e git+ssh://git@example.com/myaccount/myrepo.git@tagname#mypackage

but that also installs to the "src" folder inside my virtualenv.

0 Answers
Related