I\'m trying to make changes to an existing python module, and then test it locally. What\'s the best way to do this?
I cloned the github module and made changes, but I\'
You should probably be doing most of your development work in a virtual environment. Your workflow for this could look like:
# activate the virtual environment in ~/vpy
. $HOME/vpy/bin/activate
# install my app and its dependencies
cd $HOME/src/myapp
pip install -e .
# use my forked library instead
cd $HOME/src/forkedlib
pip install -e .
pytest # or whatever tests the forked lib has
# try it out with my application too
cd $HOME/src/myapp
pytest # or whatever tests your app has
myapp
pip install -e does some magic so that, whenever you import the module in the library, it gets routed directly to the checked-out source tree, so if you make edits in forkedlib and then re-run myapp, you'll see those changes directly.
When you're done, you can pip uninstall forkedlib and then re-run pip install -e . to reinstall your application's (declared) dependencies. (Or delete and recreate the virtual environment, if that's easier.)