0

Let's say I have a standard python directory structure of python package like here and consider I need to add a function to the package. More specifically, I want to do it with trial-and-error, by running a test code. What is the correct work-flow for this?

I currently do the following:

  1. do sudo python setup.py install anytime I made a change in the package
  2. source ~/.bashrc
  3. open a python interpreter,
  4. run the test code.

But apparently this flow takes a lot of time to just check the modification via test code. And I feel that I'm doing something wrong, and the better ways exist.

orematasaburo
  • 1,207
  • 10
  • 20

1 Answers1

2

I would comment, but alas I do not have enough reputation.

Use pip install -e path/to/package. This will install it "editably" and locally, so any change to the package code is effective immediately on your system. This way you can change and test code on the fly.

Further answers: https://stackoverflow.com/a/23075617/12164878

tybug
  • 68
  • 1
  • 6