Skip to content

Spec vocabulary

These modules provide shared types used when describing and checking a Spec. Most projects use the Python helpers in Python authoring instead.

Function returns

ReturnRole describes function return contracts. RETURN_DATAFRAME, RETURN_NONE, and RETURN_ANY provide their corresponding values.

Operator bindings

OPERATOR_BINDINGS describes the required compute binding and the optional merge binding. Dataframe counts are independent of logical feature dependencies.

Binding contracts for operator declarations.

OPERATOR_BINDINGS module-attribute

OPERATOR_BINDINGS: Final[Mapping[BindingKind, BindingContract]] = types.MappingProxyType({COMPUTE: BindingContract('Run the primary function with zero or one dataframe input.', True, (0, 1), 'dataset', 'dataset_or_fragment_or_none', 'additional'), MERGE: BindingContract('Combine a fragment with the current dataset.', False, (2,), 'dataset_and_fragment', 'dataset', 'additional')})

BindingKind

BindingKind = Literal['compute', 'merge']

PrimaryBindingKind

PrimaryBindingKind = Literal['compute']

BindingContract dataclass

Describe a binding's dataframe contract independently of logical features.

Parameters:

Name Type Description Default
description str

Purpose of the binding.

required
primary bool

Whether this binding determines the operator's primary binding role.

required
dataframe_inputs tuple[int, ...]

Allowed numbers of dataframe inputs.

required
dataframe_source DataframeSource

Origin of the dataframe inputs.

required
dataframe_result DataframeResult

How the dataframe result is used.

required
merge MergeRequirement

Whether a separate merge is required, forbidden, or additional.

required

description instance-attribute

description: str

primary instance-attribute

primary: bool

dataframe_inputs instance-attribute

dataframe_inputs: tuple[int, ...]

dataframe_source instance-attribute

dataframe_source: DataframeSource

dataframe_result instance-attribute

dataframe_result: DataframeResult

merge instance-attribute

merge: MergeRequirement