1import os
 2
 3from plain.utils.dotenv import load_dotenv
 4
 5
 6def setup() -> None:
 7    # Make sure our clis are registered
 8    # since this isn't an installed app
 9    from .cli import cli  # noqa
10    from .precommit import cli  # noqa
11    from .contribute import cli  # noqa
12    from .services import auto_start_services
13
14    # Auto-start dev services for commands that need the runtime
15    auto_start_services()
16
17    # Load environment variables from .env file
18    if plain_env := os.environ.get("PLAIN_ENV", ""):
19        load_dotenv(f".env.{plain_env}")
20    else:
21        load_dotenv(".env")