Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make setup tools install a github forked PyPI package?

Here is the example scenario.

There is a python package not-mine and I have just found a small bug in it. I find the source code on github and fork the repository. I make the necessary changes and submit a pull request. Unfortunately the package author is on vacation and I have a deadline.

I need a way to install my forked repository rather than the authors version living on PyPI. I have tried the following with no success:

install_requires = [
    'not-mine==1.0.0'
],
dependency_links = [
    'http://github.com/my-username/not-mine/tarball/master#egg=not-mine-1.0.0'
]

What am I missing?

Resources I have stumbled on while investigating the issue: How can I make setuptools install a package that's not on PyPI?

like image 774
Jarid R. Margolin Avatar asked Aug 16 '13 02:08

Jarid R. Margolin


People also ask

What command is used to install Python modules from PyPI?

Installing Python pip on your system allows you to manage PyPI packages easily. Many of these packages can be installed just by typing python -m pip install <package-name> into a terminal or command-line. Newer versions of Python 3 (3.4 and higher) and Python 2 (2.7. 9 and higher) come preloaded with pip.

Can pip install from github?

You can deploy Git locally, or use it via a hosted service, such as Github, Gitlab or Bitbucket. One of the advantages of using pip together with Git is to install the latest commits of unreleased Python packages as branches from Github.


2 Answers

You should be able to point pip at the URL of your forked repo with your bugfix because pip can install directly from git repos.

$ pip install git+git://github.com/my-username/not-mine#egg=not-mine

You can modify the pip install command to specify a particular commit, branch, tag, etc. with the "@" symbol before the "#".

$ pip install git+git://github.com/my-username/not-mine@bugfix_branch#egg=not-mine
like image 58
joshua.r.smith Avatar answered Sep 19 '22 05:09

joshua.r.smith


If you just want to install your forked forked package on your system you can simply clone the package to your system and use python setup.py install command to install that package locally on your system.

If you need to deploy application with your own modified package then, i recommend you to use the python virtual environment

like image 40
Gautam Krishna R Avatar answered Sep 23 '22 05:09

Gautam Krishna R