The ooze.provide_static function

Overview

The Ooze dependency injector isn’t limited to only injecting functions and classes. It can inject any valid Python value. The ooze.provide_static function makes it easy:

1import ooze
2
3ooze.provide_static('application_version', '1.0.0')
4ooze.provide_static('config', { 'env': 'prod', 'url': 'https://github.com/' })

The first argument is the name that you want the item to known as in the dependency graph. The second argument is the value. Later in your application, you can have these values injected into your functions simply by naming your arguments:

1import ooze
2
3@ooze.provide
4def get_app_status(application_version, config):
5    return f"App version: {application_version}, environment: {config['env']}"