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!

Download files

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

Source Distribution

plugable-1.2.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plugable-1.2.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file plugable-1.2.2.tar.gz.

File metadata

  • Download URL: plugable-1.2.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for plugable-1.2.2.tar.gz
Algorithm Hash digest
SHA256 bc0782c11255f206f606595c3065a397571e5dc91b08b2b0126ed462ef3b8cc4
MD5 caf81c8692c694c5181f2460b086b6b0
BLAKE2b-256 f811b89c680a1e19640f36fc70497418b4312c7f74a7aeb1a39ddfa7343c0118

See more details on using hashes here.

File details

Details for the file plugable-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: plugable-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for plugable-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97412801790acfdedf936e4255d9a467095d2cb708ff701ba37b14a751117abd
MD5 71d77d170022208d0f74a67b1d4442d9
BLAKE2b-256 087e3d016cf756cfebc371138bd7f25bcf5719211ccb5532d7636cd9293e873c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.1.9

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page