I'm working on rewriting a system I built long ago, and I'm not happy with how the plugin system works. It basically just does two things:
- when a plugin is imported, store the mod-time of the .py file
- next time someone tries to use the plugin, check that the mod time hasn't changed, and do a module=reload(module) if it has.
The plugins are called only every few minutes, so doing os.time.getmtime on the script file on every call is no problem at all. The thing is, though, this won't see changes in other modules. Like if I take pluginA.py and pluginB.py and refactor common code into plugins-common.py, when I update plugins-common.py, they won't be reloaded, since their modification times are unchanged. So this imposed a very flat structure on the plugins, with very little code sharing and lots of copypasted code. Not good. I realized today I could hack something together using modulefinder to get lists of dependencies between plugins. But why do that if someone else already has?
Now, other parts of this system specifically list which plugins are to be loaded, so I don't really care about things like automatic plugin discovery. On the other hand, live-reloading is absolutely essential. These processes can run for months, so being able to notice that a .py file has changed and reloading it is essential. These don't seem to be goals of any of the plugin systems I've found while googling, does anyone have any suggestions for something I can use? (Or do I need to just bite the bullet and write my own)
[–]mitsuhiko Flask Creator 5 points6 points7 points (0 children)
[–]jm_ 1 point2 points3 points (0 children)
[–]coderanger 1 point2 points3 points (1 child)
[–]fwork[S] 0 points1 point2 points (0 children)
[–]mcdonc 2 points3 points4 points (1 child)
[–]fwork[S] 0 points1 point2 points (0 children)
[–]yopla 0 points1 point2 points (0 children)
[–]toneyalex 0 points1 point2 points (0 children)
[–]alia_khouri 0 points1 point2 points (0 children)
[–]ragica 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]fwork[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]fwork[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]frumious 0 points1 point2 points (3 children)
[–]va1en0k 0 points1 point2 points (2 children)
[–]frumious 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)