Memri Plugin Template
This repository provides a boilerplate for those who want to create new plugins for Memri per Acceptance Criterias.
- Standard folder structure
- Has test setup
- Has .gitlab-ci.yml
- Has setup.py
- Has Dockerfile
- Has MPPL License
- Has icon/logo
Contributions are very welcome.
Installation
First, make sure you have the latest dev branch (v3 API) of POD installed and running.
Run below commands after cloning this repository and entering into its directory: Docker:
docker build -t {PLUGIN_DOCKER_CONTAINER_NAME} .
Local:
pip install poetry
poetry install
Usage
ServiceAPI module is just a dummy 3rd party api client and it can be replaced with a real service client. CVUStoredDefinition items should be created and connected to the Plugin item during plugin installation.
Please create an issue or an MR if you find an issue or have a suggestion.
To run the plugin, after starting the POD (on dev branch) and building this docker image, type:
python scripts/client-simulator.py {POD_URL} {PLUGIN_DOCKER_CONTAINER_NAME}
This will trigger a plugin run, starting the plugin's docker container. The script will listen the plugin and simulate a user authentication.
To test:
pytest ./tests/*
Implementation
The main plugin flow is described in the submodule named 'plugin_flow'. It provides a set of methods for communication inbetween the user-client and the plugin.
This PluginFlow class is the base class of the demo plugin.
Data Structures and Flow
Used data types are:
- Plugin { .... }
- StartPlugin { ... }
- Account { ... }
TODOs
- Refactor
- Add tests