I want to float a proposal for plugin infrastructure that I'd love to see made part of the web2py core. It takes a bit of explanation, so bear with the long post.
I'm starting to find that the syncing issue is a major one with the (otherwise great) plugin infrastructure. I have a growing series of plugins that I'm using in a number of my apps. Most are custom, written by me, but most are in a major state of flux. I use most of plugins in multiple apps, and I tend (because of time constraints) to debug and add features as necessary for whatever app I'm actively developing at the moment. Right now, the only built-in option for keeping these plugins up-to-date is to pack and export them constantly, and constantly be importing them into other apps. What I need is a centralized way to sync plugins. At the same time, I'd like to be able to conveniently isolate the development of a plugin to a dedicated git repo, both for versioning and so that the source files can be quickly made available to the community on github. I see three ways of approaching this problem: 1. Run a script that searches my apps for a given plugin and uses a file-syncing library to update older versions. This introduces the possibility of the syncing algorithm overwriting the wrong folder. It also makes it more awkward to use github for plugin development. Since the plugin files are spread across several folders, intermixed with non-plugin files, it's practically impossible to have one git repo for the app and a second for the plugin. or 2. Move plugin files to a central location (maybe web2py/plugins) and create symlinks in the app directories. This avoids the hazards of syncing across apps and makes it easy to set up a git repo (since the plugin folder is outside the app folder and all the plugin files are in a single folder). Setting up and moving the symlinks, though, is time consuming and error-prone if it's done by hand. It also seems redundant to keep symlinks in the app folders at all. Why not just give the app a list of plugins to look for in the 'web2py/plugins' directory? 3. Change the web2py internals so that plugins can be installed either on a per-app basis (as it is now) or on an installation-wide basis (in web2py/plugins). When a plugin is installed centrally, its name is just added to a list in the default model file and its files are imported into the web2py python environment. No symlinks are needed. This would not break backward compatibility (since the current plugin system could co-exist with this central one side-by-side). But it would make plugins much more useful for me. It also seems to me that this option actually requires the least coding. So I have two questions. First, do others agree that #3 is the best way to go? Am I missing some key issues? Second, while I'm happy to help implement #3, it's also the solution that I'm least qualified to implement. I'm not sure exactly how the web2py env works and how to make sure that gluon can find, e.g., model and controller files if they're not in the app folders. I think we could ease the problem by requiring that the app folder structure be duplicated in each plugin folder (web2py/plugins/plugin_parrot/controllers/plugin_parrot.py, etc.) but does anyone else know how easy/difficult this would be? If you can point me in the right direction I could try to figure the rest out. But if there's anyone else willing to work on the problem I'd be glad for that too. Ian

