Skip to content

Commit c1e4b3a

Browse files
committed
fix: add some temp defaults to enable updating demos across python versions used
1 parent 3e88712 commit c1e4b3a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
LINT_FROM_DEMO_OPTIONS: tuple[str, ...] = GENERATE_DEMO_OPTIONS
6060

6161
UPDATE_DEMO_SCRIPT: Path = SCRIPTS_FOLDER / "update-demo.py"
62-
UPDATE_DEMO_OPTIONS: tuple[str, ...] = GENERATE_DEMO_OPTIONS
62+
UPDATE_DEMO_OPTIONS: tuple[str, ...] = (
63+
*GENERATE_DEMO_OPTIONS,
64+
*("--min-python-version", "3.10"),
65+
*("--max-python-version", "3.14")
66+
)
6367

6468

6569
@nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION, name="generate-demo")

scripts/update-demo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from pathlib import Path
44
from typing import Annotated
5+
from typing import Any
56

67
import cruft
78
import typer
@@ -20,7 +21,9 @@
2021
@cli.callback(invoke_without_command=True)
2122
def update_demo(
2223
demos_cache_folder: Annotated[Path, FolderOption("--demos-cache-folder", "-c")],
23-
add_rust_extension: Annotated[bool, typer.Option("--add-rust-extension", "-r")] = False
24+
add_rust_extension: Annotated[bool, typer.Option("--add-rust-extension", "-r")] = False,
25+
min_python_version: Annotated[str, typer.Option("--min-python-version")] = "3.10",
26+
max_python_version: Annotated[str, typer.Option("--max-python-version")] = "3.14"
2427
) -> None:
2528
"""Runs precommit in a generated project and matches the template to the results."""
2629
try:
@@ -34,7 +37,12 @@ def update_demo(
3437
cruft.update(
3538
project_dir=demo_path,
3639
template_path=REPO_FOLDER,
37-
extra_context={"project_name": demo_name, "add_rust_extension": add_rust_extension},
40+
extra_context={
41+
"project_name": demo_name,
42+
"add_rust_extension": add_rust_extension,
43+
"min_python_version": min_python_version,
44+
"max_python_version": max_python_version
45+
},
3846
)
3947
git("add", ".")
4048
git("commit", "-m", "chore: update demo to the latest cookiecutter-robust-python", "--no-verify")

0 commit comments

Comments
 (0)