Changelog
All user-visible changes are documented here.
Unreleased
Added
-
AvroSerializer,AvroDeserializer, andAsyncAvroDeserializernow acceptuse_latest_version=True. For the serializer, the flag validates that it is not combined withauto_register(they are mutually exclusive). For the deserializers, it enables dynamic reader schema resolution: the latest registry schema for the givenartifact_id(orartifact_resolver) is fetched on the first call and cached per instance. Mutually exclusive with the staticreader_schemaparameter. -
cache_max_size(default1000) andcache_ttl_seconds(defaultNone) constructor parameters on both clients.cache_max_sizecaps both caches with LRU eviction.cache_ttl_secondsenables optional TTL expiry on artifact-based lookups (get_schema,register_schema); ID-based lookups (get_schema_by_global_id,get_schema_by_content_id) are content-addressed and never expire. ApicurioRegistryClientandAsyncApicurioRegistryClientnow retry automatically on transient failures. Retries onhttpx.TransportErrorand HTTP 429/502/503/504 with exponential backoff and full jitter. Three new constructor parameters control the behaviour:max_retries(default 3),retry_backoff_ms(default 1 000 ms),retry_max_backoff_ms(default 20 000 ms). Setmax_retries=0to disable.- Both clients accept an optional
http_clientescape hatch (httpx.Client/httpx.AsyncClient). When provided the supplied client is used as-is and is not closed byclose()/aclose(). Anauthparameter is also available for httpx-compatible authentication handlers when not using the escape hatch. AvroDeserializerandAsyncAvroDeserializeraccept an optionalreader_schemaparameter (Avro schema dict, defaultNone). When provided, fastavro performs Avro schema resolution between the writer schema (embedded in the message) and the supplied reader schema, enabling schema evolution patterns: field defaults fill gaps for added fields, type promotions, and alias-based field renames. Parsed once at construction time.register_schema(artifact_id, schema, if_exists)method on bothApicurioRegistryClientandAsyncApicurioRegistryClient. Registers a schema artifact via the Apicurio Registry v3POST /groups/{groupId}/artifactsendpoint and populates the internal cache on success.AvroSerializeraccepts three new optional constructor parameters:schema(Avro schema dict),auto_register(bool, defaultFalse), andif_exists(v3ifExistspolicy). Whenauto_register=True, the first serialize call registers the schema automatically if the artifact is not found (HTTP 404).SchemaRegistrationError— new typed exception raised when the registry rejects a schema registration request (4xx/5xx response or missing JSON fields in the response body). Exported from the package root.if_existsvalues follow the Apicurio Registry v3 API:"FAIL","FIND_OR_CREATE_VERSION"(default),"CREATE_VERSION".QualifiedRecordIdStrategy— new artifact resolver strategy. Derives the artifact ID from the Avro schema's record name and namespace:"{namespace}.{name}"when namespace is present,"{name}"otherwise. Matches the ConfluentRecordNameStrategy. RaisesValueErrorat construction if the schema has no"name"field.TopicRecordIdStrategy— new artifact resolver strategy. Derives the artifact ID from the topic and the Avro schema's record name:"{topic}-{namespace}.{name}"when namespace is present,"{topic}-{name}"otherwise. Matches the ConfluentTopicRecordNameStrategy. RaisesValueErrorat construction if the schema has no"name"field.BearerAuth— authentication handler for static Bearer tokens or dynamic token providers (e.g. GCP OIDC). Pass atokenstring or a zero-argumenttoken_providercallable. Rejects empty tokens at construction.KeycloakAuth— OAuth2 client-credentials authentication against a Keycloak token endpoint. Fetches a token on first use and automatically refreshes it when less than 20% of its TTL remains. Works with both sync and async clients.AuthenticationError— new typed exception raised on authentication failures (token fetch errors, invalid responses). Exported from the package root.
0.2.0 (2026-03-11)
Client Hardening & Deduplication
This release focuses on improving robustness and maintainability through comprehensive client hardening and code deduplication.
Added
ApicurioRegistryClient— HTTP client for the Apicurio Registry v3 native API with schema caching and thread-safe access.AsyncApicurioRegistryClient— async counterpart usinghttpx.AsyncClient, safe for concurrent coroutine use.AvroSerializer— serializes Python data to Confluent-framed Avro bytes. Supports customto_dicthooks,globalId/contentIdwire format selection, strict mode, andKAFKA_HEADERSwire format.AvroDeserializer— deserializes Confluent-framed Avro bytes back to Python dicts with optionalfrom_dicthook.AsyncAvroDeserializer— async counterpart toAvroDeserializer.SerializationContextandMessageField— thin context objects compatible with confluent-kafka's interface.WireFormatenum —CONFLUENT_PAYLOADandKAFKA_HEADERSframing modes.SchemaNotFoundError,RegistryConnectionError,SerializationError,DeserializationError— typed exception hierarchy for predictable error handling.CachedSchema— frozen (immutable) dataclass holding resolved schema data and registry metadata.- Closed-client guard (
RuntimeError) on both sync and async clients to prevent use-after-close. - 32-bit schema ID validation for
CONFLUENT_PAYLOADwire format with actionable error message suggestingKAFKA_HEADERS. - Signed int64 range validation on
globalId/contentIdfrom registry response headers. - 19 Architecture Decision Records in
docs/decisions/.
Changed
- Breaking:
AvroDeserializerandAsyncAvroDeserializeruse_iddefault changed from"contentId"to"globalId"to matchAvroSerializerdefault (see ADR-006).
Internal
- Extracted
_RegistryClientBaseshared base class to deduplicate sync/async client logic (ADR-001). - Double-checked locking pattern for thread-safe cache population (ADR-004).
- Removed stale
TECHNICAL_DEBT.md.