biffo-plugin-sdk
The Python SDK for building Biffo plugins: manifest validation, a Core API client, and the event subscription system.
A Biffo plugin is a Lambda-deployed Python package that extends a Biffo
instance. It declares its tables, routes and event subscriptions in a
biffo.plugin.json manifest, and reaches platform data only through the Core
API — never through a database client of its own (ADR-0002). This SDK is the
supported way to do both.
Install
pip install biffo-plugin-sdk
Outside AWS Lambda, install the sigv4 extra as well:
pip install "biffo-plugin-sdk[sigv4]"
botocore — needed to sign requests to the Core API — is an extra rather than a
hard dependency because it is preinstalled in the AWS Lambda Python runtime, so
a deployed plugin already has it. The SDK imports it lazily, so
import biffo_plugin_sdk works without it.
Versioning
This package carries its own semantic version, independent of the Biffo
template's core version. It is a public API contract for plugin authors: a
major bump here means the plugin API broke, and nothing else. Plugin manifests
declare "biffo-plugin-sdk": "^1.0" and plugin pyproject.toml files pin
biffo-plugin-sdk>=1.0,<2.0.
Quick start
from biffo_plugin_sdk import BiffoEvent, BiffoPluginBase, load_manifest
class MyPlugin(BiffoPluginBase):
def __init__(self) -> None:
super().__init__(load_manifest("biffo.plugin.json"))
@self.subscribe("user.created")
async def on_user_created(event: BiffoEvent) -> None:
await self.api.post(
"/api/v1/internal/welcome", json={"user": event.detail}
)
def on_install(self) -> None: ...
def on_uninstall(self) -> None: ...
Handlers are registered against self.events, an EventSubscriber private to
the instance. In the Lambda entrypoint, turn the raw EventBridge payload into a
BiffoEvent and dispatch it:
from biffo_plugin_sdk import create_event_handler
plugin = MyPlugin()
async def handler(raw_event: dict, context: object) -> None:
await plugin.events.dispatch(create_event_handler(raw_event))
self.api is built by create_core_client() and defaults to a
SignedCoreClient — every request is signed with AWS SigV4 using the plugin
Lambda's role, which is the plugin→Core auth mechanism (ADR-0009). Set
BIFFO_CORE_AUTH_MODE=none for an unsigned client in local runs and tests.
Public API
| Export | What it is |
|---|---|
BiffoPluginBase |
Base class for a plugin; owns self.api and the subscribe/subscribe_all decorators |
PluginManifest, load_manifest, register_plugin |
Manifest model and loaders — the authoritative validator for biffo.plugin.json |
TableDefinition, ColumnDefinition, IndexDefinition, TablePermissions, PermissionRule, RouteDef |
Manifest sub-models |
BiffoAPIClient, BiffoAPIError |
Unauthenticated async Core API transport, and its single error type |
SignedCoreClient, create_core_client |
SigV4-signing client (ADR-0009) and the factory that picks it by default |
BiffoEvent, EventSubscriber, create_event_handler |
Event model, dispatch registry, and the raw-EventBridge-payload parser |
Environment
| Variable | Read by | Purpose |
|---|---|---|
BIFFO_CORE_API_URL |
BiffoAPIClient |
Core API base URL; injected into the plugin Lambda by modules/plugins/_template |
AWS_REGION |
SignedCoreClient |
Region to sign for |
BIFFO_CORE_AUTH_MODE |
create_core_client |
sigv4 (default) or none |
Documentation
- ADR-0003 — Plugin system and marketplace
- ADR-0009 — Internal service authentication
- Plugin authoring guide
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biffo_plugin_sdk-1.1.0.tar.gz.
File metadata
- Download URL: biffo_plugin_sdk-1.1.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b5b77d440dd4c53cf6c0ec1729ad43c5d717803d1ccc9a0ef3eee69c8729d00
|
|
| MD5 |
8e869214a08c4434cfc7b7a1c3fb1e61
|
|
| BLAKE2b-256 |
10bbe0b42186304af743972a092cf1b83ef8399ea41b16ae0af0db930e599d76
|
Provenance
The following attestation bundles were made for biffo_plugin_sdk-1.1.0.tar.gz:
Publisher:
publish-sdk.yml on keiranholloway/biffo-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biffo_plugin_sdk-1.1.0.tar.gz -
Subject digest:
8b5b77d440dd4c53cf6c0ec1729ad43c5d717803d1ccc9a0ef3eee69c8729d00 - Sigstore transparency entry: 2232026458
- Sigstore integration time:
-
Permalink:
keiranholloway/biffo-template@3a31eee8015607b49692aa6a5e8352c63aeab035 -
Branch / Tag:
refs/tags/sdk-v1.1.0 - Owner: https://github.com/keiranholloway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@3a31eee8015607b49692aa6a5e8352c63aeab035 -
Trigger Event:
push
-
Statement type:
File details
Details for the file biffo_plugin_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: biffo_plugin_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f78f41b3a904acddf56ca879d6e4fcdc18d1ff7a7c8249f1d088268fda82714
|
|
| MD5 |
f4d32e2d18ee1c86055d4f8cf0ccb249
|
|
| BLAKE2b-256 |
ab2279747766062dcda4719aa3f37fc994a09f8f5e5bd73261f78a4660ccdf0f
|
Provenance
The following attestation bundles were made for biffo_plugin_sdk-1.1.0-py3-none-any.whl:
Publisher:
publish-sdk.yml on keiranholloway/biffo-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biffo_plugin_sdk-1.1.0-py3-none-any.whl -
Subject digest:
9f78f41b3a904acddf56ca879d6e4fcdc18d1ff7a7c8249f1d088268fda82714 - Sigstore transparency entry: 2232026700
- Sigstore integration time:
-
Permalink:
keiranholloway/biffo-template@3a31eee8015607b49692aa6a5e8352c63aeab035 -
Branch / Tag:
refs/tags/sdk-v1.1.0 - Owner: https://github.com/keiranholloway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@3a31eee8015607b49692aa6a5e8352c63aeab035 -
Trigger Event:
push
-
Statement type: