TinkerFin Notifications
Publish resource changes to independent asynchronous listeners. Notifications are advisory: consumers read authoritative state after a change, on reconnect, and at an application-appropriate reconciliation interval.
Installation
pip install tinkerfin-notifications
Quick start
import asyncio
from tinkerfin_notifications import Notification, NotificationScope, Notifications
async def main() -> None:
async with Notifications() as notifications:
scope = NotificationScope(namespace="project-a")
async with notifications.subscribe(scope=scope) as changes:
await notifications.publish(
Notification(scope=scope, topic="documents.changed", key="document-42")
)
change = await anext(changes)
print(change)
asyncio.run(main())
Enter a subscription before reading its initial snapshot. Delivered hints are
broadcast to matching listeners; repeated changes to a resource can be coalesced. A full
listener buffer produces ResyncRequired, requiring a fresh authoritative read.
Scopes are filters, not authorization. Hosts authenticate clients and choose the namespaces and owners they may observe. Keep message content and credentials out of notification details.
The service owns its backend and subscriptions. Backend resources explicitly borrowed from the host remain host-owned. Closing a listener never cancels the operation that changed the resource.
await publish(...) freezes the notification and accepts it into a bounded sending
queue. It does not wait for network delivery. Pending changes to the same resource
are combined; admission of a new resource fails with NotificationCapacityExceeded
when the queue is full. Configure NotificationLimits.max_pending_publications
when the default of 128 pending resources does not fit the application.
Cross-process notifications
pip install 'tinkerfin-notifications[redis]'
from tinkerfin_notifications.redis import RedisBackend
# The host owns redis_client and closes it after Notifications exits.
notifications = Notifications(
backend=RedisBackend(redis_client, channel="my-application:changes")
)
Each process uses its own service with the same Redis channel. Startup waits for
subscription acknowledgement. Disconnects and resubscriptions produce
ResyncRequired; Pub/Sub cannot recover messages sent while disconnected.
The service owns bounded transport waits and reports failed delivery through its
diagnostics. Accepted hints can be lost without changing already-committed source
state. A failed publication requires matching local listeners to resynchronize;
remote listeners still rely on their own transport signals and repair reads.
Closing discards queued hints and waits for a send already in progress before
the host closes the borrowed client. Consumers must keep their authoritative repair reads.
Documentation and license
Metadata
Release files for tinkerfin-notifications 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tinkerfin_notifications-0.1.1.tar.gz | 21.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tinkerfin_notifications-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.2 kB
Release files / tinkerfin_notifications-0.1.1.tar.gz
| Download URL | tinkerfin_notifications-0.1.1.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52c35d78619db57e4907a6e8dd2ae766d2a6daa3307cb7ff9c1db508d8e1b355
|
|
BLAKE2b-256 checksum How to use checksums |
e2cde6a1f719150297619ab0acf5611e755e45b35dd663581d509114de2ba71d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tinkerfin_notifications-0.1.1-py3-none-any.whl
| Download URL | tinkerfin_notifications-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bd0be81c2c3434b6b07c55596157ecbef75c1d526a9aba46341d47d039fbe2d
|
|
BLAKE2b-256 checksum How to use checksums |
c5ca2ca26d0071424a3310d7bd6388f8c3a03bdf48840c57693a38aa209e67f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|