Skip to content

Commit 94fd2b5

Browse files
committed
feat: add PEP 723 syntax installs
1 parent 317c7a5 commit 94fd2b5

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
lines changed

scripts/generate-demo.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = [
4+
# "cookiecutter",
5+
# "cruft",
6+
# "python-dotenv",
7+
# "typer",
8+
# ]
9+
# ///
110
"""Python script for generating a demo project."""
11+
212
import sys
313
from pathlib import Path
414
from typing import Annotated

scripts/lint-from-demo.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = [
4+
# "cookiecutter",
5+
# "cruft",
6+
# "python-dotenv",
7+
# "retrocookie",
8+
# "typer",
9+
# ]
10+
# ///
11+
112
import os
213
from pathlib import Path
314
from typing import Annotated

scripts/update-demo.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = [
4+
# "cookiecutter",
5+
# "cruft",
6+
# "python-dotenv",
7+
# "typer",
8+
# ]
9+
# ///
10+
111
import sys
212
from pathlib import Path
313
from typing import Annotated
@@ -37,7 +47,7 @@ def update_demo(
3747
template_commit: str = get_current_commit()
3848

3949
_validate_is_feature_branch(branch=current_branch)
40-
50+
_set_demo_to_clean_develop(demo_path=demo_path)
4151
last_update_commit: str = _get_last_demo_develop_cruft_update(demo_path=demo_path)
4252

4353
if not is_ancestor(last_update_commit, template_commit):
@@ -73,20 +83,19 @@ def update_demo(
7383
sys.exit(1)
7484

7585

76-
def _get_last_demo_develop_cruft_update(demo_path: Path) -> str:
77-
"""Gets the last cruft update commit for the demo project's develop branch."""
78-
_prep_demo_develop(demo_path=demo_path)
79-
last_update_commit: str = get_last_cruft_update_commit(demo_path=demo_path)
80-
return last_update_commit
81-
82-
83-
def _prep_demo_develop(demo_path: Path) -> None:
86+
def _set_demo_to_clean_develop(demo_path: Path) -> None:
8487
"""Checks out the demo development branch and validates it is up to date."""
8588
with work_in(demo_path):
8689
require_clean_and_up_to_date_repo()
8790
git("checkout", "develop")
8891

8992

93+
def _get_last_demo_develop_cruft_update(demo_path: Path) -> str:
94+
"""Gets the last cruft update commit for the demo project's develop branch."""
95+
last_update_commit: str = get_last_cruft_update_commit(demo_path=demo_path)
96+
return last_update_commit
97+
98+
9099
def _validate_is_feature_branch(branch: str) -> None:
91100
"""Validates that the cookiecutter has a feature branch checked out."""
92101
if not branch.startswith("feature/"):

scripts/util.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = [
4+
# "cookiecutter",
5+
# "cruft",
6+
# "python-dotenv",
7+
# "typer",
8+
# ]
9+
# ///
110
"""Module containing utility functions used throughout cookiecutter_robust_python scripts."""
11+
212
import json
313
import os
414
import shutil

0 commit comments

Comments
 (0)