Skip to main content

faststream-schema-registry

GitHub Actions Workflow Status codecov Python Version PyPI - Version

Middleware to integrate with the confluent schema registry for managing avro/json schemas.

Schemas are generated from python classes using dataclasses-avroschema and registered using python-schema-registry-client.

Requirements

python 3.9+

Installation

pip install faststream-schema-registry

Examples

Serialize objects using either the AvroSchemaRegistry or the JsonSchemaRegistry

AvroSchemaRegistry

from datetime import datetime

from dataclasses_avroschema.pydantic import AvroBaseModel
from faststream import FastStream
from faststream.confluent import KafkaBroker
from faststream_schema_registry.middleware import SchemaRegistryMiddleware
from faststream_schema_registry.registries import AvroSchemaRegistry

schema_registry = AvroSchemaRegistry(url="http://localhost:8081")
broker = KafkaBroker(
    "localhost:29092",
    middlewares=[
        SchemaRegistryMiddleware.make_middleware(schema_registry=schema_registry)
    ],
)

app = FastStream(broker)

# class for message object
class Message(AvroBaseModel):
    timestamp: datetime
    message_id: int
    payload: str

    class Meta:
        namespace = "com.test"

@app.after_startup
async def test():
    await broker.publish(Message.fake(), topic="messages")


@broker.subscriber("messages")
async def on_messages(msg: Message):
    print(msg)

JsonSchemaRegistry

from datetime import datetime

from dataclasses_avroschema.pydantic import AvroBaseModel
from faststream import FastStream
from faststream.confluent import KafkaBroker
from faststream_schema_registry.middleware import SchemaRegistryMiddleware
from faststream_schema_registry.registries import JsonSchemaRegistry

schema_registry = JsonSchemaRegistry(url="http://localhost:8081")
broker = KafkaBroker(
    "localhost:29092",
    middlewares=[
        SchemaRegistryMiddleware.make_middleware(schema_registry=schema_registry)
    ],
)
...

Metadata

Release files for faststream-schema-registry 0.1.1

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

Source distribution (sdist)

Source distribution for faststream-schema-registry 0.1.1
File Size Uploaded Provenance Actions
faststream_schema_registry-0.1.1.tar.gz 7.5 kB With provenance Details for faststream_schema_registry-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for faststream-schema-registry 0.1.1
File Interpreter ABI Platform Actions
faststream_schema_registry-0.1.1-py3-none-any.whl Python 3 none any Details for faststream_schema_registry-0.1.1-py3-none-any.whl

Total release size: 16.1 kB

Release files / faststream_schema_registry-0.1.1.tar.gz

Download URL faststream_schema_registry-0.1.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
223a354c06ef8df67449dc617f0b8f4728536c9dc5fcd69d9e4757b9444a84b7
BLAKE2b-256 checksum
How to use checksums
328076eaef2d59aa8f5d0c2b20192b0aea348254a4b458b899590f7deb3b10f7
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 Mar 10, 2025.

Transparency log

Release files / faststream_schema_registry-0.1.1-py3-none-any.whl

Download URL faststream_schema_registry-0.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5569e932e73f3d1cab2110d0ffcc8cc5b6377909ba46e5af72728286e4a5f00
BLAKE2b-256 checksum
How to use checksums
5ffb8aa699585d08d7ad1f4461d840a64faf6e30a9e6f92c2d2a2712265931d5
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 Mar 10, 2025.

Transparency log

Security for faststream-schema-registry 0.1.1

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 faststream_schema_registry-0.1.1.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 Mar 10, 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.

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