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.



cat ~/.local/lib/python3.9/site-packages/easy-install.pth

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. To fix that, created reorder_editable, which naively reorders my easy-install.pth.