"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Integrate GitHub Repositories into `requirements.txt`?

How to Integrate GitHub Repositories into `requirements.txt`?

Published on 2024-11-15
Browse:749

How to Integrate GitHub Repositories into `requirements.txt`?

Specifying GitHub Source in requirements.txt

To integrate a library installed from a GitHub repository into your dependencies, modify your requirements.txt file as follows:

For GitHub repositories, omit the "package==version" naming convention. Instead, use the following format:

package-name @ git git://github.com/owner/repo@reference

where "reference" can be:

  • Commit hash: package-name @ git https://github.com/owner/repo@41b95ec
  • Branch name: package-name @ git https://github.com/owner/repo@main
  • Tag: package-name @ git https://github.com/owner/[email protected]
  • Release: package-name @ git https://github.com/owner/repo@releases/tag/v3.7.1

Example:

To update the "package-two" dependency with a GitHub repository, use one of the following configurations in your requirements.txt:

package-two @ git https://github.com/owner/repo@41b95ec
package-two @ git https://github.com/owner/repo@main
package-two @ git https://github.com/owner/[email protected]
package-two @ git https://github.com/owner/repo@releases/tag/v3.7.1

Note: In some pip versions, update the package version in the package's setup.py to avoid assuming the requirement is already met.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3