Proposal: Use additional metadata class for plugins #23

Closed
opened 2021-12-26 14:44:38 +00:00 by ferfissimo · 0 comments
Owner

Problem:

Loading a plugin's entry point is done to fetch metadata, such as ID / version ...
But if the plugin requires additional packages, those have to be lazy imported.

E.g. auth_ldap is optional, so the ldap packages are also optional, but the __init__.py imports it -> fails, so lazy import would be needed.

Proposed solution:

Add a metadata class just for, as the name implies, the meta data of a plugin.
Only information is provided and a class loader for the real plugin.

A sample implementation is provided here: Example implementation

Example new Plugin entry point: auth_ldap

### Problem: Loading a plugin's entry point is done to fetch metadata, such as ID / version ... But if the plugin requires additional packages, those have to be lazy imported. E.g. *auth_ldap* is optional, so the ldap packages are also optional, but the `__init__.py` imports it -> fails, so lazy import would be needed. ### Proposed solution: Add a metadata class just for, as the name implies, the meta data of a plugin. Only information is provided and a class loader for the real plugin. A sample implementation is provided here: [Example implementation](https://flaschengeist.dev/Flaschengeist/flaschengeist/compare/develop...proposal/plugin-metadata) Example new Plugin entry point: [auth_ldap](https://flaschengeist.dev/Flaschengeist/flaschengeist/src/commit/96eb9799d6d02687e90dd93af99252934c66580f/flaschengeist/plugins/auth_ldap/__init__.py)
ferfissimo added the
🎒 backend
label 2022-02-22 09:26:21 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Flaschengeist/flaschengeist#23
No description provided.