Core
Generated from the type stubs and docstrings. Do not edit by hand.
AvroRegistrySerde
Section titled “AvroRegistrySerde”Avro serde with Confluent Schema Registry integration.
Wire format: [0x00 magic][schema_id: 4 bytes BE][avro payload]
Schema registration is lazy - happens on first serialize() call. Reader schemas are fetched from the registry on first deserialize() per schema ID and cached in memory for the lifetime of this serde.
TLS/mTLS: pass ca_path to trust a custom CA, or cert_path + key_path for mutual TLS (client certificate authentication). Both cert_path and key_path must be set together. TLS args apply only when registry_url is https://.
Encrypted (password-protected) private keys are not supported - key_path must point to an unencrypted PEM. (No equivalent to confluent’s ssl.key.password.)
Usage: serde = AvroRegistrySerde.for_topic(“http://localhost:8081”, “my-topic”, SCHEMA_JSON) result = serde.serialize({“id”: 1, “name”: “alice”}) # registers + framing
serde2 = AvroRegistrySerde("http://localhost:8081", "my-topic-value", SCHEMA_JSON)
# With custom CA + client cert (mTLS):serde3 = AvroRegistrySerde( "https://registry.example.com", "my-topic-value", SCHEMA_JSON, username="user", password="pass", ca_path="/path/to/ca.pem", cert_path="/path/to/client.pem", key_path="/path/to/client-key.pem",)for_topic
Section titled “for_topic”for_topic(registry_url: str, topic: str, schema: str, is_key: bool = False, username: Optional[str] = None, password: Optional[str] = None, ca_path: Optional[str] = None, cert_path: Optional[str] = None, key_path: Optional[str] = None) -> AvroRegistrySerderegister
Section titled “register”register(self) -> Ok[int] | Err[SerdeError]subject
Section titled “subject”subject(self) -> strserialize
Section titled “serialize”serialize(self, obj: Any) -> Ok[bytes] | Err[SerdeError]deserialize
Section titled “deserialize”deserialize(self, data: bytes) -> Ok[Any] | Err[SerdeError]serialize_many
Section titled “serialize_many”serialize_many(self, items: Iterable[Any]) -> IListserialize_many_bytes
Section titled “serialize_many_bytes”serialize_many_bytes(self, items: Iterable[Any]) -> BytesListdeserialize_many
Section titled “deserialize_many”deserialize_many(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_objects
Section titled “deserialize_many_objects”deserialize_many_objects(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_from_packed
Section titled “deserialize_many_from_packed”deserialize_many_from_packed(self, packed: bytes, count: int) -> IListcheck_compatibility
Section titled “check_compatibility”check_compatibility(self, schema: str, version: Optional[str] = None) -> Ok[bool] | Err[SerdeError]list_versions
Section titled “list_versions”list_versions(self) -> Ok[list[int]] | Err[SerdeError]get_schema_by_version
Section titled “get_schema_by_version”get_schema_by_version(self, version: int) -> Ok[str] | Err[SerdeError]delete_version
Section titled “delete_version”delete_version(self, version: int) -> Ok[bool] | Err[SerdeError]AvroSerde
Section titled “AvroSerde”serialize
Section titled “serialize”serialize(self, obj: Any) -> Ok[bytes] | Err[SerdeError]deserialize
Section titled “deserialize”deserialize(self, data: bytes) -> Ok[Any] | Err[SerdeError]serialize_many
Section titled “serialize_many”serialize_many(self, items: Iterable[Any]) -> IListserialize_many_bytes
Section titled “serialize_many_bytes”serialize_many_bytes(self, items: Iterable[Any]) -> BytesListdeserialize_many
Section titled “deserialize_many”deserialize_many(self, bytes_list: Iterable[bytes] | BytesList) -> IListBytesList
Section titled “BytesList”empty(cls) -> BytesListfrom_packed
Section titled “from_packed”from_packed(buf: bytes, count: int) -> BytesListget(self, index: int) -> Some[bytes] | _Nothingappend
Section titled “append”append(self, item: bytes) -> BytesListto_list
Section titled “to_list”to_list(self) -> list[bytes]to_packed
Section titled “to_packed”to_packed(self) -> bytesto_ilist
Section titled “to_ilist”to_ilist(self) -> IList[bytes]length
Section titled “length”length(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolDecodeFailure
Section titled “DecodeFailure”A single per-row decode failure - the dead-letter story.
index is the input index; raw is the original payload bytes, ready to
route straight to a DLQ without re-serialization.
Fields:
index: intmessage: strraw: bytes
DeserializationError
Section titled “DeserializationError”Duration
Section titled “Duration”A typed time-span value backed by an i64 nanosecond count.
Mirrors Scala’s FiniteDuration - a precise, immutable quantity of time
with unit-converting constructors and full arithmetic support.
nanos(n: int) -> Durationmicros
Section titled “micros”micros(n: int) -> Durationmillis
Section titled “millis”millis(n: int) -> Durationseconds
Section titled “seconds”seconds(n: float) -> Durationminutes
Section titled “minutes”minutes(n: float) -> Durationhours(n: float) -> Durationdays(n: float) -> Durationfrom_timedelta
Section titled “from_timedelta”from_timedelta(td: Any) -> Durationto_nanos
Section titled “to_nanos”to_nanos(self) -> intto_millis
Section titled “to_millis”to_millis(self) -> intto_seconds
Section titled “to_seconds”to_seconds(self) -> floatto_timedelta
Section titled “to_timedelta”to_timedelta(self) -> AnyEither
Section titled “Either”A value (Ok) or an error (Err). Subclassed by Ok and Err, the same
way Scala’s Either is by Right/Left, so Either[A, E] is a real generic
and isinstance(x, Either) holds for both. Abstract: build values through the
factories below (or Ok/Err directly), not Either(...).
ok(value: T) -> Ok[T]err(error: E) -> Err[E]try_of
Section titled “try_of”try_of(f: Callable[[], T]) -> Either[T, Exception]cond(condition: bool, ok: T, err: E) -> Either[T, E]sequence
Section titled “sequence”sequence(values: Iterable[Either[T, E]]) -> Either[list[T], E]map(self, f: Callable[..., Any]) -> Either[Any, E]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Either[Any, E]map_err
Section titled “map_err”map_err(self, f: Callable[..., Any]) -> Either[T, Any]recover
Section titled “recover”recover(self, f: Callable[[E], Any]) -> Either[Any, Any]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[E], Either[Any, Any]]) -> Either[Any, Any]or_else
Section titled “or_else”or_else(self, alt: Either[Any, Any] | Callable[[], Either[Any, Any]]) -> Either[Any, Any]fold(self, err: Callable[..., Any], ok: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Anyunwrap_or_raise
Section titled “unwrap_or_raise”unwrap_or_raise(self, exc: Any = None) -> Anyto_option
Section titled “to_option”to_option(self) -> Option[T]is_ok(self) -> boolis_err
Section titled “is_err”is_err(self) -> boolFields:
error: E
map(self, f: Callable[..., Any]) -> Err[E]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Err[E]recover
Section titled “recover”recover(self, f: Callable[[E], Any]) -> Either[Any, Any]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[E], Either[Any, Any]]) -> Either[Any, Any]map_err
Section titled “map_err”map_err(self, f: Callable[..., Any]) -> Err[Any]or_else
Section titled “or_else”or_else(self, alt: Either[Any, Any] | Callable[[], Either[Any, Any]]) -> Either[Any, Any]fold(self, err: Callable[..., Any], ok: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Anyunwrap_or_raise
Section titled “unwrap_or_raise”unwrap_or_raise(self, exc: Any = None) -> Anyto_option
Section titled “to_option”to_option(self) -> _Nothingis_ok(self) -> boolis_err
Section titled “is_err”is_err(self) -> boolFailure
Section titled “Failure”Fields:
error: BaseException
map(self, f: Callable[..., Any]) -> Failureflat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Failurerecover
Section titled “recover”recover(self, f: Callable[[Any], Any]) -> Try[Any]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[Any], Try[Any]]) -> Try[Any]or_else
Section titled “or_else”or_else(self, alt: Try[Any] | Callable[[], Try[Any]]) -> Try[Any]fold(self, failure: Callable[..., Any], success: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Anyto_either
Section titled “to_either”to_either(self) -> Err[Any]is_success
Section titled “is_success”is_success(self) -> boolis_failure
Section titled “is_failure”is_failure(self) -> boolFloatList
Section titled “FloatList”empty(cls) -> FloatListmap_float
Section titled “map_float”map_float(self, f: Callable[[float], float]) -> FloatListfilter
Section titled “filter”filter(self, pred: Callable[[float], bool]) -> FloatListfold_left
Section titled “fold_left”fold_left(self, initial: Any, f: Callable[..., Any]) -> Anyadd_scalar
Section titled “add_scalar”add_scalar(self, n: float) -> FloatListsub_scalar
Section titled “sub_scalar”sub_scalar(self, n: float) -> FloatListmul_scalar
Section titled “mul_scalar”mul_scalar(self, n: float) -> FloatListdiv_scalar
Section titled “div_scalar”div_scalar(self, n: float) -> FloatListabs_vals
Section titled “abs_vals”abs_vals(self) -> FloatListclamp_vals
Section titled “clamp_vals”clamp_vals(self, lo: float, hi: float) -> FloatListzip_add
Section titled “zip_add”zip_add(self, other: FloatList) -> FloatListzip_mul
Section titled “zip_mul”zip_mul(self, other: FloatList) -> FloatListsum(self) -> floatmin(self) -> floatmax(self) -> floatmean(self) -> floatstd_dev
Section titled “std_dev”std_dev(self) -> floatto_list
Section titled “to_list”to_list(self) -> list[float]to_ilist
Section titled “to_ilist”to_ilist(self) -> IList[float]length
Section titled “length”length(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolempty(cls) -> IList[Any]map(self, f: Callable[..., Any]) -> IList[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> IList[Any]filter
Section titled “filter”filter(self, pred: Callable[..., bool]) -> IList[T]fold_left
Section titled “fold_left”fold_left(self, initial: Any, f: Callable[..., Any]) -> Anyhead(self) -> Some[T] | _Nothinglast(self) -> Some[T] | _Nothingtail(self) -> IList[T]find(self, pred: Callable[..., bool]) -> Some[T] | _Nothingtake(self, n: int) -> IList[T]drop(self, n: int) -> IList[T]distinct
Section titled “distinct”distinct(self) -> IList[T]zip(self, other: IList[Any]) -> IList[tuple[T, Any]]append
Section titled “append”append(self, item: T) -> IList[T]prepend
Section titled “prepend”prepend(self, item: T) -> IList[T]concat
Section titled “concat”concat(self, other: IList[T]) -> IList[T]to_list
Section titled “to_list”to_list(self) -> list[T]collect_ok
Section titled “collect_ok”collect_ok(self) -> IList[Any]collect_err
Section titled “collect_err”collect_err(self) -> IList[Any]partition_either
Section titled “partition_either”partition_either(self) -> tuple[IList[Any], IList[Any]]length
Section titled “length”length(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolempty(cls) -> IMap[Any, Any]get(self, key: K) -> Some[V] | _Nothingset(self, key: K, value: V) -> IMap[K, V]remove
Section titled “remove”remove(self, key: K) -> IMap[K, V]contains
Section titled “contains”contains(self, key: K) -> boolto_dict
Section titled “to_dict”to_dict(self) -> dictkeys(self) -> IList[K]values
Section titled “values”values(self) -> IList[V]items(self) -> IList[tuple[K, V]]map_values
Section titled “map_values”map_values(self, f: Callable[[V], Any]) -> IMap[K, Any]filter_values
Section titled “filter_values”filter_values(self, pred: Callable[[V], bool]) -> IMap[K, V]merge(self, other: IMap[K, V]) -> IMap[K, V]length
Section titled “length”length(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolempty(cls) -> ISet[Any]add(self, item: T) -> ISet[T]remove
Section titled “remove”remove(self, item: T) -> ISet[T]contains
Section titled “contains”contains(self, item: T) -> boolunion(self, other: ISet[T]) -> ISet[T]intersection
Section titled “intersection”intersection(self, other: ISet[T]) -> ISet[T]difference
Section titled “difference”difference(self, other: ISet[T]) -> ISet[T]is_subset_of
Section titled “is_subset_of”is_subset_of(self, other: ISet[T]) -> boolmap(self, f: Callable[[T], Any]) -> ISet[Any]filter
Section titled “filter”filter(self, pred: Callable[[T], bool]) -> ISet[T]to_set
Section titled “to_set”to_set(self) -> set[T]to_ilist
Section titled “to_ilist”to_ilist(self) -> IList[T]size(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolIntList
Section titled “IntList”empty(cls) -> IntListmap_int
Section titled “map_int”map_int(self, f: Callable[[int], int]) -> IntListfilter
Section titled “filter”filter(self, pred: Callable[[int], bool]) -> IntListfold_left
Section titled “fold_left”fold_left(self, initial: Any, f: Callable[..., Any]) -> Anyadd_scalar
Section titled “add_scalar”add_scalar(self, n: int) -> IntListsub_scalar
Section titled “sub_scalar”sub_scalar(self, n: int) -> IntListmul_scalar
Section titled “mul_scalar”mul_scalar(self, n: int) -> IntListdiv_scalar
Section titled “div_scalar”div_scalar(self, n: int) -> IntListabs_vals
Section titled “abs_vals”abs_vals(self) -> IntListclamp_vals
Section titled “clamp_vals”clamp_vals(self, lo: int, hi: int) -> IntListzip_add
Section titled “zip_add”zip_add(self, other: IntList) -> IntListzip_mul
Section titled “zip_mul”zip_mul(self, other: IntList) -> IntListsum(self) -> intmin(self) -> intmax(self) -> intmean(self) -> floatstd_dev
Section titled “std_dev”std_dev(self) -> floatto_list
Section titled “to_list”to_list(self) -> list[int]to_ilist
Section titled “to_ilist”to_ilist(self) -> IList[int]length
Section titled “length”length(self) -> intis_empty
Section titled “is_empty”is_empty(self) -> boolIntSet
Section titled “IntSet”empty(cls) -> IntSetadd(self, value: int) -> IntSetremove
Section titled “remove”remove(self, value: int) -> IntSetcontains
Section titled “contains”contains(self, value: int) -> boolunion(self, other: IntSet) -> IntSetintersection
Section titled “intersection”intersection(self, other: IntSet) -> IntSetdifference
Section titled “difference”difference(self, other: IntSet) -> IntSetsymmetric_difference
Section titled “symmetric_difference”symmetric_difference(self, other: IntSet) -> IntSetis_subset
Section titled “is_subset”is_subset(self, other: IntSet) -> boolis_disjoint
Section titled “is_disjoint”is_disjoint(self, other: IntSet) -> boolcardinality
Section titled “cardinality”cardinality(self) -> intto_list
Section titled “to_list”to_list(self) -> list[int]to_bytes
Section titled “to_bytes”to_bytes(self) -> bytesfrom_bytes
Section titled “from_bytes”from_bytes(data: bytes) -> IntSetis_empty
Section titled “is_empty”is_empty(self) -> boolInvalid
Section titled “Invalid”Fields:
errors: list[E]
JsonSchemaRegistrySerde
Section titled “JsonSchemaRegistrySerde”JSON Schema serde with Confluent Schema Registry integration.
Wire format: [0x00 magic][schema_id: 4 bytes BE][json payload]
Same magic byte as Avro; content is JSON. NOTE: payloads are NOT validated against the JSON Schema - this serde provides Confluent wire framing ([0x00][schema_id:4B BE][json]) and registry registration only. (confluent’s JSONSerializer validates; pyrula does not yet.)
for_topic
Section titled “for_topic”for_topic(registry_url: str, topic: str, schema: str, is_key: bool = False, username: Optional[str] = None, password: Optional[str] = None, ca_path: Optional[str] = None, cert_path: Optional[str] = None, key_path: Optional[str] = None) -> JsonSchemaRegistrySerderegister
Section titled “register”register(self) -> Ok[int] | Err[SerdeError]subject
Section titled “subject”subject(self) -> strserialize
Section titled “serialize”serialize(self, obj: Any) -> Ok[bytes] | Err[SerdeError]deserialize
Section titled “deserialize”deserialize(self, data: bytes) -> Ok[Any] | Err[SerdeError]serialize_many
Section titled “serialize_many”serialize_many(self, items: Iterable[Any]) -> IListserialize_many_bytes
Section titled “serialize_many_bytes”serialize_many_bytes(self, items: Iterable[Any]) -> BytesListdeserialize_many
Section titled “deserialize_many”deserialize_many(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_objects
Section titled “deserialize_many_objects”deserialize_many_objects(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_from_packed
Section titled “deserialize_many_from_packed”deserialize_many_from_packed(self, packed: bytes, count: int) -> IListcheck_compatibility
Section titled “check_compatibility”check_compatibility(self, schema: str, version: Optional[str] = None) -> Ok[bool] | Err[SerdeError]list_versions
Section titled “list_versions”list_versions(self) -> Ok[list[int]] | Err[SerdeError]get_schema_by_version
Section titled “get_schema_by_version”get_schema_by_version(self, version: int) -> Ok[str] | Err[SerdeError]delete_version
Section titled “delete_version”delete_version(self, version: int) -> Ok[bool] | Err[SerdeError]JsonSerde
Section titled “JsonSerde”serialize
Section titled “serialize”serialize(self, obj: Any) -> Ok[bytes] | Err[SerdeError]deserialize
Section titled “deserialize”deserialize(self, data: bytes) -> Ok[Any] | Err[SerdeError]serialize_many
Section titled “serialize_many”serialize_many(self, items: Iterable[Any]) -> IListserialize_many_raw
Section titled “serialize_many_raw”serialize_many_raw(self, items: Iterable[Any]) -> BytesListdeserialize_many
Section titled “deserialize_many”deserialize_many(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_raw
Section titled “deserialize_many_raw”deserialize_many_raw(self, bytes_list: Iterable[bytes] | BytesList) -> IListNonEmptyList
Section titled “NonEmptyList”A list with at least one element.
head, last, and reduce are total - they return T, not Option[T],
because the non-empty invariant is enforced at construction time.
from_list is the safe boundary: it returns Option[NonEmptyList[T]].
of(head: T, *tail: T) -> NonEmptyList[T]from_list
Section titled “from_list”from_list(items: IList[T] | list[T]) -> Option[NonEmptyList[T]]head(self) -> Ttail(self) -> IList[T]last(self) -> Tmap(self, f: Callable[[T], Any]) -> NonEmptyList[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[[T], NonEmptyList[Any]]) -> NonEmptyList[Any]reduce
Section titled “reduce”reduce(self, f: Callable[[T, T], T]) -> Tfold_left
Section titled “fold_left”fold_left(self, init: Any, f: Callable[[Any, T], Any]) -> Anyappend
Section titled “append”append(self, item: T) -> NonEmptyList[T]prepend
Section titled “prepend”prepend(self, item: T) -> NonEmptyList[T]to_ilist
Section titled “to_ilist”to_ilist(self) -> IList[T]to_list
Section titled “to_list”to_list(self) -> list[T]length
Section titled “length”length(self) -> intFields:
value: T
map(self, f: Callable[..., Any]) -> Ok[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Anymap_err
Section titled “map_err”map_err(self, f: Callable[..., Any]) -> Ok[T]recover
Section titled “recover”recover(self, f: Callable[[Any], Any]) -> Ok[T]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[Any], Either[Any, Any]]) -> Ok[T]or_else
Section titled “or_else”or_else(self, alt: Either[Any, Any] | Callable[[], Either[Any, Any]]) -> Ok[T]fold(self, err: Callable[..., Any], ok: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Tunwrap_or_raise
Section titled “unwrap_or_raise”unwrap_or_raise(self, exc: Any = None) -> Tto_option
Section titled “to_option”to_option(self) -> Some[T]is_ok(self) -> boolis_err
Section titled “is_err”is_err(self) -> boolOption
Section titled “Option”Some(value) or Nothing; subclassed by both like Scala’s Option.
of(value: Optional[T]) -> Option[T]when(condition: bool, value: T) -> Option[T]from_callable
Section titled “from_callable”from_callable(f: Callable[[], T]) -> Option[T]sequence
Section titled “sequence”sequence(values: Iterable[Option[T]]) -> Option[list[T]]map(self, f: Callable[..., Any]) -> Option[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Option[Any]filter
Section titled “filter”filter(self, pred: Callable[..., bool]) -> Option[T]get_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Anyor_else
Section titled “or_else”or_else(self, alt: Option[Any] | Callable[[], Option[Any]]) -> Option[Any]fold(self, nothing_val: Any, some_fn: Callable[..., Any]) -> Anyto_either
Section titled “to_either”to_either(self, left: Any) -> Either[T, Any]to_list
Section titled “to_list”to_list(self) -> IList[T]is_some
Section titled “is_some”is_some(self) -> boolis_nothing
Section titled “is_nothing”is_nothing(self) -> boolis_empty
Section titled “is_empty”is_empty(self) -> boolProtobufRegistrySerde
Section titled “ProtobufRegistrySerde”Protobuf serde with Confluent Schema Registry integration.
Wire format: [0x00 magic][schema_id: 4 bytes BE][msg-index zigzag varint array][protobuf payload]
Accepts a serialized FileDescriptorSet and a fully-qualified message name.
Deserialization decodes to Python dicts using prost-reflect; no compiled
message types needed. Registration requires proto_source (the .proto
source text) so the Confluent SR can parse and validate the schema.
LIMITATION: the Confluent message-index is always written as [0] (first message). Only correct when message_name is the first top-level message in the descriptor; multi-message / nested .proto files will not interoperate with Confluent consumers that rely on the message index. (Tracked: K10 follow-up C3a.)
NOTE: proto3 implicit-presence scalar fields at their default (0, "", false)
are omitted on deserialize - absent from the returned dict (standard protobuf
semantics). Use optional fields if presence must be preserved.
NOTE: enum fields accept the enum value name (str) or number (int) on serialize; deserialize returns the number (int).
for_topic
Section titled “for_topic”for_topic(registry_url: str, topic: str, file_descriptor_set: bytes, message_name: str, is_key: bool = False, proto_source: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, ca_path: Optional[str] = None, cert_path: Optional[str] = None, key_path: Optional[str] = None) -> ProtobufRegistrySerderegister
Section titled “register”register(self) -> Ok[int] | Err[SerdeError]subject
Section titled “subject”subject(self) -> strserialize
Section titled “serialize”serialize(self, obj: Any) -> Ok[bytes] | Err[SerdeError]serialize_with_id
Section titled “serialize_with_id”serialize_with_id(self, obj: Any, schema_id: int) -> Ok[bytes] | Err[SerdeError]deserialize
Section titled “deserialize”deserialize(self, data: bytes) -> Ok[Any] | Err[SerdeError]serialize_many
Section titled “serialize_many”serialize_many(self, items: Iterable[Any]) -> IListserialize_many_bytes
Section titled “serialize_many_bytes”serialize_many_bytes(self, items: Iterable[Any]) -> BytesListdeserialize_many
Section titled “deserialize_many”deserialize_many(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_objects
Section titled “deserialize_many_objects”deserialize_many_objects(self, bytes_list: Iterable[bytes] | BytesList) -> IListdeserialize_many_from_packed
Section titled “deserialize_many_from_packed”deserialize_many_from_packed(self, packed: bytes, count: int) -> IListcheck_compatibility
Section titled “check_compatibility”check_compatibility(self, proto_source: str, version: Optional[str] = None) -> Ok[bool] | Err[SerdeError]list_versions
Section titled “list_versions”list_versions(self) -> Ok[list[int]] | Err[SerdeError]get_schema_by_version
Section titled “get_schema_by_version”get_schema_by_version(self, version: int) -> Ok[str] | Err[SerdeError]delete_version
Section titled “delete_version”delete_version(self, version: int) -> Ok[bool] | Err[SerdeError]Record
Section titled “Record”A lazy view of one row in a :class:RecordList.
Field access materializes exactly one value - attribute for ergonomics
(rec.price), subscript for certainty (rec["price"] reaches fields that
collide with method names or are non-identifiers). to_instance rebuilds
the whole originating object.
to_instance
Section titled “to_instance”to_instance(self) -> AnyRecordList
Section titled “RecordList”Immutable columnar batch of typed records (struct-of-arrays).
Records live in Rust; fields become Python objects only when a callable
touches one. Built by RecordSchema.deserialize_many (JSON) or
RecordList.from_instances (Python objects).
Fields:
schema: RecordSchema
from_instances
Section titled “from_instances”from_instances(first: Any, second: Any = ...) -> RecordListconcat
Section titled “concat”concat(lists: Any) -> RecordListfrom_arrow
Section titled “from_arrow”from_arrow(obj: Any, tp: Any = ...) -> RecordListfrom_csv
Section titled “from_csv”from_csv(data: bytes | str, tp: Any, delimiter: str = ..., quote: str = ..., header: bool | list[str] = ...) -> RecordListmap(self, fn: Any) -> Anyfilter
Section titled “filter”filter(self, fn: Any) -> RecordListfold(self, field_or_fn: Any, monoid: Any) -> Anyserialize_many
Section titled “serialize_many”serialize_many(self) -> BytesListcolumn
Section titled “column”column(self, name: str) -> Anyto_ilist
Section titled “to_ilist”to_ilist(self) -> IList[Record]to_instances
Section titled “to_instances”to_instances(self) -> list[Any]to_scalars
Section titled “to_scalars”to_scalars(self) -> list[Any]to_arrow
Section titled “to_arrow”to_arrow(self, json_as_string: bool = ...) -> ArrowTableRecordSchema
Section titled “RecordSchema”Ordered typed fields for a columnar record batch.
Build from a Python type via schema_for (binds the type for
to_instance), or hand-build recursive schemas with of.
Fields:
fields: list[tuple[str, str, bool]]
of(fields: list[tuple]) -> RecordSchemahas_default
Section titled “has_default”has_default(self, name: str) -> booldeserialize_many
Section titled “deserialize_many”deserialize_many(self, data: Any) -> Ok[RecordList] | Err[DeserializationError]deserialize_many_partial
Section titled “deserialize_many_partial”deserialize_many_partial(self, data: Any) -> tuple[RecordList, IList[DecodeFailure]]deserialize_csv_many
Section titled “deserialize_csv_many”deserialize_csv_many(self, lines: Any, delimiter: str = ..., quote: str = ..., header: bool | list[str] = ...) -> Ok[RecordList] | Err[DeserializationError]deserialize_csv_many_partial
Section titled “deserialize_csv_many_partial”deserialize_csv_many_partial(self, lines: Any, delimiter: str = ..., quote: str = ..., header: bool | list[str] = ...) -> tuple[RecordList, IList[DecodeFailure]]SerdeError
Section titled “SerdeError”SerializationError
Section titled “SerializationError”Fields:
value: T
map(self, f: Callable[..., Any]) -> Some[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Anyfilter
Section titled “filter”filter(self, pred: Callable[..., bool]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Tor_else
Section titled “or_else”or_else(self, alt: Option[Any] | Callable[[], Option[Any]]) -> Some[T]fold(self, nothing_val: Any, some_fn: Callable[..., Any]) -> Anyto_either
Section titled “to_either”to_either(self, left: Any) -> Ok[T]to_list
Section titled “to_list”to_list(self) -> IList[T]is_some
Section titled “is_some”is_some(self) -> boolis_nothing
Section titled “is_nothing”is_nothing(self) -> boolis_empty
Section titled “is_empty”is_empty(self) -> boolSuccess
Section titled “Success”Fields:
value: T
map(self, f: Callable[..., Any]) -> Anyflat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Anyrecover
Section titled “recover”recover(self, f: Callable[[Any], Any]) -> Success[T]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[Any], Try[Any]]) -> Success[T]or_else
Section titled “or_else”or_else(self, alt: Try[Any] | Callable[[], Try[Any]]) -> Success[T]fold(self, failure: Callable[..., Any], success: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Tto_either
Section titled “to_either”to_either(self) -> Ok[T]is_success
Section titled “is_success”is_success(self) -> boolis_failure
Section titled “is_failure”is_failure(self) -> boolSuccess(value) or Failure(exc); subclassed by both like Scala’s Try.
apply(f: Callable[[], T]) -> Try[T]of(f: Callable[[], T]) -> Try[T]sequence
Section titled “sequence”sequence(values: Iterable[Try[T]]) -> Try[list[T]]map(self, f: Callable[..., Any]) -> Try[Any]flat_map
Section titled “flat_map”flat_map(self, f: Callable[..., Any]) -> Try[Any]recover
Section titled “recover”recover(self, f: Callable[[Any], Any]) -> Try[Any]recover_with
Section titled “recover_with”recover_with(self, f: Callable[[Any], Try[Any]]) -> Try[Any]or_else
Section titled “or_else”or_else(self, alt: Try[Any] | Callable[[], Try[Any]]) -> Try[Any]fold(self, failure: Callable[..., Any], success: Callable[..., Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: Any) -> Anyto_either
Section titled “to_either”to_either(self) -> Either[T, Any]is_success
Section titled “is_success”is_success(self) -> boolis_failure
Section titled “is_failure”is_failure(self) -> boolFields:
value: T
Validated
Section titled “Validated”Like Either, but zip accumulates errors instead of short-circuiting.
valid(value: T) -> Validated[T, E]invalid
Section titled “invalid”invalid(error: E) -> Validated[T, E]from_either
Section titled “from_either”from_either(either: Either[T, E]) -> Validated[T, E]cond(condition: bool, value: T, error: E) -> Validated[T, E]map(self, f: Callable[[T], Any]) -> Validated[Any, E]map_err
Section titled “map_err”map_err(self, f: Callable[[list[E]], Any]) -> Validated[T, Any]zip(self, other: Validated[Any, E]) -> Validated[Any, E]fold(self, invalid: Callable[[list[E]], Any], valid: Callable[[T], Any]) -> Anyget_or_else
Section titled “get_or_else”get_or_else(self, default: T) -> Tto_either
Section titled “to_either”to_either(self) -> Either[T, list[E]]is_valid
Section titled “is_valid”is_valid(self) -> boolis_invalid
Section titled “is_invalid”is_invalid(self) -> boolConstants
Section titled “Constants”Nothing: _Nothing = nothing()
Functions
Section titled “Functions”case(cls: type[T]) -> type[T]do(func: Callable[..., Any]) -> Callable[..., Any]do_async
Section titled “do_async”do_async(func: Callable[..., Any]) -> Callable[..., Any]flow(*funcs: Callable[..., Any]) -> Callable[..., Any]match(value: Any) -> Callable[..., Any]newtype
Section titled “newtype”newtype(name: str, base_type: type[T]) -> type[T]newtype_strict
Section titled “newtype_strict”newtype_strict(name: str, base_type: type[T], validate: Optional[Callable[..., bool]] = None, err_msg: Optional[str] = None) -> type[T]on(typ: type[T], handler: Callable[..., Any]) -> Anypartial
Section titled “partial”partial(f: Callable[..., Any], *args: Any, **kwargs: Any) -> Callable[..., Any]pipe(value: Any, *funcs: Callable[..., Any]) -> Anyschema_for
Section titled “schema_for”schema_for(tp: type) -> RecordSchemaDerive a :class:RecordSchema from a dataclass, pydantic v2 model,
TypedDict, or NamedTuple.
The result is cached per type (schema_for(T) is schema_for(T)) and binds
the originating type onto the schema so Record.to_instance can rebuild it.
See the module docstring for the full set of supported/rejected annotation
forms; unsupported types raise :class:SchemaResolutionError (a
TypeError).
sealed
Section titled “sealed”sealed(cls: type[T]) -> type[T]