Skip to main content

Pluginero is plugin management system for Python.

Project description

Pluginero

Pluginero - is easy (no) and very small library for plugins. Your plugins are usual Python classes.

Installation:

pip install pluginero

Very simple plugin and its two implementations you can see here:

from pluginero.plugin import BasePlugin
from pluginero.manager import Manager

class MathPlugin(BasePlugin):
    name = "math"

    def fac(self, n: int) -> int:
        ...

class MyMathPlugin(MathPlugin):
    def fac(self, n: int) -> int:
        if n == 0 or n == 1: return 1
        if n > 0: return n * self.fac(n - 1)

class MySecondMathPlugin(MathPlugin):
    def fac(self, n: int) -> int:
        if n == 0 or n == 1: return 1
        else:
            raise RuntimeError("I can't...")

m = Manager((MathPlugin,))
m.register(MyMathPlugin, "first")
m.register(MySecondMathPlugin, "second")

first = m.math.first.fac(5)
second = m.math.second.fac(5)

There we define base plugin which we will implement. Then we implement them and register in manager. And... call them!

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pluginero, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pluginero-0.1.0-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pluginero-0.1.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page