gds.blocks¶
Base¶
Bases: Tagged, ABC
Abstract base for all Blocks — both atomic and composite.
Every block has a name and an interface describing its boundary
ports. Composition operators (>>, |, .feedback(), .loop())
build composite blocks from simpler ones.
Source code in packages/gds-framework/gds/blocks/base.py
flatten()
abstractmethod
¶
__rshift__(other)
¶
a >> b — stack (sequential) composition.
Source code in packages/gds-framework/gds/blocks/base.py
__or__(other)
¶
a | b — parallel composition.
Source code in packages/gds-framework/gds/blocks/base.py
feedback(wiring)
¶
Wrap with backward feedback within a single evaluation.
Source code in packages/gds-framework/gds/blocks/base.py
loop(wiring, exit_condition='')
¶
Wrap with structural recurrence across temporal boundaries.
Source code in packages/gds-framework/gds/blocks/base.py
Bases: Block
Base class for non-decomposable (leaf) blocks.
Domain packages subclass this to define their own atomic block types.
Source code in packages/gds-framework/gds/blocks/base.py
Composition¶
Bases: Block
a >> b — stack (sequential) composition.
Output of the first block feeds input of the second. If no explicit
wiring is provided, the validator checks that forward_out tokens
overlap with forward_in tokens.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
a | b — parallel composition: blocks run independently.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
Backward feedback within a single evaluation (backward_out -> backward_in).
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
Structural recurrence across temporal boundaries (forward_out -> forward_in).
All temporal wiring must be covariant direction.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: BaseModel
An explicit connection between two blocks.
Covariant wirings (the default) carry data forward; contravariant wirings carry feedback backward.
Source code in packages/gds-framework/gds/blocks/composition.py
Roles¶
Bases: AtomicBlock
Exogenous signal — enters the system from outside.
In GDS terms: part of the exogenous signal space Z. Boundary actions model external agents, oracles, user inputs, environmental signals — anything the system doesn't control.
Enforces forward_in = () since boundary actions receive no
internal forward signals.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
Decision logic — maps signals to mechanism inputs.
Policies select from feasible actions. Named options support scenario analysis and A/B testing.
In GDS terms: policies implement the decision mapping d = g(x, z) within the canonical form h = f ∘ g.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
Output observable — maps state and decisions to observable output.
In GDS terms: the output map y = C(x, d). From the plant (inside) perspective, this is the system's observable output. From the controller (outside) perspective at a >> composition boundary, this output becomes a control action on the next system.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
State update — the only block type that writes to state.
Mechanisms are the atomic state transitions that compose into h. They have no backward ports (state writes don't propagate signals).
updates lists (entity_name, variable_name) pairs specifying
which state variables this mechanism modifies.