ploomber.with_env

ploomber.with_env(source)

A function decorated with @with_env that starts and environment during the execution of a function.

Notes

The first argument of a function decorated with @with_env must be named “env”, the env will be passed automatically when calling the function. The original function’s signature is edited.

You can replace values in the environment, e.g. if you want to replace env.key.another, you can call the decorated function with: my_fn(env__key__another=’my_new_value’)

The environment is resolved at import time, changes to the working directory will not affect initialization.

Examples