Source code for structum_lab.plugins.di.integrations.fastapi
# src/structum_lab/plugins/di/integrations/fastapi.py
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 PythonWoods
"""
Integration helpers for FastAPI.
"""
from typing import Any
from dependency_injector import containers # type: ignore[import-not-found]
[docs]
def wire_app(container: containers.Container, modules: list[Any]) -> None:
"""
Wires the container to the specified modules.
This enables the use of @inject and Provide markers in FastAPI endpoints.
Args:
container: The DI container instance.
modules: List of Python modules (not just names) to wire.
"""
container.wire(modules=modules)