Python Plugins/Namespace Packages

My HPI repo is an example of using namespace packages as an plugin mechanism.

Both of them are installed as an editable package (like pip install -e ., which adds a egg file to ~/.local/lib/python3.9/site-packages/, and a line to ~/.local/lib/python3.9/site-packages/easy-install.pth.

Upsides:

Downsides:

cat ~/.local/lib/python3.9/site-packages/easy-install.pth
/home/sean/Repos/HPI
/home/sean/Repos/HPI-to-master

means that HPI overrides any namespace packages in HPI-to-master.

The fact that it overrides is great! Since it means I can overwrite files in the upstream repo without having to maintain a fork and having to deal with merging changes back and forth. But, sometimes when re-installing (or for some reason I can’t seem to find) easy-install.pth gets messed with, and I have to manually fix it. Perhaps a tool should be written to handle this…