Skip to content

Commit 1796272

Browse files
committed
chore: Template upgrade
1 parent 5e79fbe commit 1796272

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier.
2-
_commit: 1.8.7
2+
_commit: 1.8.9
33
_src_path: gh:pawamoy/copier-uv
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

duties.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
WINDOWS = os.name == "nt"
3434
PTY = not WINDOWS and not CI
3535
MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
36+
PY_VERSION = f"{sys.version_info.major}{sys.version_info.minor}"
37+
PY_DEV = "314"
3638

3739

3840
def _pyprefix(title: str) -> str:
@@ -135,7 +137,7 @@ def check(ctx: Context) -> None:
135137
"""
136138

137139

138-
@duty
140+
@duty(nofail=PY_VERSION == PY_DEV)
139141
def check_quality(ctx: Context) -> None:
140142
"""Check the code quality.
141143
@@ -203,7 +205,7 @@ def check_quality(ctx: Context) -> None:
203205
)
204206

205207

206-
@duty
208+
@duty(nofail=PY_VERSION == PY_DEV)
207209
def check_docs(ctx: Context) -> None:
208210
"""Check if the documentation builds correctly.
209211
@@ -229,7 +231,7 @@ def check_docs(ctx: Context) -> None:
229231
)
230232

231233

232-
@duty
234+
@duty(nofail=PY_VERSION == PY_DEV)
233235
def check_types(ctx: Context) -> None:
234236
"""Check that the code is correctly typed.
235237
@@ -280,7 +282,7 @@ def check_types(ctx: Context) -> None:
280282
)
281283

282284

283-
@duty
285+
@duty(nofail=PY_VERSION == PY_DEV)
284286
def check_api(ctx: Context, *cli_args: str) -> None:
285287
"""Check for API breaking changes.
286288
@@ -477,7 +479,7 @@ def coverage(ctx: Context) -> None:
477479
ctx.run(tools.coverage.html(rcfile="config/coverage.ini"))
478480

479481

480-
@duty
482+
@duty(nofail=PY_VERSION == PY_DEV)
481483
def test(ctx: Context, *cli_args: str, match: str = "") -> None: # noqa: PT028
482484
"""Run the test suite.
483485
@@ -493,8 +495,7 @@ def test(ctx: Context, *cli_args: str, match: str = "") -> None: # noqa: PT028
493495
*cli_args: Additional Pytest CLI arguments.
494496
match: A pytest expression to filter selected tests.
495497
"""
496-
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
497-
os.environ["COVERAGE_FILE"] = f".coverage.{py_version}"
498+
os.environ["COVERAGE_FILE"] = f".coverage.{PY_VERSION}"
498499
ctx.run(
499500
tools.pytest(
500501
"tests",

scripts/make.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from collections.abc import Iterator
1414

1515
PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
16+
PYTHON_DEV = "3.14"
1617

1718
_commands = []
1819

@@ -49,12 +50,21 @@ def _uv_install(venv: Path) -> None:
4950
def _run(version: str, cmd: str, *args: str, **kwargs: Any) -> None:
5051
kwargs = {"check": True, **kwargs}
5152
uv_run = ["uv", "run", "--no-sync"]
52-
if version == "default":
53-
with _environ(UV_PROJECT_ENVIRONMENT=".venv"):
54-
subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
55-
else:
56-
with _environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
57-
subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
53+
try:
54+
if version == "default":
55+
with _environ(UV_PROJECT_ENVIRONMENT=".venv"):
56+
subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
57+
else:
58+
with _environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
59+
subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
60+
except subprocess.CalledProcessError as process:
61+
raise _RunError(
62+
returncode=process.returncode,
63+
python_version=version,
64+
cmd=process.cmd,
65+
output=process.output,
66+
stderr=process.stderr,
67+
) from process
5868

5969

6070
def _command(name: str) -> Callable[[Callable[..., None]], Callable[..., None]]:
@@ -148,6 +158,12 @@ def setup() -> None:
148158
_uv_install(venv_path)
149159

150160

161+
class _RunError(subprocess.CalledProcessError):
162+
def __init__(self, *args: Any, python_version: str, **kwargs: Any):
163+
super().__init__(*args, **kwargs)
164+
self.python_version = python_version
165+
166+
151167
@_command("run")
152168
def run(cmd: str, *args: str, **kwargs: Any) -> None:
153169
"""Run a command in the default virtual environment.
@@ -328,7 +344,14 @@ def main(args: list[str]) -> int:
328344
if __name__ == "__main__":
329345
try:
330346
sys.exit(main(sys.argv[1:]))
331-
except subprocess.CalledProcessError as process:
347+
except _RunError as process:
332348
if process.output:
333349
print(process.output, file=sys.stderr)
334-
sys.exit(process.returncode)
350+
if (code := process.returncode) == 139: # noqa: PLR2004
351+
print(
352+
f"✗ (python{process.python_version}) '{' '.join(process.cmd)}' failed with return code {code} (segfault)",
353+
file=sys.stderr,
354+
)
355+
if process.python_version == PYTHON_DEV:
356+
code = 0
357+
sys.exit(code)

0 commit comments

Comments
 (0)