11# mypy: disallow-untyped-defs=False, disallow-untyped-calls=False
22
3+ # /// script
4+ # dependencies = ["nox>=2025.02.09"]
5+ # ///
6+
37import contextlib
48import datetime
59import difflib
1721
1822import nox
1923
20- nox .options . sessions = [ "lint" ]
24+ nox .needs_version = ">=2025.02.09"
2125nox .options .reuse_existing_virtualenvs = True
26+ nox .options .default_venv_backend = "uv|virtualenv"
27+
28+ PYPROJECT = nox .project .load_toml ("pyproject.toml" )
29+ PYTHON_VERSIONS = nox .project .python_versions (PYPROJECT )
2230
2331
2432@nox .session (
2533 python = [
26- "3.8" ,
27- "3.9" ,
28- "3.10" ,
29- "3.11" ,
30- "3.12" ,
31- "3.13" ,
32- "3.14" ,
34+ * PYTHON_VERSIONS ,
3335 "pypy3.8" ,
3436 "pypy3.9" ,
3537 "pypy3.10" ,
3638 "pypy3.11" ,
37- ]
39+ ],
40+ default = False ,
3841)
3942def tests (session ):
4043 coverage = ["python" , "-m" , "coverage" ]
4144
42- session .install ("-r" , "tests/requirements.txt" )
45+ session .install (* nox . project . dependency_groups ( PYPROJECT , "test" ) )
4346 session .install ("." )
4447 env = {} if session .python != "3.14" else {"COVERAGE_CORE" : "sysmon" }
4548
@@ -78,7 +81,7 @@ def lint(session):
7881 session .run ("twine" , "check" , * glob .glob ("dist/*" ))
7982
8083
81- @nox .session (python = "3.9" )
84+ @nox .session (python = "3.9" , default = False )
8285def docs (session ):
8386 shutil .rmtree ("docs/_build" , ignore_errors = True )
8487 session .install ("-r" , "docs/requirements.txt" )
@@ -104,7 +107,7 @@ def docs(session):
104107 )
105108
106109
107- @nox .session
110+ @nox .session ( default = False )
108111def release (session ):
109112 package_name = "packaging"
110113 version_file = Path (f"src/{ package_name } /__init__.py" )
@@ -183,7 +186,7 @@ def release(session):
183186 webbrowser .open ("https://github.com/pypa/packaging/releases" )
184187
185188
186- @nox .session
189+ @nox .session ( default = False )
187190def update_licenses (session : nox .Session ) -> None :
188191 session .install ("httpx" )
189192 session .run ("python" , "tasks/licenses.py" )
@@ -338,3 +341,7 @@ def _changelog_add_unreleased_title(*, file):
338341 # Duplicate all the remaining lines.
339342 for line in original :
340343 replacement .write (line )
344+
345+
346+ if __name__ == "__main__" :
347+ nox .main ()
0 commit comments