Skip to content

Commit a925bde

Browse files
committed
fix: add python-dotenv dependency to the noxfile through PEP 723 syntax
1 parent b853707 commit a925bde

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

noxfile.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
"""Noxfile for the cookiecutter-robust-python template."""
2+
3+
# /// script
4+
# dependencies = ["python-dotenv>=1.0.0"]
5+
# ///
6+
27
import os
38
import shutil
49
from pathlib import Path
@@ -20,12 +25,14 @@
2025

2126

2227
# Load environment variables from .env and .env.local (if present)
23-
_env_file: Path = REPO_ROOT / ".env"
24-
_env_local_file: Path = REPO_ROOT / ".env.local"
25-
if _env_file.exists():
26-
load_dotenv(_env_file)
27-
if _env_local_file.exists():
28-
load_dotenv(_env_local_file, override=True)
28+
LOCAL_ENV_FILE: Path = REPO_ROOT / ".env.local"
29+
DEFAULT_ENV_FILE: Path = REPO_ROOT / ".env"
30+
31+
if LOCAL_ENV_FILE.exists():
32+
load_dotenv(LOCAL_ENV_FILE)
33+
34+
if DEFAULT_ENV_FILE.exists():
35+
load_dotenv(DEFAULT_ENV_FILE)
2936

3037
APP_AUTHOR: str = os.getenv("COOKIECUTTER_ROBUST_PYTHON_APP_AUTHOR", "robust-python")
3138
COOKIECUTTER_ROBUST_PYTHON_CACHE_FOLDER: Path = Path(

0 commit comments

Comments
 (0)