Skip to content

crv.core.typing

Experimental API

crv.core.typing

Lightweight typing aliases used across core schemas and tables.

Provides minimal NewTypes and aliases to improve readability and static checks. This module contains no runtime logic and is zero-IO.

Notes
  • Intended for use in annotations across schemas and downstream modules.
  • Keep the surface small and stable to avoid churn in dependents.

Examples:

Use aliases in annotations.

>>> from crv.core.typing import Tick, GroupId, RoomId, JsonDict
>>> def advance(t: Tick) -> Tick:
...     return Tick(int(t) + 1)
>>> advance(Tick(10))
10
>>> def describe_room(room: RoomId) -> str:
...     return f"room:{room}"
>>> describe_room(RoomId("market"))
'room:market'
>>> def payload() -> JsonDict:
...     return {"a": 1, "b": 2}

crv.core.typing.Tick module-attribute

Tick = typing.NewType('Tick', int)

crv.core.typing.GroupId module-attribute

GroupId = typing.NewType('GroupId', str)

crv.core.typing.RoomId module-attribute

RoomId = typing.NewType('RoomId', str)

crv.core.typing.JsonDict module-attribute

JsonDict = dict[str, typing.Any]