Skip to main content

fanferro

Fast, robust SNS + SQS messaging for Python, powered by a Rust core.

fan-out (SNS → SQS) · fanfare (announcing to a topic) · ferro (iron: the Rust core)

import fanferro
from pydantic import BaseModel                  # or dataclasses, msgspec, protobuf, ...


@fanferro.message_type("checkout.order_placed.v1")
class OrderPlaced(BaseModel):
    order_id: str
    amount_cents: int


client = fanferro.Client(
    source="urn:service:checkout",
    provisioning=fanferro.Provisioning.ensure(),  # create missing resources (default: must exist)
)
orders = client.topic("orders")
billing = client.queue("billing", dead_letter=fanferro.DeadLetterQueue("billing-dlq"))
client.subscription(orders, billing)
consumer = client.consumer(billing, concurrency=20)


@consumer.route(OrderPlaced)
async def charge(order: OrderPlaced) -> None:
    ...                                    # return → ack · raise → retry with backoff → DLQ


async def main() -> None:
    async with client:                     # connect + provision declared resources
        await orders.publish(OrderPlaced(order_id="o-1", amount_cents=1299))
        await consumer.run()               # SIGTERM → graceful drain

Status: 0.x - the API may still change between minor versions.

Install

uv add fanferro                   # pip install fanferro
uv add "fanferro[all]"            # + pydantic, protobuf, msgspec, opentelemetry-api

AWS Lambda

Consume a queue in a Lambda function with an SQS event source mapping: each record is decoded, routed and retried like a message a consumer received, and failed records come back as batchItemFailures.

client = fanferro.Client(source="urn:service:billing")   # module level: reused while warm
billing = client.queue("billing", dead_letter=fanferro.DeadLetterQueue("billing-dlq"))
router = fanferro.Router()


@router.route(OrderPlaced)
async def charge(order: OrderPlaced) -> None:
    ...                                    # return → done · raise → retried · Reject → DLQ


handler = fanferro.aws_lambda.sqs_handler(client, router, queue=billing)   # handler(event, context)

Turn on ReportBatchItemFailures on the event source mapping. Permissions, outcomes and testing with fanferro.testing.invoke_sqs_handler: Deployment → Lambda.

Testing

Test routing and handlers without a broker: fanferro.testing.dispatch runs one message through the consumer's routing, decoding, middleware, handler and retry and dead-letter policies, and returns how it was settled. build_message gives a message the transport metadata a handler may depend on (attempt, group_id, the SNS topic, sent_at...).

from fanferro.testing import build_message, dispatch


async def test_charge() -> None:
    result = await dispatch(consumer, build_message(OrderPlaced(order_id="o-1", amount_cents=1299), attempt=3))
    assert result.outcome == "acked"     # or "retried", "requeued", "dead_lettered", "discarded"

Flows run on an in-memory broker (fanferro.testing.memory_client()) or an emulator: Testing.

Highlights

  • Handlers are plain typed functions. Return to ack, raise to retry. No receipt handles.
  • Your own types. Pydantic, dataclasses, msgspec, protobuf, JSON or raw bytes.
  • Routing on anything. Message type, attribute, body field or topic.
  • Safe by default. Heartbeats, retries with backoff, dead-letter queues, graceful shutdown.
  • Infrastructure in code. Declared queues, topics and subscriptions are checked or created.
  • Long-running workers or AWS Lambda. The same handlers and policies for SQS event sources.
  • Tests without AWS or Docker. An in-memory broker runs the same engine you deploy.
  • Mistakes caught early. Bad names, sizes and signatures fail before any network call.
  • Observable. Typed events, structured logs, hooks and OpenTelemetry.
  • The hard parts included. Large payloads via S3, outbox, idempotency, FIFO ordering.
  • Fast. A Rust core, full batches and little Python work per message.
  • No required dependencies. Fully typed, Python 3.12-3.15, wheels for Linux, macOS, Windows.

Performance

  • Rust does the heavy lifting. Signing, HTTP, the SQS and SNS protocols and batching.
  • Full batches, overlapping. Messages are received ten at a time, the next batch prefetched.
  • Acks don't block handlers. Deletes are batched in the background while the next message runs.
  • Little Python per message. Only your codecs, routing and handlers run on the event loop.
  • Lean defaults. Small messages, no redundant checksums, no tracing work unless enabled.

Benchmarks and how to run them: Performance.

Real AWS, emulators and the in-memory broker

fanferro runs on real AWS, on the AWS emulators MiniStack and LocalStack, and on its in-memory broker. Real AWS is the reference: probes run the same scenarios and raw API calls on each target, and the in-memory broker follows AWS wherever they found a difference, with AWS's error codes and texts.

Target Use it for How it differs from AWS
Real AWS Production It is the reference
In-memory broker (fanferro.testing.memory_client()) Tests without AWS or Docker No credentials, and other accounts' queues and topics are just missing; filter policy errors leave out the parser position SNS appends; long polls that a stopping consumer aborts end at once (MemoryBroker(orphaned_polls=True) serves them as SQS does)
MiniStack End-to-end tests without Docker Accepts many queue and SNS attributes, names and FIFO ids that AWS refuses; differs in receipt handles of earlier receives, Number values, numeric filters on String attributes, and X-Ray headers and Binary values through SNS
LocalStack End-to-end tests with Docker Accepts out-of-range queue attributes and a dead-letter queue of the other type; differs in FIFO receipt handles and duplicates, Number values, wildcard filters and presigned URL expiry

