close

How to write setup.py to include a Git repository as a dependency

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to write setup.py to include a Git repository as a dependency in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to write setup.py to include a Git repository as a dependency?

  1. How to write setup.py to include a Git repository as a dependency?

    I found success getting my private repo dependency to install via setup.py using this specification pattern in install_requires (no more dependency_links):

  2. write setup.py to include a Git repository as a dependency

    I found success getting my private repo dependency to install via setup.py using this specification pattern in install_requires (no more dependency_links):

Method 1

I found success getting my private repo dependency to install via setup.py using this specification pattern in install_requires (no more dependency_links):

install_requires = [
  'some-pkg @ git+ssh://[email protected]/someorgname/[email protected]#egg=some-pkg',
]

The @v1.1 indicates the release tag created on github and could be replaced with a branch, commit, or different type of tag.

Method 2

You can find the right way to do it here.

dependency_links=['http://github.com/user/repo/tarball/master#egg=package-1.0']

The key is not to give a link to a Git repository, but a link to a tarball. GitHub creates a tarball of the master branch for you if you append /tarball/master as shown above.

Conclusion

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read