0

I am wanting to fork a python (pip) dependency that I am using and make some edits to it, etc. And I don't want to risk a pip update/upgrade erasing my changes.

In the javascript world, and easy way to do what I want to do is with the yarn link command.

Is there a command similar to yarn link when using python/pip?

JayGee
  • 577
  • 6
  • 16
  • You can pip-install projects from a git repository, see [this answer](https://stackoverflow.com/a/20101940/1016216). – L3viathan Jun 25 '19 at 21:15
  • For those of us who use Python but not JS/Node/yarn the question is a bit meaningless. What is `yarn` and what is `yarn link`? Please add more details to the question. Probably an example would be even better. – phd Jun 25 '19 at 21:39
  • Yes, you're right. My apologies. yarn is a package manager, like pip, but for node/javascript. – JayGee Jun 25 '19 at 22:20

1 Answers1

2

So, I found out how to do this. Instead of doing a normal pip install, you can do the following:

  • Checkout a repo of the forked package
  • Then, run this command
pip install -e /path/to/the/package/on/local/file/system

This creates an editable install of the package in the folder of your choosing, so you can develop and make changes and see the effect of the changes immediately.

I'm sure seasoned python developers already know this. But I'm not in python everyday. I've been wanting to know how to do this for a long time. Finally figured it out. I hope this helps someone else!

JayGee
  • 577
  • 6
  • 16
  • More info on pip editable installs can be found [here](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs) – JayGee Jun 25 '19 at 22:35