Neither emulator enforces SQS's 60 seconds between deleting a queue and creating it again or between two purges, drops SNS deliveries to queues encrypted with alias/aws/sqs as AWS does, or refuses unknown credentials. Every finding, the recorded runs and how to probe an account of your own: Parity with AWS.

Learn more

Getting started First publisher and consumer, local development
Publishing · Consuming Options, batches, FIFO, routing, concurrency, shutdown
Failure handling Retries, dead-letter queues, poison messages
Provisioning Declaring resources, failure modes, IAM permissions
Message formats · Large payloads Codecs, envelopes, claim checks
Observability Events, logging, hooks, OpenTelemetry, metrics
Patterns Transactional outbox, inbox, fan-out, versioning, ordering
Testing · Deployment In-memory broker, MiniStack, production setup
Examples Runnable examples for every feature
Reference Configuration, events, attributes, errors
Architecture How it is built and why, with decision records

Using an AI coding agent? Point it at fanferro guide (the usage guide shipped with the package) or copy skills/fanferro into your project's skills.

Contributing

See AGENTS.md (for humans and AI agents): uv sync, make check, conventional commits.

License

MIT

Metadata

Release files for fanferro 0.9.0

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

Source distribution (sdist)

Source distribution for fanferro 0.9.0
File Size Uploaded Provenance Actions
fanferro-0.9.0.tar.gz 423.0 kB With provenance Details for fanferro-0.9.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fanferro 0.9.0
File Actions
fanferro-0.9.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for fanferro-0.9.0-cp312-abi3-win_arm64.whl
fanferro-0.9.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for fanferro-0.9.0-cp312-abi3-win_amd64.whl
fanferro-0.9.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for fanferro-0.9.0-cp312-abi3-musllinux_1_2_x86_64.whl
fanferro-0.9.0-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for fanferro-0.9.0-cp312-abi3-musllinux_1_2_aarch64.whl
fanferro-0.9.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for fanferro-0.9.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
fanferro-0.9.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for fanferro-0.9.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
fanferro-0.9.0-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details for fanferro-0.9.0-cp312-abi3-macosx_11_0_x86_64.whl
fanferro-0.9.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for fanferro-0.9.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 57.0 MB

Release files / fanferro-0.9.0.tar.gz

Download URL fanferro-0.9.0.tar.gz
Size 423.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ea5d5561b689ec746c753de7d7f3b3d353bc0c00c8c2b27ed02d50842f6ac5ee
BLAKE2b-256 checksum
How to use checksums
3d4d72f1b81f6854a0fc9614cb64452cd1d6907d4590c93bef044f2db0fd84a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-win_arm64.whl

Download URL fanferro-0.9.0-cp312-abi3-win_arm64.whl
Size 7.1 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
7a3b135796f0f3b984650416925cd111f92fd6bb22112f0b0657c9228a5ee3cf
BLAKE2b-256 checksum
How to use checksums
7584a0af3f8ab3c1a7884d699db48bbdc66cbb40fd063c18d924059e80e3d99b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-win_amd64.whl

Download URL fanferro-0.9.0-cp312-abi3-win_amd64.whl
Size 7.4 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5dc0420a8aca3bfa22a35f44616aa7e526c3926e6a36b67e798637ad2a895a51
BLAKE2b-256 checksum
How to use checksums
9880647c08b68c460a03eb471033d1ea30d0d4b9930ceb1da2477a79e91e3945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL fanferro-0.9.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 7.4 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
959c550c2e7422b9ea9fb185a0384e56fe0f87bef4a9e7500e5769ec4a92c946
BLAKE2b-256 checksum
How to use checksums
d18092a4d398eca77705bb571b4ac04316a578de3be18c4ab19da8237b74e82d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL fanferro-0.9.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 7.0 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
18bb6bb30d729edd6c5b53af27cfbf1f630dfd1dd9e15240e7b49743e26ab2fa
BLAKE2b-256 checksum
How to use checksums
16af0a118515c9f64886328fb0edd61a4375b27c9ea3babdd6ca93d5fa033c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL fanferro-0.9.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 7.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
893db8d6fa7666334f672d43395cb6c347ab33e2e7a0ed0206cac220fc74b449
BLAKE2b-256 checksum
How to use checksums
bed672fca61441f422257e327bcd388cb01c52b428ed43c82f3da06f78fa3322
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL fanferro-0.9.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 7.0 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
32350e108b1d2bfc805fe8031d677711f0d121066e2cf6148cf1161f65dacdac
BLAKE2b-256 checksum
How to use checksums
601f570cb77a29d3e54532dc45d2de02d858d53da107d35ce8b39fc3d7101e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-macosx_11_0_x86_64.whl

Download URL fanferro-0.9.0-cp312-abi3-macosx_11_0_x86_64.whl
Size 7.2 MB
Tags CPython 3.12 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
cb444313260f31a6c3f4ce4d2269fdbe871554d109cdf953c035fe61e0628821
BLAKE2b-256 checksum
How to use checksums
0d276ca77a1f381a36dbe694bb2e9b46e3dfc3d121fad52c72799b71eadabd62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / fanferro-0.9.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL fanferro-0.9.0-cp312-abi3-macosx_11_0_arm64.whl
Size 6.2 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a24707ac13f5c6372f799a26ed75144201a1033f125091a99a51cc4b0f98f91d
BLAKE2b-256 checksum
How to use checksums
d3d6bfc4b8ee7307b318fc9218098a029346053ad6894a5e0ded0ccb5e317550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for fanferro 0.9.0

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 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for fanferro-0.9.0.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 Nov 1, 2026.

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.

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