-
Notifications
You must be signed in to change notification settings - Fork 3
New plugin infrastructure #48
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
Conversation
…li into new_plugins
Codecov Report
@@ Coverage Diff @@
## main #48 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 13
Lines 599 613 +14
=========================================
+ Hits 599 613 +14
Continue to review full report at Codecov.
|
|
This is ready for review and comment. I will leave it open for at least 48 hours, merging no earlier than Tue 27 Jul 05:00 GMT (01:00 my local). |
sroet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not knowledgeable enough to do a proper review, but these were the things that stood out to me. Feel free to ignore
Co-authored-by: Sander Roet <sanderroet@hotmail.com>
This PR introduces a new plugin infrastructure for the OPS CLI. This is a major API break, and all externally-developed plugins will need to update for it.
Fortunately, the update procedure is simple: Previously, plugins had to be one per module (file), and the modules needed to define the variables
CLI(to label the command),SECTION(the help section to use), and optionallyREQUIRES_OPS(the minimum OPS version).The new plugins require importing
paths_cli.OPSCommandPlugin, and then creating anOPSCommandPlugininstance, which takes the required variablescommandandsection, and the optional variablesrequires_opsandrequires_cli(which defines the minimum CLI version.) Note that thisOPSCommandPlugininstance must be assigned to a name in the module (it needs to be listed in the module'svars.) I happen to choose the namePLUGINin the examples, but the specific name doesn't matter.For examples on how to do the update, see changes to files in the
commandsdirectory in this PR.The major advantages of the new plugin system are:
compilecommand: Simulation setup with YAML or JSON #43.For developers who want to support for OPS CLI 0.3 (where this will be included) and earlier versions, the two methods can be used simultaneously, but both methods must be included in order for plugins to work with all versions of the CLI (i.e., unmodified old plugins will not load with new versions of the CLI).
Tasks: