|
45 | 45 |
|
46 | 46 | TEMPLATE_PYTHON_LOCATIONS: tuple[Path, ...] = ( |
47 | 47 | Path("noxfile.py"), |
| 48 | + Path("scripts/*"), |
| 49 | + Path("hooks/*") |
48 | 50 | ) |
49 | 51 |
|
50 | 52 | TEMPLATE_CONFIG_AND_DOCS: tuple[Path, ...] = ( |
@@ -105,6 +107,31 @@ def uv_in_demo(session: Session) -> None: |
105 | 107 | ) |
106 | 108 |
|
107 | 109 |
|
| 110 | +@nox.session(name="in-demo", python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
| 111 | +def in_demo(session: Session) -> None: |
| 112 | + session.install("cookiecutter", "platformdirs", "loguru", "typer") |
| 113 | + session.run( |
| 114 | + "python", |
| 115 | + "scripts/generate-demo-project.py", |
| 116 | + *GENERATE_DEMO_PROJECT_OPTIONS, |
| 117 | + ) |
| 118 | + original_dir: Path = Path.cwd() |
| 119 | + session.cd(DEMO_ROOT_FOLDER) |
| 120 | + session.run(*session.posargs) |
| 121 | + session.cd(original_dir) |
| 122 | + |
| 123 | + |
| 124 | +@nox.session(name="clear-cache", python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
| 125 | +def clear_cache(session: Session) -> None: |
| 126 | + """Clear the cache of generated project demos. |
| 127 | +
|
| 128 | + Not commonly used, but sometimes permissions might get messed up if exiting mid-build and such. |
| 129 | + """ |
| 130 | + session.log("Clearing cache of generated project demos...") |
| 131 | + shutil.rmtree(PROJECT_DEMOS_FOLDER, ignore_errors=True) |
| 132 | + session.log("Cache cleared.") |
| 133 | + |
| 134 | + |
108 | 135 | @nox.session(python=DEFAULT_TEMPLATE_PYTHON_VERSION) |
109 | 136 | def lint(session: Session): |
110 | 137 | """Lint the template's own Python files and configurations.""" |
|
0 commit comments