simplug
A simple plugin system for Python with async hooks support.
Features
- Decorator-based API: Define hooks with
@simplug.specand implement with@simplug.impl - Async support: First-class async hooks with sync/async bridging
- Flexible result collection: 18 built-in strategies for collecting plugin results
- Priority system: Control plugin execution order
- Setuptools entrypoints: Load plugins from installed packages
- Singleton per project: Same instance returned for same project name
Installation
pip install -U simplug
Quick Start
from simplug import Simplug
# Create a plugin manager
simplug = Simplug('myproject')
# Define a hook specification
class MySpec:
@simplug.spec
def process_data(self, data):
"""Process data in plugins."""
# Implement the hook in plugins
class PluginA:
@simplug.impl
def process_data(self, data):
return data.upper()
class PluginB:
@simplug.impl
def process_data(self, data):
return data.lower()
# Register plugins
simplug.register(PluginA, PluginB)
# Call the hook
results = simplug.hooks.process_data("Hello")
print(results) # ['HELLO', 'hello']
Documentation
Full documentation is available at https://pwwang.github.io/simplug/
Getting Started
- Define hooks - Specify what plugins can customize
- Implement hooks - Create plugins with implementations
- Register plugins - Load plugins into your application
- Call hooks - Trigger plugin execution
For detailed guides and API reference, see the full documentation.
Examples
See the examples directory for complete examples:
examples/toy.py- A minimal 30-line demoexamples/complete/- Full example with setuptools entrypoints
License
MIT
Metadata
Release files for simplug 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simplug-0.5.7.tar.gz | 18.1 kB | Without provenance | Details for simplug-0.5.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simplug-0.5.7-py3-none-any.whl | Python 3 | none | any | Details for simplug-0.5.7-py3-none-any.whl |
Total release size: 30.2 kB
Release files / simplug-0.5.7.tar.gz
| Download URL | simplug-0.5.7.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
316d0623858fefc893cfaa7ae21495f1d7dcf4607457aa220e6ac0302e4e7546
|
|
BLAKE2b-256 checksum How to use checksums |
f1ba187201c2bdcd0658e629dae8af3339d89866b8fa09e31d1857f86f317d0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / simplug-0.5.7-py3-none-any.whl
| Download URL | simplug-0.5.7-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4987639d4c8f596bb541e6677a9762c7b259951b8787253ad336163a081b143
|
|
BLAKE2b-256 checksum How to use checksums |
74c3babcea097dcc3684e96eef5d03e7558935aaae0dc28a8fd68aa86bc5ad09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for simplug 0.5.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.