py-avro-schema
Generate Apache Avro schemas for Python types including standard library data-classes and Pydantic data models.
What it is and what it does
py-avro-schema bridges Python's type system and Apache Avro by automatically generating Avro schemas from dataclasses and Pydantic models. It takes a Python type definition and produces a schema that can be used for serialization, deserialization, and schema validation in Avro-based systems like Kafka. The package depends on avro, orjson, typeguard, memoization, and more-itertools to handle schema generation, type checking, and performance optimization.
The tool is designed for teams using Avro for data interchange who want to define schemas in Python code rather than separately in JSON or Avro IDL. It integrates with both the standard library (dataclasses) and the popular Pydantic validation library, making it useful in data pipelines, message-driven architectures, and systems where Python types need to map cleanly to Avro's type system.
Use it for:
- Generate Avro schemas from dataclasses for Kafka producers and consumers in Python applications.
- Validate Python objects against Avro schemas during serialization and deserialization workflows.
- Define data contracts in Python code and automatically export them as Avro schemas for cross-language systems.
- Build type-safe data pipelines where Pydantic models are the source of truth for both validation and Avro schema generation.
- Integrate schema generation into CI/CD to keep Avro schemas synchronized with Python type definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates Apache Avro schemas from Python dataclasses and Pydantic models, enabling serialization and deserialization with type safety.
Yes, if you are using Avro in a Python environment and want schemas derived from your type definitions. The package is stable, has no known vulnerabilities, and installs with low friction. However, be aware that maintenance is dormant (710 days since last release); verify compatibility with your specific versions of Avro and Pydantic before committing to production use, and plan for potential maintenance gaps if you need ongoing support.
Install
py-avro-schema on PyPI
pip
pip install py-avro-schemauv
uv add py-avro-schemapoetry
poetry add py-avro-schemaInstalling py-avro-schema
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was 710 days ago—but the package is marked Production/Stable and carries no known vulnerabilities, suggesting it may be feature-complete rather than abandoned.
License in practice
Licensed under Apache License Version 2.0, a permissive open-source license. You may use, modify, and distribute the package freely provided you include the license and document changes; no restrictions on commercial use.
Quickstart
pip install py-avro-schema
from dataclasses import dataclass
from py_avro_schema import avro
@dataclass
class User:
name: str
age: int
schema = avro(User)
Requires Python 3.9 or later.
Verify before relying
- Whether dormant maintenance (710 days since last release) affects compatibility with newer Avro or Pydantic versions.
- Performance characteristics when generating schemas for deeply nested or very large dataclass hierarchies.
- Whether all Pydantic v2 features are supported, given the last release predates widespread v2 adoption.
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — avro, memoization, more-itertools, orjson, typeguard |
| Maintenance | dormant — 710 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 130,665/month — #11,632 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_avro_schema-3.8.2-py3-none-any.whl
Keywords: avro, data, dataclasses, deserialization, generate, jpmorganchase, kafka, messaging, pydantic, python, schema, serialization, types
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI
pydantic-avroConverts between pydantic class definitions and…
permissive · top 5,000 on PyPI
datamodel-code-generatorGenerates Python data models (Pydantic,…
permissive · top 5,000 on PyPI
safety-schemasProvides Pydantic models and schemas for Safety…
permissive · top 5,000 on PyPI
apischemaApischema handles JSON…
permissive · top 15,000 on PyPI
dataclasses-jsonschemaGenerates JSON Schema from Python dataclasses…
permissive · top 15,000 on PyPI
aws-glue-schema-registrySerializes and deserializes messages using AWS…
permissive · top 15,000 on PyPI
avroApache Avro is a data serialization system that…
permissive · top 5,000 on PyPI
avro-python3Serializes and deserializes data in Apache Avro…
permissive · top 5,000 on PyPI
avro-genGenerates typed Python record classes and a…
permissive · top 15,000 on PyPI