ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

module documentation

Provide schemas operations.

Includes register_messages, annotation_messages, constraint_plan.

Class _ConstraintMessages Keep annotations with distinct messages from sharing a typing cache key.
Function _cache_plan Publish a completed plan while evicting the least recently used annotations.
Function _constraint_probes Build independent checks for the constraints in one metadata entry.
Function annotation_messages Retrieve the most recently attached local message marker.
Function constraint_plan Build and cache independent native checks for local constraints.
Function register_messages Attach and index local messages during annotation compilation.
Constant _CACHE Bounded identity cache retaining each annotation alongside its immutable plan.
Constant _CACHE_LOCK Serialize cache promotion and eviction across concurrent schema consumers.
Constant _CACHE_MAX Maximum number of retained constraint plans, including unhashable annotations.
Constant _KEYS Keys definitions used by constraint_plan.
def _cache_plan(annotation: object, plan: tuple[object, tuple]): (source)

Publish a completed plan while evicting the least recently used annotations.

Parameters
annotation:objectAnnotation whose identity identifies the completed plan.
plan:tuple[object, tuple]Unconstrained type and independent native constraint probes.
Returns
NoneNo return value.
def _constraint_probes(probe_base: object, meta: msgspec.Meta, messages: dict[str, str]) -> list[tuple[str, object, str | None]]: (source)

Build independent checks for the constraints in one metadata entry.

Parameters
probe_base:objectUnconstrained type checked by each probe.
meta:msgspec.MetaNative constraint metadata to split into individual checks.
messages:dict[str, str]Custom messages indexed by validation code.
Returns
list[tuple[str, object, str | None]]Entries of (code, annotation, custom_message).
def annotation_messages(annotation: object) -> dict[str, str]: (source)

Retrieve the most recently attached local message marker.

Parameters
annotation:objectAnnotation whose custom messages are requested.
Returns
dict[str, str]Registered messages, or an empty mapping when none exist.
def constraint_plan(annotation: object) -> tuple[object, tuple]: (source)

Build and cache independent native checks for local constraints.

Parameters
annotation:objectField or element annotation, optionally containing union branches.
Returns
tuple[object, tuple]Type without local constraints and checks of (code, annotation, custom_message) for each constraint.
def register_messages(annotation: object, messages: dict[str, str]) -> object: (source)

Attach and index local messages during annotation compilation.

Parameters
annotation:objectCompiled annotation that owns the messages.
messages:dict[str, str]Custom messages indexed by validation code.
Returns
objectAnnotation carrying distinct message metadata, or the original annotation when no messages are supplied.

Bounded identity cache retaining each annotation alongside its immutable plan.

Value
OrderedDict()
_CACHE_LOCK = (source)

Serialize cache promotion and eviction across concurrent schema consumers.

Value
RLock()
_CACHE_MAX: int = (source)

Maximum number of retained constraint plans, including unhashable annotations.

Value
1024
_KEYS: tuple[str, ...] = (source)

Keys definitions used by constraint_plan.

Value
('gt',
 'ge',
 'lt',
 'le',
 'multiple_of',
 'pattern',
 'min_length',
...