Best practices for a library

Many of my plugins use a utility Python library called “glyphmonkey” which provides a bunch of useful monkey-patches to the objects provided by the Glyphs API. So far I’ve been shipping inside Contents/Resources on each plugin, but I am now getting problems with different versions of the library floating around. Basically the version loaded is the version shipped with the first plugin to be loaded. If that’s out of date, the other plugins don’t work. So I think what I need to do is install glyphmonkey as a Python library on the system instead.

So: What’s the best way to distribute Python modules to be used by Glyphs plugins? I was planning to make it a Python package on PyPI and ask people to install it using pip, but the system Python on OS X 10.11 doesn’t seem to have pip available. How does this affect things like vanilla? What’s the best way to get users to install 3rd-party Python libraries?

I usually install them manually, because the mostly fails for me.
But you don’t need to install it in the system. It should work if the library is in the script folder.

But wouldn’t that break the old plugins?

The library is backward compatible but not forward compatible: I keep adding useful features. So my Tunni Lines plugin needs some new methods but if another plugin is installed you get the old version loaded without those methods.

Is the Scripts directory early on in the Python load path? (Earlier than Contents/Resources of the plugin?)

If so that could work. And I could even make the plugin check the library version and automatically copy the library into Scripts if the one bundled with the plugin is newer.

You can check sys.paths for the load order.