Skip to main content

Plugable: A Python Plugin Framework

Badges:

  • Build: Build Status
  • Coverage: Coverage Status

This package exposes a framework for writing extensible applications.

Specifically, it allows consumers to mark an abstract class as "Plugable", using standard inheritance semantics and ABC decorators:

from abc import abstractmethod
from plugable import Plugable

class AbstractInterface(Plugable):
    @abstractmethod
    def example(self):
        pass

Following this, you can create subclasses for differing implementations, and register them with the AbstractInterface registry, like so:

class ExampleOne(AbstractInterface, register="one"): # Integrated registration
    def example(self):
        print("You ran ExampleOne!")

class ExampleTwo(AbstractInterface):
    def example(self):
        print("You ran ExampleTwo!")

AbstractInterface.registry.register("two", ExampleTwo) # Explicit registration

Finally, you can access and consume the registered implementations, like so:

AbstractInterface.get("one").example()  # You ran ExampleOne!
AbstractInterface.get("two").example()  # You ran ExampleTwo!

Metadata

Release files for plugable 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plugable 1.2.2
File Size Uploaded
plugable-1.2.2.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plugable 1.2.2
File Interpreter ABI Platform
plugable-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / plugable-1.2.2.tar.gz

Download URL plugable-1.2.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc0782c11255f206f606595c3065a397571e5dc91b08b2b0126ed462ef3b8cc4
BLAKE2b-256 checksum
How to use checksums
f811b89c680a1e19640f36fc70497418b4312c7f74a7aeb1a39ddfa7343c0118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / plugable-1.2.2-py3-none-any.whl

Download URL plugable-1.2.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97412801790acfdedf936e4255d9a467095d2cb708ff701ba37b14a751117abd
BLAKE2b-256 checksum
How to use checksums
087e3d016cf756cfebc371138bd7f25bcf5719211ccb5532d7636cd9293e873c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.9

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page