9
9
10
10
nox .options .sessions = ["lint" , "pylint" , "check_manifest" , "tests" ]
11
11
12
- PYTHON_ALL_VERSIONS = ["3.7" , "3.8" , "3.9" , "3.10" , "3.11" , "3.12" ]
13
-
14
12
DIR = Path (__file__ ).parent .resolve ()
15
13
16
14
if os .environ .get ("CI" , None ):
@@ -23,7 +21,7 @@ def tests(session: nox.Session) -> None:
23
21
Run the unit and regular tests.
24
22
"""
25
23
unit_test_args = ["--run-docker" ] if sys .platform .startswith ("linux" ) else []
26
- session .install ("-e" , " .[test]" )
24
+ session .install ("-e.[test]" )
27
25
if session .posargs :
28
26
session .run ("pytest" , * session .posargs )
29
27
else :
@@ -46,7 +44,8 @@ def pylint(session: nox.Session) -> None:
46
44
Run pylint.
47
45
"""
48
46
49
- session .install ("pylint" , "." )
47
+ name = "cibuildwheel @ ." if getattr (session .virtualenv , "venv_backend" , "" ) == "uv" else "."
48
+ session .install ("pylint" , name )
50
49
session .run ("pylint" , "cibuildwheel" , * session .posargs )
51
50
52
51
@@ -60,32 +59,36 @@ def check_manifest(session: nox.Session) -> None:
60
59
session .run ("check-manifest" , * session .posargs )
61
60
62
61
63
- @nox .session ( python = PYTHON_ALL_VERSIONS )
62
+ @nox .session
64
63
def update_constraints (session : nox .Session ) -> None :
65
64
"""
66
65
Update the dependencies inplace.
67
66
"""
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 ,
88
86
)
87
+ RESOURCES = DIR / "cibuildwheel" / "resources"
88
+ shutil .copyfile (
89
+ RESOURCES / "constraints-python312.txt" ,
90
+ RESOURCES / "constraints.txt" ,
91
+ )
89
92
90
93
91
94
@nox .session
@@ -104,7 +107,7 @@ def update_proj(session: nox.Session) -> None:
104
107
"""
105
108
Update the README inplace.
106
109
"""
107
- session .install ("-e" , " .[bin]" )
110
+ session .install ("-e.[bin]" )
108
111
session .run (
109
112
"python" ,
110
113
"bin/projects.py" ,
@@ -127,18 +130,10 @@ def generate_schema(session: nox.Session) -> None:
127
130
@nox .session (python = "3.9" )
128
131
def docs (session : nox .Session ) -> None :
129
132
"""
130
- Build the docs.
133
+ Build the docs. Will serve unless --non-interactive
131
134
"""
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" )
142
137
143
138
144
139
@nox .session
0 commit comments