We'd like to use pip with github to install private packages to our production servers. This question concerns what needs to be in the github repo in order for the install to be successful.
Assuming the following command line (which authenticates just fine and tries to install):
pip install git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName
What needs to reside in the ProductName? Is it the contents of what would normally be in the tar file after running setup.py with the sdist option, or is the actual tar.gz file, or something else?
I'm asking here because I've tried several variations and can't make it work. Any help appreciated.
You need the whole python package, with a
setup.py
file in it.A package named
foo
would be:And install from github like:
More info at https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
I had similar issue when I had to install from github repo, but did not want to install git , etc.
The simple way to do it is using zip archive of the package. Add
/zipball/master
to the repo URL:This way you will make pip work with github source repositories.
If you want to use
requirements.txt
file, you will needgit
and something like the entry below to anonymously fetch the master branch in yourrequirements.txt
.For regular install:
For "editable" install:
Editable mode downloads the project's source code into
./src
in the current directory. It allowspip freeze
to output the correct github location of the package.Clone target repository same way like you cloning any other project:
Then install it in develop mode:
You can change anything you wan't and every code using
foo
package will use modified code.There 2 benefits ot this solution:
.git
dir, so it's regular Git repository. You can push to your fork right away.