from __future__ import annotations

import os
from pathlib import Path


def configure_runtime_env() -> None:
    """Set runtime defaults that are safe on restricted Linux/WSL setups."""
    if "MPLCONFIGDIR" in os.environ:
        return

    cache_dir = Path.cwd() / ".cache" / "matplotlib"
    cache_dir.mkdir(parents=True, exist_ok=True)
    os.environ["MPLCONFIGDIR"] = str(cache_dir)
