Skip to content
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

Merged
merged 4 commits into from
Feb 22, 2023
Merged

Initial plugin docs #2138

merged 4 commits into from
Feb 22, 2023

Conversation

ianco
Copy link
Contributor

@ianco ianco commented Feb 21, 2023

Signed-off-by: Ian Costanzo <[email protected]>
@ianco ianco requested a review from swcurran February 21, 2023 22:03
Copy link
Contributor

@usingtechnology usingtechnology left a 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
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

@usingtechnology
Copy link
Contributor

I don't have permission to approve, but I very much do approve!

@ianco
Copy link
Contributor Author

ianco commented Feb 22, 2023

@usingtechnology thanks I'll fix the spellings and typos!!!

@ianco ianco requested a review from dbluhm February 22, 2023 17:54
@loneil
Copy link
Contributor

loneil commented Feb 22, 2023

This is great.

Not sure if worth tacking on that you can discover which plugins are on an existing acapy deployment with the server \plugins endpoint?

@ianco
Copy link
Contributor Author

ianco commented Feb 22, 2023

Not sure if worth tacking on that you can discover which plugins are on an existing acapy deployment with the server \plugins endpoint?

Yes, good suggestion!

Copy link
Contributor

@dbluhm dbluhm left a 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

docs/GettingStartedAriesDev/PlugIns.md Outdated Show resolved Hide resolved
Co-authored-by: Daniel Bluhm <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ianco ianco merged commit 4f2b6dd into openwallet-foundation:main Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants