Ligare.web.middleware.dependency_injection

Ligare.web’s integration with Injector and Flask Injector.

Functions

_configure_openapi_middleware_dependencies(...)

Bind any Connexion middleware classes whose __call__ member has a __bindings__ attribute.

bind_middleware(app, flask_injector, middleware)

configure_dependencies(app[, ...])

Configures dependency injection and registers all Flask application dependencies.

Classes

AppModule(app, *args)

OpenAPIEndpointDependencyInjectionMiddleware(...)

Enables dependency injection for any blueprint methods.

class Ligare.web.middleware.dependency_injection.AppModule(app, *args)[source]
__init__(app, *args)[source]
configure(binder)[source]

Override to configure bindings.

Return type:

None

protocol Ligare.web.middleware.dependency_injection.MiddlewareRoutine[source]

typing.Protocol.

Classes that implement this protocol must have the following methods / attributes:

__call__(scope, receive, send, *args)[source]

Call self as a function.

Return type:

None

class Ligare.web.middleware.dependency_injection.OpenAPIEndpointDependencyInjectionMiddleware(flask_injector: FlaskInjector)[source]

Enables dependency injection for any blueprint methods.

static __new__(cls, flask_injector)[source]
Ligare.web.middleware.dependency_injection.bind_middleware(app, flask_injector, middleware, position=MiddlewarePosition.BEFORE_CONTEXT)[source]
Ligare.web.middleware.dependency_injection.configure_dependencies(app, application_modules=None)[source]

Configures dependency injection and registers all Flask application dependencies. The FlaskInjector instance can be used to bootstrap and start the Flask application.

Return type:

FlaskInjector