-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SEP 7: Generic Plugin Subsystem
key | value |
---|---|
Status | Active |
Author | anatoly techtonik <[email protected]> / @techtonik |
Created | April 15, 2015 |
Updated | April 15, 2015 |
Discussion | -PR TBD- |
Implementation | -PR TBD- |
Generic Plugin Subsystem for Spydey is a set of conventions that can be reused outside of Spyder. This means that plugin can adapt itself to different tools and chooses provided dependencies and feature depending on environment where it is run.
To allow max adoption, the Spydey GPS core (the tricky part on application side) should be released as CC0 / Public domain / Unlicense.
def init(spyenv):
pass
spyenv
is any object that allows plugin to inspect it.
def init(spyenv):
if not hasattr(spyenv, 'appname'):
return
if spyenv.appname != 'spyder':
return
imports()
return True
def imports():
global spy
import spy
To avoid dependency on Spyder, there should not be any non-standard imports on global level. So the plugin encapsulates all the checks inside init()
method and does imports only when everything else is ok.
Plugin should not import anything except base Python dependencies at its top level or init()
to allow application inspect plugins that are conflicting (like choose the best version of the same plugin).
Specification or speccy is divided into levels. Every new level restricts flexibility and makes the protocol between plugin and application more strict / defined. You're free to implement the speccy until any level and state that in your plugin docs.
To avoid feature creeping and specification bloat, every new level should be practical, solve a real issue, have real plugin behind and follow at least one of the following principles:
- make plugin code less mystic
- make plugin code less verbose
- make plugin writing a less repeatable process
- anything that improves usability and experience of plugin maintainers
- Plugin provides init(spyenv) method
- App calls init() method with object
The return value for init() method is not defined at this level of speccy. The required structure of spyenv object depends on application needs and is also not defined by ground zero.
Connect with Spyder through our social media channels and stay up to date with current developments!