What is the use case for `pip install -e`

jpmelos picture jpmelos · Mar 5, 2017 · Viewed 28.9k times · Source

When I need to work on one of my pet projects, I simply clone the repository as usual (git clone <url>), edit what I need, run the tests, update the setup.py version, commit, push, build the packages and upload them to PyPI.

What is the advantage of using pip install -e? Should I be using it? How would it improve my workflow?

If this helps, here are my two pet projects that I currently package and send to PyPI, but never used pip install -e. One is pure Python, the other is a Django package.

How would the project's workflow or structure be improved by using pip install -e?

Answer

jpmelos picture jpmelos · May 8, 2017

Using pip install -e . can actually be useful if you want to run your packages with python package.py and you import other modules of your project from that file. The command makes them findable!

What it does is:

  • installs site-packages/PackageName.egg-link file
  • adds path to site-packages/easy-install.pth
  • optionally installs CLI targets in <venv>/bin

It seems either of the earlier two is sufficient, and the latter is handy when developing command-line utilities.