How to state in requirements.txt a direct github source How to state in requirements.txt a direct github source python python

How to state in requirements.txt a direct github source

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


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):


Specify branch name (master):


Specify tag (0.1):


Specify release (3.7.1):


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.

“Editable” packages syntax can be used in requirements.txt to import packages from a variety of VCS (git, hg, bzr, svn):

-e git://

Also, it is possible to point to particular commit:

-e git://

requirements.txt allows the following ways of specifying a dependency on a package in a git repository as of pip 7.0:1

[-e] git+git://[-e] git+[-e] git+ssh:// (deprecated as of Jan 2020)

For Github that means you can do (notice the omitted -e):


Why the extra answer?
I got somewhat confused by the -e flag in the other answers so here's my clarification:

The -e or --editable flag means that the package is installed in <venv path>/src/SomeProject and thus not in the deeply buried <venv path>/lib/pythonX.X/site-packages/SomeProject it would otherwise be placed in.2