Skip to content

Ports

Foundational port definition for the ForgingBlocks.

ports

Foundational port definition for the ForgingBlocks.

Port

Bases: Protocol, Generic[InputType, OutputType]

Base protocol for defining interface contracts.

Port is a generic Protocol that serves as the foundation for interface
declarations. It provides type parameters (InputType, OutputType) and
defines no methods — it's a marker protocol that you extend to create your
own specific interfaces.

TYPE PARAMETERS:
- InputType: The type of data accepted by operations on this interface (contravariant).
- OutputType: The type of data returned by operations on this interface (covariant).

Source code in src/forging_blocks/foundation/ports.py
class Port(Protocol, Generic[InputType, OutputType]):
    """Base protocol for defining interface contracts.

    Port is a generic Protocol that serves as the foundation for interface
    declarations. It provides type parameters (InputType, OutputType) and
    defines no methods — it's a marker protocol that you extend to create your
    own specific interfaces.

    TYPE PARAMETERS:
    - `InputType`: The type of data accepted by operations on this interface (contravariant).
    - `OutputType`: The type of data returned by operations on this interface (covariant).
    """

    ...