Installing pip package in editable mode - aceisace/Raspberry-Pi-Setup GitHub Wiki

Installing pip package in editable mode

Usually when you run pip3, the package cannot be easily edited. Any changes made to the source files won't be reflected. Below are some useful instructions:

Installing

Download the package, usually git clone is enough, navigate to the downloaded folder (should contain a setup.py file), then run:

pip3 install -e ./

This will install the package in editable mode. Any changes made here are reflected when runnning it the next time.

Uninstalling

Since the package doesn't exist where it usually is supposed to exist, it's important to not delete the folder of the package. Navigate to the folder of the package first (should contain a setup.py file) and then run:

pip3 uninstall package_name

where package_name is the name of the package.

Uploading to Pypi

If you are the author of the package, you can upload releases to Pypi. Then other users will be able to find, install and uninstall the package easily by using pip. It's important to stick to Semantic versioning and give proper release names like v1.0.3. Each release must have a different version number.

To upload, run the following at the project's home folder (this assumes that you already have created the setup.py file, if not, please look for that first):

python3 setup.py sdist
cd dist
twine upload *