Categories
Python Answers

How to state in requirements.txt a direct GitHub source with Python?

Spread the love

Sometimes, we want to state in requirements.txt a direct GitHub source with Python.

In this article, we’ll look at how to state in requirements.txt a direct GitHub source with Python.

How to state in requirements.txt a direct GitHub source with Python?

To state in requirements.txt a direct GitHub source with Python, we can add the GitHub repo path into requirements.txt.

For instance, we can specify the commit hash by writing

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

in requiements.txt.

We specify the GitHub path in the 2nd line.

Also, we can specify the branch with

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

We can specify the release with

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

And we can specify the release with

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

Conclusion

To state in requirements.txt a direct GitHub source with Python, we can add the GitHub repo path into requirements.txt.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *