I'm building a small Python package with a friend.
.
├── __init__.py
└── memoized.py
During the development process, I want to test the installed package - for example, to make sure that some __init__.py
code runs as expected.
The current way to achieve this is:
/tmp
cd
to the repo dirpython setup.py install
cd
elsewhere (to avoid importing from the directory instead of importing from the installed package)pip uninstall memoized
This is long and cumbersome, and I vaguely remember there's a way to install a package in a way that does not copy its code to the virtualenv, but links to it instead. This way changing the code would be reflected at the next import, without re-installing.
I've searched for "Dynamic importing" and alike but it refers to a different feature.
How can I install a local Python package so that changes to the package code would be immediately reflected?
You could activate the virtualenv first and navigate to the project directory. Then run
pip install --editable .
--editable
install a project in editable mode and uses current working directory instead of copying the source code.