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

Add support for custom plugins and yaml constructors #278

Open
signebedi opened this issue Jun 23, 2024 · 1 comment
Open

Add support for custom plugins and yaml constructors #278

signebedi opened this issue Jun 23, 2024 · 1 comment

Comments

@signebedi
Copy link
Owner

signebedi commented Jun 23, 2024

We should implement a plugin abstract base class that end users can use to create their own logic. Something like (and I'm making this up right now):

from abc import ABC, abstractmethod

class Plugin(ABC):

    def __init__(self):
        pass

    @abstractmethod
    def setup(self):
        """
        Setup the plugin.
        """
        pass

    @abstractmethod
    def execute(self, data):
        """
        Execute plugin functionality.
        """
        pass

That we store in libreforms_fastapi/utils/plugins.py, and then an app config PLUGIN_PATH that, when set, imports the custom plugin library using sys. We need to think through this a little more.

Originally posted by @signebedi in #150 (comment)

@signebedi signebedi changed the title Add support for custom plugins Add support for custom plugins and yaml constructors Jun 23, 2024
@signebedi
Copy link
Owner Author

signebedi commented Jun 23, 2024

The primary objective here is that end users should be able to pass, first and foremost, additional yaml constructors for the form config. But, it potentially goes beyond that by introducing an abstract interface for more powerful custom logic. If done right, this could also be the basis for visualizations, see #247, unless we prefer to handle those eg. as part of the relational database model, or in their own config file.

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

No branches or pull requests

1 participant