|
13 | 13 |
|
14 | 14 | nox.options.default_venv_backend = "uv" |
15 | 15 |
|
16 | | -DEFAULT_TEMPLATE_PYTHON_VERSION = "3.13" |
| 16 | +DEFAULT_TEMPLATE_PYTHON_VERSION = "3.9" |
17 | 17 |
|
18 | 18 | REPO_ROOT: Path = Path(__file__).parent.resolve() |
19 | 19 | TEMPLATE_FOLDER: Path = REPO_ROOT / "{{cookiecutter.project_name}}" |
|
37 | 37 | *("--demo-name", DEFAULT_DEMO_NAME), |
38 | 38 | ) |
39 | 39 |
|
| 40 | +SYNC_UV_WITH_DEMO_OPTIONS: tuple[str, ...] = ( |
| 41 | + *("--template-folder", TEMPLATE_FOLDER), |
| 42 | + *("--demos-cache-folder", PROJECT_DEMOS_FOLDER), |
| 43 | + *("--demo-name", DEFAULT_DEMO_NAME), |
| 44 | +) |
| 45 | + |
40 | 46 | TEMPLATE_PYTHON_LOCATIONS: tuple[Path, ...] = ( |
41 | 47 | Path("noxfile.py"), |
42 | 48 | ) |
@@ -68,6 +74,37 @@ def generate_demo_project(session: Session) -> None: |
68 | 74 | ) |
69 | 75 |
|
70 | 76 |
|
| 77 | +@nox.session(name="sync-uv-with-demo", python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
| 78 | +def sync_uv_with_demo(session: Session) -> None: |
| 79 | + session.install("cookiecutter", "platformdirs", "loguru", "typer") |
| 80 | + session.run( |
| 81 | + "python", |
| 82 | + "scripts/sync-uv-with-demo.py", |
| 83 | + *SYNC_UV_WITH_DEMO_OPTIONS, |
| 84 | + external=True, |
| 85 | + ) |
| 86 | + |
| 87 | +@nox.session(name="uv-in-demo", python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
| 88 | +def uv_in_demo(session: Session) -> None: |
| 89 | + session.install("cookiecutter", "platformdirs", "loguru", "typer") |
| 90 | + session.run( |
| 91 | + "python", |
| 92 | + "scripts/generate-demo-project.py", |
| 93 | + *GENERATE_DEMO_PROJECT_OPTIONS, |
| 94 | + external=True, |
| 95 | + ) |
| 96 | + original_dir: Path = Path.cwd() |
| 97 | + session.cd(DEMO_ROOT_FOLDER) |
| 98 | + session.run("uv", *session.posargs) |
| 99 | + session.cd(original_dir) |
| 100 | + session.run( |
| 101 | + "python", |
| 102 | + "scripts/sync-uv-with-demo.py", |
| 103 | + *SYNC_UV_WITH_DEMO_OPTIONS, |
| 104 | + external=True, |
| 105 | + ) |
| 106 | + |
| 107 | + |
71 | 108 | @nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
72 | 109 | def lint(session: Session): |
73 | 110 | """Lint the template's own Python files and configurations.""" |
|
0 commit comments