Typing¶

Reference on the State typing API. Note that docs here are for both core burr and the pydantic plugin (which does the interesting typing). For an overview, read Typing State.

class burr.core.typing.TypingSystem¶
__init__()¶
abstract construct_data(state: State[BaseType]) BaseType¶

Constructs a type based on the arguments passed in.

Parameters:

kwargs

Returns:

abstract construct_state(data: BaseType) State[BaseType]¶

Constructs a state based on the arguments passed in.

Parameters:

kwargs

Returns:

abstract state_post_action_run_type(action: Action, graph: Graph) Type[BaseType]¶

Gives the type that represents the state after an action has completed. Note that this could be smart – E.g. it should have all possible upstream types filled in.

Parameters:

action

Returns:

abstract state_pre_action_run_type(action: Action, graph: Graph) Type[BaseType]¶

Gives the type that represents the state after an action has completed. Note that this could be smart – E.g. it should have all possible upstream types filled in.

Parameters:

action

Returns:

abstract state_type() Type[BaseType]¶

Gives the type that represents the state of the application at any given time. Note that this must have adequate support for Optionals (E.G. non-required values).

Returns:

validate_state(state: State) None¶

Validates the state to ensure it is valid.

Parameters:

state

Returns:

class burr.integrations.pydantic.PydanticTypingSystem(model_type: Type[StateModel])¶

Typing system for pydantic models.

Parameters:

TypingSystem – Parameterized on the state model type.

__init__(model_type: Type[StateModel])¶
construct_data(
state: State,
) StateModel¶

Constructs a type based on the arguments passed in.

Parameters:

kwargs

Returns:

construct_state(
data: StateModel,
) State¶

Constructs a state based on the arguments passed in.

Parameters:

kwargs

Returns:

state_post_action_run_type(
action: Action,
graph: Graph,
) Type[BaseModel]¶

Gives the type that represents the state after an action has completed. Note that this could be smart – E.g. it should have all possible upstream types filled in.

Parameters:

action

Returns:

state_pre_action_run_type(
action: Action,
graph: Graph,
) Type[BaseModel]¶

Gives the type that represents the state after an action has completed. Note that this could be smart – E.g. it should have all possible upstream types filled in.

Parameters:

action

Returns:

state_type() Type[StateModel]¶

Gives the type that represents the state of the application at any given time. Note that this must have adequate support for Optionals (E.G. non-required values).

Returns: