-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin-specified PyB API version constraints #257
Comments
@mriehl feedback please |
Yes agreed. But I'd try to start optimistically and only have plugins indicate a minimum version of PyBuilder (if they so wish). I don't think a plugin should break by default because there was a major version increment since the incompatible change(s) might not affect the plugin at all. A minimal version should be enforced though. I guess some kind of static function that plugins can call à la from pybuilder.core import declare_plugin
declare_plugin.for_api_version("0.14.0").and_greater()
# plugin code would be a good start. Also we need to handle the case where PyBuilder is bootstrapping itself and has not replaced the |
Agree.
I was thinking more along the lines of pyb_version="<[PEP 0440](https://www.python.org/dev/peps/pep-0440/) version constraint>" in If no version is specified there is no check. |
I am not sure I like the complexity this inversion of control introduces. A library function would allow me as a plugin author to:
These things are important but hard to achieve with declarative style constraints like setting a local in the module toplevel. |
I'm not sure where you see the inversion of control here. The plugin has access to The case I'm targeting is whether the plugin should be at all initialized within the current build given the running PyB. Having PEP 0440-style enforcement prevents any of the code (beyond module/package initializer) from running. If the plugin owner decides to use ostrich version checking (i.e. not using |
To take a lesson from Mozilla Thunderbird plugins, for example, this is a common situation: My plugin supports PyB versions 0.13.x but not 0.14.y, therefore I, as a plugin owner, decide that my plugin will not load with PyB 0.14 cause I have no clue what API changes might come there and don't want to risk incompliant or nonsensical behavior. |
Yeah I gave it some more thought and you're right. The library function approach has the showstopper that it's not backwards compatible, whereas declaring a local at the module level is. I guess I wanted to avoid look-before-you-leap constraints in plugin that lead to build crashes when the plugin would actually work fine, but at this point it's not much more than a crystal ball guess. Agreed for the pep constraint in |
👍 |
fixes pybuilder#257, connected to pybuilder#257
fixes pybuilder#257, connected to pybuilder#257
fixes pybuilder#257, connected to pybuilder#257
Plugins should be able to specify which versions of PyB they are compatible with. If there are breaking changes in the internal PyB APIs, PyB should be able to warn the user that plugin does not support the currently running version of PyB and should discontinue operation.
PyB should use SemVer to indicate compatibility:
<major>
- revolutionary incompatible changes in major areas (extremely rare)<minor>
- evolutionary incompatible changes in some areas<revision>
- compatible revisions/bug fixesThe text was updated successfully, but these errors were encountered: