Building a plugin architecture with Python

Problem statement

Fundamental plugin concepts

Discovery

Registration

Application Hooks

Exposing application API to plugins

Code examples

Discovery

The references models can be found here, these are just data classes for demonstration purposes

Registration

Sample plugin directory structure which can be found here
plugin.yaml configuration file for the sample plugin
sample.py the main sample plugin file which can be found here
PluginUseCase discover and load/hook plugins

Application hooks and exposing the API

Plugins are loaded through __search_for_plugins at this point
Plugin instance creation and invocation
Application core module which can be found here

Freelancer and open source developer, growing my skills one byte a time :)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Create a Cumul.io API Plugin with Air Quality Data

CS373 Spring 2021: Remus Wong

CS371p Spring 2021 Week 14: Albert C. Trevino

AWS Lambda — how best to manage shared code and shared infrastructure

How to Structure CSS in Vue Like a Pro

Filter by search keyword in cloud firestore query

SELECTING A PROGRAMMING LANGUAGE AS A NEWBIE IN SOFTWARE DEVELOPMENT #SCATweetChat with Adaora…

How to implement the Enterprise Apple SSO: Part Two (check access status)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Maxwell Mapako

Maxwell Mapako

Freelancer and open source developer, growing my skills one byte a time :)

More from Medium

NSQ with Docker in baby steps -70 lines of code

Why is multi-threaded Python so slow?

Python simple debugging beyond print() with Icecream

Setting-up Airflow on Windows 10 without Docker