4141 * ("--demo-name" , DEFAULT_DEMO_NAME ),
4242)
4343
44- SYNC_UV_WITH_DEMO_SCRIPT : Path = SCRIPTS_FOLDER / "sync-uv-with-demo.py"
45- SYNC_UV_WITH_DEMO_OPTIONS : tuple [str , ...] = (
46- * ("--template-folder" , TEMPLATE_FOLDER ),
47- * ("--demos-cache-folder" , PROJECT_DEMOS_FOLDER ),
48- * ("--demo-name" , DEFAULT_DEMO_NAME ),
49- )
44+
45+ MATCH_GENERATED_PRECOMMIT_SCRIPT : Path = SCRIPTS_FOLDER / "match-generated-precommit.py"
46+ MATCH_GENERATED_PRECOMMIT_OPTIONS : tuple [str , ...] = GENERATE_DEMO_PROJECT_OPTIONS
5047
5148
5249@nox .session (name = "generate-demo-project" , python = DEFAULT_TEMPLATE_PYTHON_VERSION )
5350def generate_demo_project (session : Session ) -> None :
5451 """Generates a project demo using the cookiecutter-robust-python template."""
5552 session .install ("cookiecutter" , "platformdirs" , "loguru" , "typer" )
56- session .run (
57- "python" ,
58- GENERATE_DEMO_PROJECT_SCRIPT ,
59- * GENERATE_DEMO_PROJECT_OPTIONS ,
60- * session .posargs
61- )
62-
63-
64- @nox .session (name = "sync-uv-with-demo" , python = DEFAULT_TEMPLATE_PYTHON_VERSION )
65- def sync_uv_with_demo (session : Session ) -> None :
66- """Syncs the uv environment with the current demo project."""
67- session .install ("cookiecutter" , "platformdirs" , "loguru" , "typer" )
68- session .run (
69- "python" ,
70- SYNC_UV_WITH_DEMO_SCRIPT ,
71- * SYNC_UV_WITH_DEMO_OPTIONS ,
72- )
73-
74-
75- @nox .session (name = "uv-in-demo" , python = DEFAULT_TEMPLATE_PYTHON_VERSION )
76- def uv_in_demo (session : Session ) -> None :
77- """Runs a uv command in a new project demo project then syncs with it."""
78- session .install ("cookiecutter" , "platformdirs" , "loguru" , "typer" )
79- session .run (
80- "python" ,
81- GENERATE_DEMO_PROJECT_SCRIPT ,
82- * GENERATE_DEMO_PROJECT_OPTIONS ,
83- )
84- original_dir : Path = Path .cwd ()
85- session .cd (DEMO_ROOT_FOLDER )
86- session .run ("uv" , * session .posargs )
87- session .cd (original_dir )
88- session .run (
89- SYNC_UV_WITH_DEMO_SCRIPT ,
90- * SYNC_UV_WITH_DEMO_OPTIONS ,
91- external = True ,
92- )
93-
94-
95- @nox .session (name = "in-demo" , python = DEFAULT_TEMPLATE_PYTHON_VERSION )
96- def in_demo (session : Session ) -> None :
97- """Generates a project demo and run a uv command in it."""
98- session .install ("cookiecutter" , "platformdirs" , "loguru" , "typer" )
99- session .run (
100- "python" ,
101- GENERATE_DEMO_PROJECT_SCRIPT ,
102- * GENERATE_DEMO_PROJECT_OPTIONS ,
103- )
104- original_dir : Path = Path .cwd ()
105- session .cd (DEMO_ROOT_FOLDER )
106- session .run (* session .posargs )
107- session .cd (original_dir )
53+ session .run ("python" , GENERATE_DEMO_PROJECT_SCRIPT , * GENERATE_DEMO_PROJECT_OPTIONS , * session .posargs )
10854
10955
11056@nox .session (name = "clear-cache" , python = DEFAULT_TEMPLATE_PYTHON_VERSION )
@@ -131,15 +77,12 @@ def lint(session: Session):
13177 session .run ("ruff" , "check" , "--verbose" , "--fix" )
13278
13379
134- @nox .session (python = DEFAULT_TEMPLATE_PYTHON_VERSION , name = "lint -generated-project " , tags = [])
135- def lint_generated_project (session : Session ):
80+ @nox .session (python = DEFAULT_TEMPLATE_PYTHON_VERSION , name = "match -generated-precommit " , tags = [])
81+ def match_generated_precommit (session : Session ):
13682 """Lint the generated project's Python files and configurations."""
13783 session .log ("Installing linting dependencies for the generated project..." )
13884 session .install ("-e" , "." , "--group" , "dev" , "--group" , "lint" )
139- session ._runner .posargs = ["nox" , "-s" , "pre-commit" ]
140- in_demo (session )
141- session ._runner .posargs = ["" ]
142- session .run ("retrocookie" )
85+ session .run ("python" , MATCH_GENERATED_PRECOMMIT_SCRIPT , * MATCH_GENERATED_PRECOMMIT_OPTIONS , * session .posargs )
14386
14487
14588@nox .session (python = DEFAULT_TEMPLATE_PYTHON_VERSION )
0 commit comments