Skip to content

Commit b853707

Browse files
committed
Revert "feat: remove python-dotenv dependency and loading"
This reverts commit 7fe0069.
1 parent 04f1c19 commit b853707

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

noxfile.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import nox
77
import platformdirs
8-
8+
from dotenv import load_dotenv
99
from nox.command import CommandFailed
1010
from nox.sessions import Session
1111

@@ -18,6 +18,15 @@
1818
SCRIPTS_FOLDER: Path = REPO_ROOT / "scripts"
1919
TEMPLATE_FOLDER: Path = REPO_ROOT / "{{cookiecutter.project_name}}"
2020

21+
22+
# 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)
29+
2130
APP_AUTHOR: str = os.getenv("COOKIECUTTER_ROBUST_PYTHON_APP_AUTHOR", "robust-python")
2231
COOKIECUTTER_ROBUST_PYTHON_CACHE_FOLDER: Path = Path(
2332
platformdirs.user_cache_path(
@@ -49,7 +58,7 @@
4958
@nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION, name="generate-demo")
5059
def generate_demo(session: Session) -> None:
5160
"""Generates a project demo using the cookiecutter-robust-python template."""
52-
session.install("cookiecutter", "cruft", "platformdirs", "loguru", "typer")
61+
session.install("cookiecutter", "cruft", "platformdirs", "loguru", "python-dotenv", "typer")
5362
session.run("python", GENERATE_DEMO_SCRIPT, *GENERATE_DEMO_OPTIONS, *session.posargs)
5463

5564

@@ -127,7 +136,7 @@ def test(session: Session) -> None:
127136
@nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION, name="update-demo")
128137
def update_demo(session: Session, add_rust_extension: bool) -> None:
129138
session.log("Installing script dependencies for updating generated project demos...")
130-
session.install("cookiecutter", "cruft", "platformdirs", "loguru", "typer")
139+
session.install("cookiecutter", "cruft", "platformdirs", "loguru", "python-dotenv", "typer")
131140

132141
session.log("Updating generated project demos...")
133142
args: list[str] = [*UPDATE_DEMO_OPTIONS]
@@ -152,7 +161,7 @@ def release_template(session: Session):
152161
session.skip("Git not available.")
153162

154163
session.log("Checking Commitizen availability via uvx.")
155-
session.run("cz", "--version", success_codes=[0])
164+
session.run("cz", "--version", successcodes=[0])
156165

157166
increment = session.posargs[0] if session.posargs else None
158167
session.log(

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies = [
1010
"gitpython>=3.1.44",
1111
"loguru>=0.7.3",
1212
"platformdirs>=4.3.8",
13+
"python-dotenv>=1.0.0",
1314
"retrocookie>=0.4.3",
1415
"typer>=0.15.4",
1516
]

uv.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)