Probably a complete ripoff of existing options such as the ZCA. I should blame moraes for bugging me about it. :)
Registry of "utilities"
Event system with generic signals and special signals for things like when a "utility" has been created, with conditional subscription based on instance checking
Dependency injection of utilities to event subscribers based on instance checking
# an instance of a jinja environment has been created and registered
@created(jinja2.Environment)
def configure_line_statements(env): # pass the instance as the first argument
env.line_statement_prefix = '#'
# a request has started
# find all utilities in the registry matching the annotated types in the function signature
# call the function once for each combination of the found utilities
@started(RequestEvent)
def log_request(log: logbook.Logger, request: werkzeug.BaseRequest):
log.info('{request.method} {request.path}', request=request)
Probably a complete ripoff of existing options such as the ZCA. I should blame moraes for bugging me about it. :)