Skip to content

academy.home

Academy home directory resolution.

get_academy_home

get_academy_home() -> Path

Resolve the Academy data directory.

Resolves the Academy data directory from the ACADEMY_HOME environment variable if set, otherwise ~/local/share/academy. Callers are responsible for creating the directory as needed.

Returns:

  • Path

    Path to the Academy data directory.

Source code in academy/home.py
def get_academy_home() -> pathlib.Path:
    """Resolve the Academy data directory.

    Resolves the Academy data directory from the `ACADEMY_HOME`
    environment variable if set, otherwise `~/local/share/academy`.
    Callers are responsible for creating the directory as needed.

    Returns:
        Path to the Academy data directory.
    """
    default = pathlib.Path.home() / 'local' / 'share' / 'academy'
    return pathlib.Path(os.environ.get('ACADEMY_HOME', default))