Skip to main content

spanreed

Message bus and task manager using redis streams.

Install

pip install spanreed

Configuration

Django configuration is supported. Alternatively, create a settings module and point SPANREED_SETTINGS_MOUDULE env variable to it.

Set SPANREED_REDIS_URL to your redis dsn.

Set SPANREED_MODELS to a list of import strings with your pydantic classes (see below), eg. SPANREED_MODELS = ('app.models.User', 'app.models.Permission').

Set SPANREED_PUBLISHER to your app name.

Set SPANREED_QUEUE to your environment name (eg. staging, prod).

Make sure all modules with tasks are imported at startup.

Message bus usage

Messages are broadcast to all listening apps. Use them to synchronize app state and implement "event sourcing" flows.

Create a message pydantic class by inheriting from spanreed.models.BaseMessage:

from spanreed.models import BaseMessage, Metadata

class UserCreated(BaseMessage):
    user_id: str

    def handle(self):
        print('got message', self)


user = UserCreated(user_id='id')
user.publish()

publish sends a message to the bus, handle is called by a daemon when a message is received.

Run the daemon with spanreed-consumer --queue-type message or manage.py spanreed_worker --queue-type message if using Django.

Task manager usage

Tasks are delivered only once inside a single app. Use them as celery replacement.

Create a task:

from spanreed import task

@task
def frobnicate_user(user_id):
    frobnicate(user_id)

frobnicate_user.dispatch('uid')

dispatch sends a task to the bus, which will be invoked by a daemon.

Run the daemon with spanreed-consumer --queue-type task or manage.py spanreed_worker --queue-type task if using Django.

Metadata

Release files for spanreed 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spanreed 0.2
File Size Uploaded Provenance
spanreed-0.2.tar.gz 18.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for spanreed 0.2
File Interpreter ABI Platform
spanreed-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / spanreed-0.2.tar.gz

Download URL spanreed-0.2.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
feda7d105a054c0d579d7c5d2d41806fed17eeaa1aa75ec5ea8db326b337a69d
BLAKE2b-256 checksum
How to use checksums
9f0a5b7a2452dae68fab9a63e3ccc7740bad5f07cc1b0110cf5d67f279b3f9ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 22, 2025.

Transparency log

Release files / spanreed-0.2-py3-none-any.whl

Download URL spanreed-0.2-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
961a712254753a56e928db0d44c7ed2548118011638a3e8e60088e451de2379c
BLAKE2b-256 checksum
How to use checksums
636648e5bc6272e8c2130f5ac3eea19efb79330a716deb7e80439ef3b58b4e05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 22, 2025.

Transparency log

Security for spanreed 0.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spanreed-0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 22, 2025.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page