Skip to content

Starlette

wireup.integration.flask

Attributes

inject = inject_from_container_unchecked(get_request_container) module-attribute

Inject dependencies into Starlette endpoints. Decorate your endpoint functions with this to use Wireup's dependency injection and use Injected[T] or Annotated[T, Inject()] to specify dependencies.

Classes

Functions

get_app_container(app)

Return the container associated with the given application.

This is the instance created via wireup.create_async_container. Use this when you need the container outside of the request context lifecycle.

get_request_container()

When inside a request, returns the scoped container instance handling the current request.

This is what you almost always want.It has all the information the app container has in addition to data specific to the current request.

request_factory()

Provide the current request as a dependency.

setup(container, app)

Integrate Wireup with a Starlette application.

This sets up the application to use Wireup's dependency injection system and closes the container on application shutdown. Note, for this to work correctly, there should be no more middleware added after the call to this function.

websocket_factory()

Provide the current WebSocket as a dependency.