bloque-notifications
Notification orchestrator with pluggable providers and template rendering.
Features
- Template rendering - Jinja2 (optional) with
str.format_map()fallback - Pluggable providers - WebhookProvider, ConsoleProvider, or any duck-typed provider
- Multi-channel routing - Send one notification to multiple channels
- Tenant-aware templates - Automatic tenant prefix via ulfblk-multitenant context
- Async by design - All I/O operations are async
Installation
uv add bloque-notifications
# With Jinja2 template support
uv add bloque-notifications[templates]
Quick Start
from bloque_notifications import NotificationService, ConsoleProvider, Notification, Channel
service = NotificationService(
providers={Channel.CONSOLE: ConsoleProvider()},
)
await service.start()
# Simple notification (no template)
result = await service.notify_simple(
recipient="admin@example.com",
subject="Deploy complete",
body="Version 2.1.0 deployed successfully.",
channels=[Channel.CONSOLE],
)
# Template-based notification
service.template_engine.register(
"welcome",
subject="Welcome, {name}!",
body="Hello {name}, your account on {app} is ready.",
)
result = await service.notify(Notification(
recipient="user@example.com",
template_name="welcome",
context={"name": "Alice", "app": "MyApp"},
channels=[Channel.CONSOLE],
))
await service.stop()
Connecting ulfblk-channels as Email Provider
bloque-notifications does NOT depend on ulfblk-channels. You can connect
any object that satisfies the NotificationProvider protocol via duck-typing:
from bloque_channels.email.client import EmailClient
from bloque_channels.models.settings import EmailSettings
from bloque_notifications import NotificationService, Channel
from bloque_notifications.protocol import NotificationProvider
class EmailAdapter:
"""Adapt EmailClient to NotificationProvider protocol."""
def __init__(self, client: EmailClient) -> None:
self._client = client
async def send(self, recipient, subject, body, *, metadata=None):
from bloque_channels.models.message import OutboundMessage
msg = OutboundMessage(to=recipient, subject=subject, body=body)
return await self._client.send_message(msg)
async def health_check(self) -> bool:
return await self._client.health_check()
# Usage
email = EmailClient(EmailSettings(host="smtp.example.com"))
service = NotificationService(
providers={Channel.EMAIL: EmailAdapter(email)},
)
Providers
| Provider | Channel | Description |
|---|---|---|
ConsoleProvider |
CONSOLE | Logs notifications via ulfblk-core logger |
WebhookProvider |
WEBHOOK | POSTs JSON payload to recipient URL |
API
See source code docstrings for full API documentation.
Metadata
Release files for ulfblk-notifications 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ulfblk_notifications-0.1.0.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ulfblk_notifications-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / ulfblk_notifications-0.1.0.tar.gz
| Download URL | ulfblk_notifications-0.1.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c17ae6b65401c1bfaf450a053a51038fef6045640c1535e080c51f55beb1a0af
|
|
BLAKE2b-256 checksum How to use checksums |
09e48e8e61bf3f0c82e469f3ab9ef33d3d71c735385f666d09f5dbab6727697c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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":null}
|
Release files / ulfblk_notifications-0.1.0-py3-none-any.whl
| Download URL | ulfblk_notifications-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95a5599225ee1ed9364636c7921635472032c641f5f7610b4cf19aa5a03dc41b
|
|
BLAKE2b-256 checksum How to use checksums |
2d9c8646d640c97f100eef20570999f5a63a314f3dc547de2e738a2d75aba65e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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":null}
|