-
Notifications
You must be signed in to change notification settings - Fork 516
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
Initial plugin docs #2138
Initial plugin docs #2138
Conversation
Signed-off-by: Ian Costanzo <[email protected]>
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.
few spellings to correct but this is great work!
really a lot of information that took me many hours and days, weeks? to figure out.
Plug-ins are loaded on Aca-Py startup based on the following parameters: | ||
|
||
* `--plug-in` - identifies the plug-in library to load | ||
* `--block-plugin` - identifies plug-ins (includign built-ins) that are *not* to be loaded |
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.
spelling: including
|
||
If a setup method is provided, it will be called. If not, the `message_types.py` and `routes.py` will be explicitely loaded. | ||
|
||
TODO I couldn't find an implementation of a custom `setup` in any of the existing plug-ins, so I'm not completly sure what are the best practices for this option. |
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.
sp. completely
|
||
### setup.py | ||
|
||
If a setup method is provided, it will be called. If not, the `message_types.py` and `routes.py` will be explicitely loaded. |
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.
sp: explicitly
|
||
### setup.py | ||
|
||
If a setup method is provided, it will be called. If not, the `message_types.py` and `routes.py` will be explicitely loaded. |
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.
should we mention that it would be in the package/module __init__.py
?
async def setup(context: InjectionContext):
pass
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.
Good point I'll do that
When loading a plug-in, if there is a `message_types.py` available, Aca-Py will check the following attributes to initialize the protocol(s): | ||
|
||
- `MESSAGE_TYPES` - identifies message types supported by the protocol | ||
- `CONTRROLLERS` - identifies protocol controllers |
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.
sp CONTROLLERS
If `routes.py` is available, then Aca-Py will call the following functions to initialize the Admin endpoints: | ||
|
||
- `register()` - registers routes for the new Admin endpoints | ||
- `register_events()` - registers an events this package will listen for/respond to |
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.
I did not know that - excellent!
|
||
### Plug-In Demo | ||
|
||
TBD |
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.
I like this idea... maybe illustrate all the ways mentioned above in the "When developing a new plug-in" section. Or we can begin pointing at specific implementations that exist in the wild.
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.
Yes that's what I was thinking. I'm going to create a new issue for this
|
||
The load sequence for a plug-in (the "Startup" class depends on how Aca-Py is running - `upgrade`, `provision` or `start`): | ||
|
||
```mermaid |
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.
wow - this section is fantastic. this would have saved me days of jumping in and out of code and poking around.
I don't have permission to approve, but I very much do approve! |
@usingtechnology thanks I'll fix the spellings and typos!!! |
This is great. Not sure if worth tacking on that you can discover which plugins are on an existing acapy deployment with the |
Yes, good suggestion! |
Signed-off-by: Ian Costanzo <[email protected]>
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.
Looks great! Spotted a typo
Co-authored-by: Daniel Bluhm <[email protected]> Signed-off-by: Ian Costanzo <[email protected]>
Kudos, SonarCloud Quality Gate passed! |
#2108