Skip to content

env

Module for environment utilities.

assert_env_is_set(name)

Assert that an environment variable is set.

Source code in spark_instructor/utils/env.py
6
7
8
def assert_env_is_set(name: str):
    """Assert that an environment variable is set."""
    assert name in os.environ, f"``{name}`` is not set!"

get_env_variable(name)

Get environment variable with the given name.

Source code in spark_instructor/utils/env.py
def get_env_variable(name: str) -> str:
    """Get environment variable with the given name."""
    assert_env_is_set(name)
    return os.environ[name]