44- Code linting and formatting
55- Unit testing with coverage reporting
66- Package building
7- - Executable creation
7+ - Project cleaning
88
99Typical usage example:
10- nox -s lint # Run linting
11- nox -s test # Run tests
12- nox -s build # Build package
13- nox -s build_exe # Build package with standalone executable
10+ nox -s lint # Run linting
11+ nox -s test # Run tests
12+ nox -s build # Build package
13+ nox -s clean # Clean project
1414"""
1515import nox
16+ import shutil
17+ from pathlib import Path
18+
19+
20+ def install_with_uv (session : nox .Session , editable : bool = False ) -> None :
21+ """Helper function to install packages using uv.
22+
23+ Args:
24+ session: Nox session object for running commands
25+ editable: Whether to install in editable mode
26+ """
27+ session .install ("uv" )
28+ if editable :
29+ session .run ("uv" , "pip" , "install" , "-e" , ".[dev]" )
30+ else :
31+ session .run ("uv" , "pip" , "install" , "." )
1632
1733
1834@nox .session (reuse_venv = True )
@@ -25,9 +41,11 @@ def lint(session: nox.Session) -> None:
2541 Args:
2642 session: Nox session object for running commands
2743 """
28- session . install ( "poetry" )
44+ # Install dependencies
2945 session .install ("ruff" )
30- session .run ("poetry" , "install" , "--only" , "dev" )
46+ install_with_uv (session , editable = True )
47+
48+ # Run linting checks
3149 session .run (
3250 "ruff" ,
3351 "check" ,
@@ -42,18 +60,22 @@ def lint(session: nox.Session) -> None:
4260 "--diff"
4361 )
4462
63+
4564@nox .session (reuse_venv = True )
4665def test (session : nox .Session ) -> None :
4766 """Run the test suite with coverage reporting.
4867
49- Executes pytest with coverage reporting for the github_action_test package.
68+ Executes pytest with coverage reporting for the repo_scaffold package.
5069 Generates both terminal and XML coverage reports.
5170
5271 Args:
5372 session: Nox session object for running commands
5473 """
55- session .install ("poetry" )
56- session .run ("poetry" , "install" )
74+ # Install dependencies
75+ install_with_uv (session , editable = True )
76+ session .install ("pytest" , "pytest-cov" , "pytest-mock" )
77+
78+ # Run tests
5779 session .run (
5880 "pytest" ,
5981 "--cov=repo_scaffold" ,
@@ -68,28 +90,53 @@ def test(session: nox.Session) -> None:
6890def build (session : nox .Session ) -> None :
6991 """Build the Python package.
7092
71- Creates a distributable package using poetry build command
72- with verbose output and excluding dev dependencies.
93+ Creates a distributable package using uv build command.
7394
7495 Args:
7596 session: Nox session object for running commands
7697 """
77- session .install ("poetry" )
78- session .run ("poetry" , "install" , "--without" , "dev" )
79- session .run ("poetry" , "build" , "-vvv" )
98+ session .install ("uv" )
99+ session .run ("uv" , "build" , "--wheel" , "--sdist" )
80100
81101
82102@nox .session (reuse_venv = True )
83- def build_exe (session : nox .Session ) -> None :
84- """Build the Python package with standalone executable.
85-
86- Creates an executable using poetry-pyinstaller-plugin.
87- Installs required plugin and builds without dev dependencies.
103+ def clean (session : nox .Session ) -> None : # pylint: disable=unused-argument
104+ """Clean the project directory.
105+
106+ Removes build artifacts, cache directories, and other temporary files:
107+ - build/: Build artifacts
108+ - dist/: Distribution packages
109+ - .nox/: Nox virtual environments
110+ - .pytest_cache/: Pytest cache
111+ - .ruff_cache/: Ruff cache
112+ - .coverage: Coverage data
113+ - coverage.xml: Coverage report
114+ - **/*.pyc: Python bytecode
115+ - **/__pycache__/: Python cache directories
116+ - **/*.egg-info: Package metadata
88117
89118 Args:
90- session: Nox session object for running commands
119+ session: Nox session object (unused)
91120 """
92- session .install ("poetry" )
93- session .install ("poetry" , "self" , "add" , "poetry-pyinstaller-plugin" )
94- session .run ("poetry" , "install" , "--without" , "dev" )
95- session .run ("poetry" , "build" , "-vvv" )
121+ root = Path ("." )
122+ patterns = [
123+ "build" ,
124+ "dist" ,
125+ ".nox" ,
126+ ".pytest_cache" ,
127+ ".ruff_cache" ,
128+ ".coverage" ,
129+ "coverage.xml" ,
130+ "**/*.pyc" ,
131+ "**/__pycache__" ,
132+ "**/*.egg-info" ,
133+ ]
134+
135+ for pattern in patterns :
136+ for path in root .glob (pattern ):
137+ if path .is_file ():
138+ path .unlink ()
139+ print (f"Removed file: { path } " )
140+ elif path .is_dir ():
141+ shutil .rmtree (path )
142+ print (f"Removed directory: { path } " )
0 commit comments