How to State in Requirements.Txt a Direct Github Source

How to state in requirements.txt a direct github source

Normally your requirements.txt file would look something like this:

package-one==1.9.4
package-two==3.7.1
package-three==1.0.1
...

To specify a Github repo, you do not need the package-name== convention.

The examples below update package-two using a GitHub repo. The text between @ and # denotes the specifics of the package.

Specify commit hash (41b95ec in the context of updated requirements.txt):

package-one==1.9.4
git+https://github.com/path/to/package-two@41b95ec#egg=package-two
package-three==1.0.1

Specify branch name (master):

git+https://github.com/path/to/package-two@master#egg=package-two

Specify tag (0.1):

git+https://github.com/path/to/package-two@0.1#egg=package-two

Specify release (3.7.1):

git+https://github.com/path/to/package-two@releases/tag/v3.7.1#egg=package-two

Note that #egg=package-two is not a comment here, it is to explicitly state the package name

This blog post has some more discussion on the topic.

pip install via requirements.txt specify a direct GitHub private repo + branch name erroring with exit status 128

I figured out my problem in both cases... syntax


Attempt #1

Mistake: needed to say git@github.com

Correct method:

-e git+ssh://git@github.com/Organization/repo-name.git@branch/name#egg=foo

Attempt #2

Mistake: didn't know one can use @ twice

Correct method:

-e git+git@github.com:Organization/repo-name.git@branch/name#egg=foo

Downloading requirements.txt from GitHub

pip install -r https://raw.githubusercontent.com/GabrielCoutz/Problema-Chiado/main/requirements.txt

-e is for local installs for developing, for example. Check this:
What is the use case for `pip install -e`?



Related Topics



Leave a reply



Submit