mantik.utils.env¶
Attributes¶
Functions¶
|
|
|
Set the given environment variables and unset afterwards. |
|
Return an optional environment variable. |
|
Return a required environment variable. |
|
Set given environment variables. |
|
Unset given environment variables. |
Module Contents¶
- mantik.utils.env.env_vars_set(env_vars: Dict[str, Any]) None [source]¶
Set the given environment variables and unset afterwards.
- Parameters:
env_vars (dict) – Environment variables and values to set.
Notes
All environment variables that were previously set to another value will be reset to the initial value afterwards.
- mantik.utils.env.get_optional_env_var(name: str, default: str | None = None) str | None [source]¶
Return an optional environment variable.
Parameter¶
- namestr
Name of the environment variable.
- defaultstr, optional
The default to return
- returns:
The value of the environment variable.
- rtype:
str or None
- mantik.utils.env.get_required_env_var(name: str) str [source]¶
Return a required environment variable.
Parameter¶
- namestr
Name of the environment variable.
- raises NameError:
If the environment variable is unset.
- returns:
The value of the environment variable.
- rtype:
str