Skip to content

Signatures and annotations

Compatibility façade for Python entrypoint APIs.

Signature dataclass

Raw reflection data required to validate a Python function signature.

parameters class-attribute instance-attribute

parameters: dict[str, Parameter] = dataclasses.field(default_factory=dict)

return_annotation class-attribute instance-attribute

return_annotation: object = dataclasses.field(default=inspect.Signature.empty, repr=False)

accepts_kwargs property

accepts_kwargs: bool

Return whether the callable accepts arbitrary keyword arguments.

required_parameters property

required_parameters: dict[str, Parameter]

Return non-variadic parameters without defaults, in signature order.

display property

display: DisplaySignature

Return presentation-oriented annotation metadata.

return_annotation_name property

return_annotation_name: str | None

Return the unqualified return annotation name, if one is declared.

read classmethod

read(function: Function) -> Signature

Read the annotated argument and return types of a function.

from_callable classmethod

from_callable(function: Callable[..., Any]) -> Signature

Read the annotated argument and return types of a loaded callable.

from_signature classmethod

from_signature(signature: Signature) -> Signature

Create validation metadata from an inspected Python signature.

TypeAnnotation

Format Python type annotations for display.

name staticmethod

name(annotation: object, *, include_module: bool = True) -> str

Return a readable name for a type annotation.