99
1010nox .options .sessions = ["lint" , "pylint" , "check_manifest" , "tests" ]
1111
12- PYTHON_ALL_VERSIONS = ["3.7" , "3.8" , "3.9" , "3.10" , "3.11" , "3.12" ]
13-
1412DIR = Path (__file__ ).parent .resolve ()
1513
1614if os .environ .get ("CI" , None ):
@@ -23,7 +21,7 @@ def tests(session: nox.Session) -> None:
2321 Run the unit and regular tests.
2422 """
2523 unit_test_args = ["--run-docker" ] if sys .platform .startswith ("linux" ) else []
26- session .install ("-e" , " .[test]" )
24+ session .install ("-e.[test]" )
2725 if session .posargs :
2826 session .run ("pytest" , * session .posargs )
2927 else :
@@ -46,7 +44,8 @@ def pylint(session: nox.Session) -> None:
4644 Run pylint.
4745 """
4846
49- session .install ("pylint" , "." )
47+ name = "cibuildwheel @ ." if getattr (session .virtualenv , "venv_backend" , "" ) == "uv" else "."
48+ session .install ("pylint" , name )
5049 session .run ("pylint" , "cibuildwheel" , * session .posargs )
5150
5251
@@ -60,32 +59,36 @@ def check_manifest(session: nox.Session) -> None:
6059 session .run ("check-manifest" , * session .posargs )
6160
6261
63- @nox .session ( python = PYTHON_ALL_VERSIONS )
62+ @nox .session
6463def update_constraints (session : nox .Session ) -> None :
6564 """
6665 Update the dependencies inplace.
6766 """
68- session .install ("pip-tools" )
69- assert isinstance (session .python , str )
70- python_version = session .python .replace ("." , "" )
71- env = os .environ .copy ()
72- # CUSTOM_COMPILE_COMMAND is a pip-compile option that tells users how to
73- # regenerate the constraints files
74- env ["CUSTOM_COMPILE_COMMAND" ] = f"nox -s { session .name } "
75- session .run (
76- "pip-compile" ,
77- "--allow-unsafe" ,
78- "--upgrade" ,
79- "cibuildwheel/resources/constraints.in" ,
80- f"--output-file=cibuildwheel/resources/constraints-python{ python_version } .txt" ,
81- env = env ,
82- )
83- if session .python == PYTHON_ALL_VERSIONS [- 1 ]:
84- RESOURCES = DIR / "cibuildwheel" / "resources"
85- shutil .copyfile (
86- RESOURCES / f"constraints-python{ python_version } .txt" ,
87- RESOURCES / "constraints.txt" ,
67+
68+ if getattr (session .virtualenv , "venv_backend" , "" ) != "uv" :
69+ session .install ("uv>=0.1.23" )
70+
71+ for minor_version in range (7 , 13 ):
72+ python_version = f"3.{ minor_version } "
73+ env = os .environ .copy ()
74+ # CUSTOM_COMPILE_COMMAND is a pip-compile option that tells users how to
75+ # regenerate the constraints files
76+ env ["UV_CUSTOM_COMPILE_COMMAND" ] = f"nox -s { session .name } "
77+ session .run (
78+ "uv" ,
79+ "pip" ,
80+ "compile" ,
81+ f"--python-version={ python_version } " ,
82+ "--upgrade" ,
83+ "cibuildwheel/resources/constraints.in" ,
84+ f"--output-file=cibuildwheel/resources/constraints-python{ python_version .replace ('.' , '' )} .txt" ,
85+ env = env ,
8886 )
87+ RESOURCES = DIR / "cibuildwheel" / "resources"
88+ shutil .copyfile (
89+ RESOURCES / "constraints-python312.txt" ,
90+ RESOURCES / "constraints.txt" ,
91+ )
8992
9093
9194@nox .session
@@ -104,7 +107,7 @@ def update_proj(session: nox.Session) -> None:
104107 """
105108 Update the README inplace.
106109 """
107- session .install ("-e" , " .[bin]" )
110+ session .install ("-e.[bin]" )
108111 session .run (
109112 "python" ,
110113 "bin/projects.py" ,
@@ -127,18 +130,10 @@ def generate_schema(session: nox.Session) -> None:
127130@nox .session (python = "3.9" )
128131def docs (session : nox .Session ) -> None :
129132 """
130- Build the docs.
133+ Build the docs. Will serve unless --non-interactive
131134 """
132- session .install ("-e" , ".[docs]" )
133- session .run ("pip" , "list" )
134-
135- if session .posargs :
136- if "serve" in session .posargs :
137- session .run ("mkdocs" , "serve" )
138- else :
139- session .error ("Unrecognized args, use 'serve'" )
140- else :
141- session .run ("mkdocs" , "build" )
135+ session .install ("-e.[docs]" )
136+ session .run ("mkdocs" , "serve" if session .interactive else "build" )
142137
143138
144139@nox .session
0 commit comments