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\'
The approach of the answer by abc adding the module path to the system path is fine for local, instant testing, but it's not the full solution, for example when C code needs to be compiled or command line hooks must be set. For a full test you might want to install the package instead.
A typical Python has a setup.py
and can be packaged into a distribution file (wheel, ...) which can then be installed locally from a local file.
The workflow would be:
python setup.py bdist_wheel
)pip install --no-index --find-links=..
)This results in exactly the same situation every future user of the package will find itself in and is a complete test (including the installing process), but it's also a lot of effort, that's why I usually only us the system path method during development, but the full installation way only directly before a release.