Skip to content

Types

Common types and helpers for FastDI.

Defines shared type aliases, the Depends marker, and helpers to extract dependency metadata from callables.

CoreContainerProto

Bases: Protocol

Protocol describing the Rust core container interface.

This enables static typing for the PyO3-backed _fastdi_core.Container.

Depends

Marker for declaring a dependency in a function signature.

Prefer the Annotated-only style for clarity and static typing:

def handler(svc: Annotated[Service, Depends(get_service)]): ...

extract_dep_keys(func)

Extract dependency keys from a callable's parameters.

extract_dep_params(func)

Return (parameter_name, dependency_key) pairs for func.

make_key(obj)

Return a stable string key for a dependency target.

  • Strings are used as-is.
  • Callables are qualified as "module:qualname".
  • Other objects fall back to str(obj).