From 3220ab5f2f9713dfee169ec5dcc2135e1deaa0f8 Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 18:37:51 -0500 Subject: [PATCH 1/9] Add PyTorch tensor serialization and assertion helpers Serialize torch.Tensor values across the sandbox (detached, on CPU) in json_utils, and add assert_tensor_allclose / assert_tensor_equal with student-friendly failure messages. torch is a lazy, optional import so the lite and full images are unaffected. Co-Authored-By: Claude Opus 4.8 --- pyproject.toml | 11 + src/pytest_prairielearn_grader/__init__.py | 4 + src/pytest_prairielearn_grader/assertions.py | 190 ++++++++++++++ src/pytest_prairielearn_grader/json_utils.py | 19 ++ tests/test_torch.py | 112 ++++++++ uv.lock | 256 ++++++++++++++++++- 6 files changed, 588 insertions(+), 4 deletions(-) create mode 100644 tests/test_torch.py diff --git a/pyproject.toml b/pyproject.toml index 96de862..190582f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,19 @@ dev = [ "networkx", "types-networkx", "nbformat>=5.0", + "torch>=2.0", ] +[tool.uv.sources] +# Use the CPU-only PyTorch wheels on Linux so CI (and the grader images) don't pull the +# multi-gigabyte CUDA build. macOS/Windows fall back to the default index, which is CPU-only. +torch = [{ index = "pytorch-cpu", marker = "sys_platform == 'linux'" }] + +[[tool.uv.index]] +name = "pytorch-cpu" +url = "https://download.pytorch.org/whl/cpu" +explicit = true + [build-system] requires = ["hatchling", "uv-dynamic-versioning"] build-backend = "hatchling.build" diff --git a/src/pytest_prairielearn_grader/__init__.py b/src/pytest_prairielearn_grader/__init__.py index daed16e..d6eb222 100644 --- a/src/pytest_prairielearn_grader/__init__.py +++ b/src/pytest_prairielearn_grader/__init__.py @@ -10,6 +10,8 @@ from .assertions import assert_false from .assertions import assert_fn_approx_equal from .assertions import assert_fn_equal +from .assertions import assert_tensor_allclose +from .assertions import assert_tensor_equal from .assertions import assert_true from .config import ConfigObject from .fixture import WorkspaceFixture @@ -23,5 +25,7 @@ "assert_false", "assert_fn_approx_equal", "assert_fn_equal", + "assert_tensor_allclose", + "assert_tensor_equal", "assert_true", ] diff --git a/src/pytest_prairielearn_grader/assertions.py b/src/pytest_prairielearn_grader/assertions.py index 9aaaaf0..15c2c4c 100644 --- a/src/pytest_prairielearn_grader/assertions.py +++ b/src/pytest_prairielearn_grader/assertions.py @@ -369,3 +369,193 @@ def assert_fn_approx_equal( call_description = description or format_call(func_name, args, kwargs) assert_approx_equal(actual, expected, rtol=rtol, atol=atol, msg=msg, description=call_description) return actual + + +# --------------------------------------------------------------------------- +# PyTorch tensor assertions +# --------------------------------------------------------------------------- + + +def _as_cpu_tensor(value: Any) -> Any: + """Coerce a value to a detached CPU tensor so comparisons never touch autograd or a device.""" + import torch # noqa: PLC0415 + + return torch.as_tensor(value).detach().cpu() + + +def _tensor_detail(value: Any) -> str: + """A short, student-readable description of a tensor's shape, dtype and (if small) values.""" + tensor = _as_cpu_tensor(value) + dtype = str(tensor.dtype).removeprefix("torch.") + detail = f"a tensor with shape {tuple(tensor.shape)} and dtype {dtype}" + if tensor.numel() <= 12: + detail += f" and values {tensor.tolist()}" + return detail + + +def assert_tensor_allclose( + actual: Any, + expected: Any, + *, + rtol: float = 1e-5, + atol: float = 1e-8, + check_dtype: bool = False, + equal_nan: bool = True, + msg: str | None = None, + description: str | None = None, +) -> None: + """Assert two PyTorch tensors are equal within a tolerance. + + Uses the formula ``|actual - expected| <= atol + rtol * |expected|`` elementwise. + ``actual`` and ``expected`` may be anything ``torch.as_tensor`` accepts (a tensor, + a NumPy array, or a nested list). Tensors are detached and moved to the CPU before + comparison, so gradients and device placement don't matter. + + Parameters + ---------- + actual: + The tensor produced by student code. + expected: + The correct / reference tensor. + rtol: + Relative tolerance (default ``1e-5``). + atol: + Absolute tolerance (default ``1e-8``). + check_dtype: + When True, the two tensors must also share a dtype. When False (default), an + integer tensor and the equivalent float tensor compare equal. + equal_nan: + When True (default), NaNs in matching positions compare equal. + msg: + Optional custom failure message. + description: + Optional label for the *Checking:* line. + + Raises + ------ + AssertionError + When the shapes differ, the dtypes differ (with ``check_dtype``), or the + values are not within tolerance. + """ + import torch # noqa: PLC0415 + + actual_tensor = _as_cpu_tensor(actual) + expected_tensor = _as_cpu_tensor(expected) + + if actual_tensor.shape != expected_tensor.shape: + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or "The tensors have different shapes.", + ) + ) + + if check_dtype and actual_tensor.dtype != expected_tensor.dtype: + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or "The tensors have different dtypes.", + ) + ) + + target = torch.complex128 if (actual_tensor.is_complex() or expected_tensor.is_complex()) else torch.float64 + actual_cast = actual_tensor.to(target) + expected_cast = expected_tensor.to(target) + + if torch.allclose(actual_cast, expected_cast, rtol=rtol, atol=atol, equal_nan=equal_nan): + return + + mismatches = ~torch.isclose(actual_cast, expected_cast, rtol=rtol, atol=atol, equal_nan=equal_nan) + num_mismatch = int(mismatches.sum().item()) + abs_diff = (actual_cast - expected_cast).abs() + max_diff = float(torch.nan_to_num(abs_diff, nan=float("inf")).max().item()) if abs_diff.numel() else 0.0 + default_msg = ( + f"The tensors are not close enough (rtol={rtol}, atol={atol}): " + f"{num_mismatch} of {actual_tensor.numel()} elements differ, " + f"max absolute difference {max_diff:.3g}." + ) + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or default_msg, + ) + ) + + +def assert_tensor_equal( + actual: Any, + expected: Any, + *, + check_dtype: bool = False, + msg: str | None = None, + description: str | None = None, +) -> None: + """Assert two PyTorch tensors are exactly equal. + + Prefer this for integer, boolean, or index tensors where exact equality is meaningful; + use :func:`assert_tensor_allclose` for floating-point tensors. ``actual`` and ``expected`` + may be anything ``torch.as_tensor`` accepts, and are detached and moved to the CPU before + comparison. + + Parameters + ---------- + actual: + The tensor produced by student code. + expected: + The correct / reference tensor. + check_dtype: + When True, the two tensors must also share a dtype (default False). + msg: + Optional custom failure message. + description: + Optional label for the *Checking:* line. + + Raises + ------ + AssertionError + When the shapes differ, the dtypes differ (with ``check_dtype``), or any + elements differ. + """ + actual_tensor = _as_cpu_tensor(actual) + expected_tensor = _as_cpu_tensor(expected) + + if actual_tensor.shape != expected_tensor.shape: + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or "The tensors have different shapes.", + ) + ) + + if check_dtype and actual_tensor.dtype != expected_tensor.dtype: + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or "The tensors have different dtypes.", + ) + ) + + elementwise_equal = actual_tensor == expected_tensor + if bool(elementwise_equal.all()): + return + + num_mismatch = int((~elementwise_equal).sum().item()) + default_msg = f"The tensors are not equal: {num_mismatch} of {actual_tensor.numel()} elements differ." + raise AssertionError( + _build_failure_lines( + expected=_tensor_detail(expected_tensor), + actual=_tensor_detail(actual_tensor), + description=description, + msg=msg or default_msg, + ) + ) diff --git a/src/pytest_prairielearn_grader/json_utils.py b/src/pytest_prairielearn_grader/json_utils.py index 8663451..1760d90 100644 --- a/src/pytest_prairielearn_grader/json_utils.py +++ b/src/pytest_prairielearn_grader/json_utils.py @@ -61,6 +61,18 @@ def to_json(v: Any) -> Any: if is_plot(v): return plot_to_json(v) + elif module == "torch": + import torch + + if isinstance(v, torch.Tensor): + # Detach from any autograd graph and move to CPU so the tensor serializes + # whether or not it carries gradients or lives on an accelerator. + detached = v.detach().cpu() + return { + "_type": "torch_tensor", + "_value": detached.tolist(), + "_dtype": str(detached.dtype).removeprefix("torch."), + } else: return v @@ -158,6 +170,13 @@ def from_json(v_json) -> Any: raise ValueError("variable of type matplotlib_figure should have value") elif v_json["_type"] == "sparse": return _sparse_from_json(v_json) + elif v_json["_type"] == "torch_tensor": + import torch + + if "_value" not in v_json: + raise ValueError("variable of type torch_tensor should have value") + dtype = getattr(torch, v_json["_dtype"]) if "_dtype" in v_json else None + return torch.tensor(v_json["_value"], dtype=dtype) else: raise ValueError("variable has unknown type {}".format(v_json["_type"])) return v_json diff --git a/tests/test_torch.py b/tests/test_torch.py new file mode 100644 index 0000000..05bdb4f --- /dev/null +++ b/tests/test_torch.py @@ -0,0 +1,112 @@ +"""Tests for PyTorch tensor serialization and assertion helpers. + +torch is an optional, heavy dependency, so these tests are skipped when it isn't installed. +""" + +import pytest + +torch = pytest.importorskip("torch") + +from pytest_prairielearn_grader.assertions import assert_tensor_allclose # noqa: E402 +from pytest_prairielearn_grader.assertions import assert_tensor_equal # noqa: E402 +from pytest_prairielearn_grader.json_utils import from_json # noqa: E402 +from pytest_prairielearn_grader.json_utils import to_json # noqa: E402 + +# --------------------------------------------------------------------------- +# Serialization round-trips +# --------------------------------------------------------------------------- + + +@pytest.mark.parametrize( + "tensor", + [ + torch.tensor([1.0, 2.0, 3.0]), + torch.tensor([[1, 2], [3, 4]], dtype=torch.int64), + torch.tensor(3.5), # 0-dim scalar + torch.tensor([True, False, True]), + torch.zeros(0), # empty + torch.tensor([1 + 2j, 3 - 4j], dtype=torch.complex64), + ], +) +def test_tensor_round_trip(tensor: "torch.Tensor") -> None: + restored = from_json(to_json(tensor)) + assert isinstance(restored, torch.Tensor) + assert restored.shape == tensor.shape + assert restored.dtype == tensor.dtype + assert torch.equal(restored, tensor) + + +def test_tensor_serialization_detaches_grad_and_device() -> None: + tensor = torch.tensor([1.0, 2.0], requires_grad=True) + # Serializing a tensor that tracks gradients must not raise. + restored = from_json(to_json(tensor)) + assert not restored.requires_grad + assert torch.equal(restored, tensor.detach()) + + +def test_to_json_ignores_non_tensor_torch_objects() -> None: + # A torch dtype is in the torch module but isn't a tensor; it should pass through unchanged. + assert to_json(torch.float32) is torch.float32 + + +# --------------------------------------------------------------------------- +# assert_tensor_allclose +# --------------------------------------------------------------------------- + + +def test_allclose_passes_within_tolerance() -> None: + assert_tensor_allclose(torch.tensor([1.0, 2.0]), torch.tensor([1.0 + 1e-9, 2.0])) + + +def test_allclose_accepts_arrays_and_lists() -> None: + assert_tensor_allclose([1.0, 2.0, 3.0], torch.tensor([1.0, 2.0, 3.0])) + + +def test_allclose_ignores_dtype_by_default() -> None: + assert_tensor_allclose(torch.tensor([1, 2, 3]), torch.tensor([1.0, 2.0, 3.0])) + + +def test_allclose_check_dtype_rejects_mismatch() -> None: + with pytest.raises(AssertionError, match="different dtypes"): + assert_tensor_allclose(torch.tensor([1, 2]), torch.tensor([1.0, 2.0]), check_dtype=True) + + +def test_allclose_reports_shape_mismatch() -> None: + with pytest.raises(AssertionError, match="different shapes"): + assert_tensor_allclose(torch.zeros(3), torch.zeros(4)) + + +def test_allclose_reports_value_mismatch_detail() -> None: + with pytest.raises(AssertionError, match="max absolute difference"): + assert_tensor_allclose(torch.tensor([1.0, 2.0]), torch.tensor([1.0, 5.0])) + + +def test_allclose_description_in_message() -> None: + with pytest.raises(AssertionError, match="Checking: forward pass"): + assert_tensor_allclose(torch.zeros(2), torch.ones(2), description="forward pass") + + +def test_allclose_equal_nan() -> None: + nan = float("nan") + assert_tensor_allclose(torch.tensor([nan, 1.0]), torch.tensor([nan, 1.0])) + with pytest.raises(AssertionError): + assert_tensor_allclose(torch.tensor([nan, 1.0]), torch.tensor([nan, 1.0]), equal_nan=False) + + +# --------------------------------------------------------------------------- +# assert_tensor_equal +# --------------------------------------------------------------------------- + + +def test_equal_passes() -> None: + assert_tensor_equal(torch.tensor([1, 2, 3]), torch.tensor([1, 2, 3])) + + +def test_equal_reports_mismatch_count() -> None: + with pytest.raises(AssertionError, match="2 of 3 elements differ"): + assert_tensor_equal(torch.tensor([1, 9, 9]), torch.tensor([1, 2, 3])) + + +def test_equal_shape_mismatch() -> None: + with pytest.raises(AssertionError, match="different shapes"): + assert_tensor_equal(torch.tensor([1, 2]), torch.tensor([1, 2, 3])) diff --git a/uv.lock b/uv.lock index 5117686..1154bdf 100644 --- a/uv.lock +++ b/uv.lock @@ -2,8 +2,10 @@ version = 1 revision = 5 requires-python = ">=3.11" resolution-markers = [ - "python_full_version >= '3.12'", - "python_full_version < '3.12'", + "python_full_version >= '3.12' and sys_platform == 'linux'", + "python_full_version >= '3.12' and sys_platform != 'linux'", + "python_full_version < '3.12' and sys_platform == 'linux'", + "python_full_version < '3.12' and sys_platform != 'linux'", ] [[package]] @@ -133,6 +135,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl", hash = "sha256:1c797122d0a86c5cace2e54bf4e819c36223b552017172f32c5c024a6b77e463", size = 24024, upload-time = "2025-08-14T18:49:34.776Z" }, ] +[[package]] +name = "filelock" +version = "4.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e6/86/a5b9ec254b90efb180e390e31a4fa50a93b714d6e4174fa9a4ee25607159/filelock-4.3.1.tar.gz", hash = "sha256:4c5ee627c401f1863ac6a0de9a14a28d3bb5f8c730b45e2fd6e5dbc79cf34b9e", size = 742330, upload-time = "2026-11-23T18:01:13.656Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/53/7b/678c8fbd372ff96375ac0bbdd20b78f20ef8ba6ca5966c49548fa5886557/filelock-4.3.1-py3-none-any.whl", hash = "sha256:79e43df8e9fe509cd83a3899a7c186c8077cbbe4d200a1ed3705c2f3bb6bc487", size = 244559, upload-time = "2026-11-23T18:01:12.261Z" }, +] + [[package]] name = "fonttools" version = "4.61.1" @@ -182,6 +193,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c7/4e/ce75a57ff3aebf6fc1f4e9d508b8e5810618a33d900ad6c19eb30b290b97/fonttools-4.61.1-py3-none-any.whl", hash = "sha256:17d2bf5d541add43822bcf0c43d7d847b160c9bb01d15d5007d84e2217aaa371", size = 1148996, upload-time = "2025-12-12T17:31:21.03Z" }, ] +[[package]] +name = "fsspec" +version = "2026.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/77/cd/9be253869fc42e764de7f3dedd6969af7d44ff9c3375214a3442a6f3fc08/fsspec-2026.9.0.tar.gz", hash = "sha256:0f08147951c8cb31d844c3547d631053b127863b60be04cf06e121333ee0e2fe", size = 333545, upload-time = "2026-09-18T17:50:42.825Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6c/c0/a98505f18594f1bce828bb159cec0fcf9860562f1a2c85913409fc8f3d9e/fsspec-2026.9.0-py3-none-any.whl", hash = "sha256:8dd6e646e99ea382bd85f97a45e6b526a442d79423a7dc673f1e2756d05fcb5f", size = 221738, upload-time = "2026-09-18T17:50:41.341Z" }, +] + [[package]] name = "iniconfig" version = "2.3.0" @@ -191,6 +211,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, ] +[[package]] +name = "jinja2" +version = "3.1.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, +] + [[package]] name = "jsonschema" version = "4.26.0" @@ -384,6 +416,134 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/cb/940431d9410fda74f941f5cd7f0e5a22c63be7b0c10fa98b2b7022b48cb1/librt-0.7.5-cp314-cp314t-win_arm64.whl", hash = "sha256:08153ea537609d11f774d2bfe84af39d50d5c9ca3a4d061d946e0c9d8bce04a1", size = 39728, upload-time = "2025-12-25T03:53:03.306Z" }, ] +[[package]] +name = "markupsafe" +version = "3.0.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/38/9b/e422a865e1d5d57d0e509b4e0bf1c1a70a7f6382c29a5aa428df994c8bc8/markupsafe-3.0.4.tar.gz", hash = "sha256:2e9ad7dd851bf45fab9f75cbff4cb493fee9979e8d8c7c9c3ee119022518edd6", size = 153777, upload-time = "2026-10-02T23:07:22.29Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/32/55/18dbb4778b30ada5ce071608503cc3edc9e14e13d868c17a6d178fc30f7a/markupsafe-3.0.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:9e25feb9e330b63edb0278a0acdf85e50d0cb0fbf49c3084abbe4e24ae195346", size = 11520, upload-time = "2026-10-02T23:04:36.299Z" }, + { url = "https://files.pythonhosted.org/packages/6c/14/0b05f79b4733e264a18d08fe08fa1df7347630ff32a6cb82180d9dccec55/markupsafe-3.0.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7d3391b2188d18737cb2fa147028b1096236eaa7e156446c650a489fa2cadc91", size = 12063, upload-time = "2026-10-02T23:04:37.291Z" }, + { url = "https://files.pythonhosted.org/packages/ca/3a/63ba10b6c1463216b3e4df669a9f0e5a3b0c3071557d2e8229e3968c79fb/markupsafe-3.0.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:849dd2bb0e5e4ab2b71c7191726a4a8d5aa8a610daa584728cbee0b710ddc4ef", size = 24321, upload-time = "2026-10-02T23:04:38.262Z" }, + { url = "https://files.pythonhosted.org/packages/1a/2e/5f015261b76ad633d187ef6f388b413aedd64a8773c4df59e530a0be5525/markupsafe-3.0.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:befb4158af32106b9a93db8d6d1d1cbbd418c0d5aca0cabb7b1780abf0c89169", size = 28845, upload-time = "2026-10-02T23:04:39.295Z" }, + { url = "https://files.pythonhosted.org/packages/33/cf/26e594b26be40c2f1fec63ccf8a8b99d0335a5b2cbe84835c7d82a994375/markupsafe-3.0.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:71f88e749ea29f67f21f3b36433c1dc54c7729ed2a6d9e2da2e0d9e0d7b224eb", size = 24701, upload-time = "2026-10-02T23:04:40.348Z" }, + { url = "https://files.pythonhosted.org/packages/81/a5/a513b76c139a3915b43404324e55c0b7979ae4f0d39eb6f075b0282e90a8/markupsafe-3.0.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6da83a088f8ef93b2d483a8232a4dbf4d69d3d8496b568a03c56becac43e1808", size = 22961, upload-time = "2026-10-02T23:04:41.372Z" }, + { url = "https://files.pythonhosted.org/packages/46/cf/4c66192c100b4542bcbe392ae06696b670f66927be3ac38a213234778ff9/markupsafe-3.0.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8f0fac8b13d14bb06c68195f849371924ae53dd7b1c00fed24650f704383b692", size = 21920, upload-time = "2026-10-02T23:04:42.429Z" }, + { url = "https://files.pythonhosted.org/packages/cb/17/ac3662678bfbad649893117ada2ba44dc30bf56884e84f13154a792b10f1/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4a7cdc2a420ca01058182da4253329764d4bfa055564d1eced90e6ba1e8b1d3d", size = 23726, upload-time = "2026-10-02T23:04:43.531Z" }, + { url = "https://files.pythonhosted.org/packages/f7/af/fe47cee339180a69ebca3c57fb3483d0f5cbd1e8337d1871fb1d9c1aebee/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:83b3944fea42a8400edf92fd1770fb8d0d4f7de651353bd2d8525a92dba69a21", size = 22539, upload-time = "2026-10-02T23:04:44.618Z" }, + { url = "https://files.pythonhosted.org/packages/12/32/d55440ba140442800e02d799c9cb5ab597bf6ebdb1177b5ea39a11f797bd/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:8138eb83940ec7299024d92d4dee45f601b9e6c5ffde9d25f4e35e326203c707", size = 23963, upload-time = "2026-10-02T23:04:45.656Z" }, + { url = "https://files.pythonhosted.org/packages/50/9d/9c86042cb364c2ad4c971e6d1247929effd25f714cd7ee11b05e6316445b/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:811d02d5122171c1941357efd8f9bf4ffe907b7f0a1a4e729a880e4be3f46e3e", size = 21506, upload-time = "2026-10-02T23:04:46.671Z" }, + { url = "https://files.pythonhosted.org/packages/75/ef/5b824f03ba40c3b3652b6272d083d2fc4fcdd440de519a3a39ba2c3e7262/markupsafe-3.0.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:50b5bedc9ed8a94fc8857a42ef4f84a81ea88f8d4f05dc8705fb23ee6d8dcca7", size = 22955, upload-time = "2026-10-02T23:04:47.698Z" }, + { url = "https://files.pythonhosted.org/packages/1e/e8/44cfcb5ea40e5e43cec7793ef90704ed0c475280839076c4345757eb8e59/markupsafe-3.0.4-cp311-cp311-win32.whl", hash = "sha256:2e5a7cd7fdd14fcb1ae5d7d8bf23d24fbd1daefd1fbca2580132e1ea75f098b5", size = 14094, upload-time = "2026-10-02T23:04:48.788Z" }, + { url = "https://files.pythonhosted.org/packages/91/89/f2b509f7bf79352e40117824c1070dbeafd4df67031d3fa98165a3134228/markupsafe-3.0.4-cp311-cp311-win_amd64.whl", hash = "sha256:fdb4ca07ab75ffadab4a8b135ad59cdbb3156b99310f3d565370da74a15d6bd3", size = 14328, upload-time = "2026-10-02T23:04:49.801Z" }, + { url = "https://files.pythonhosted.org/packages/2b/5a/ccf22672a0f64dc682306e288f0dabcb06c7a201f3bb6e6cbf86d9e8ad03/markupsafe-3.0.4-cp311-cp311-win_arm64.whl", hash = "sha256:569d65055d367e3dcdf30c3f41119467b73d9ee9faf332bdf40402644f5ac08e", size = 14188, upload-time = "2026-10-02T23:04:50.847Z" }, + { url = "https://files.pythonhosted.org/packages/81/09/4c59d56b8461ae8eb0d8ba34bb25b7e618547044679d58a82ef9b2479fc1/markupsafe-3.0.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:61631e08084be9e21a8967ec3139c7616ed7c5e9368e05c86d1b39562c8a57b6", size = 11658, upload-time = "2026-10-02T23:04:51.876Z" }, + { url = "https://files.pythonhosted.org/packages/a2/f0/d6613774d86fbf6d145751d43c59875e47a6f9f17daee0aef173bd36d90e/markupsafe-3.0.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0930db9bdc62d22944e10b066448bb65dc9abe9112880c7cab8da54db4284d5f", size = 12050, upload-time = "2026-10-02T23:04:52.931Z" }, + { url = "https://files.pythonhosted.org/packages/0d/f2/8f18e0b806eb13c1f8d07d917a720831ead54253a6dec011fbc78098a6f8/markupsafe-3.0.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6a45c3d514f2436064db00d7fc8778d888f0236ebfed649b53d13a59e69ad51b", size = 24363, upload-time = "2026-10-02T23:04:53.895Z" }, + { url = "https://files.pythonhosted.org/packages/60/ce/fa07dbe8a5675558fa36dea033e19995bc783de2dec5f540ccb9030b06aa/markupsafe-3.0.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1e1451fab512d1bcc3dc26988ec1edb0b82c2db909132872cd9356070a6b63df", size = 28525, upload-time = "2026-10-02T23:04:54.905Z" }, + { url = "https://files.pythonhosted.org/packages/85/40/be87c01f3868ec217f8a2015089d71c22c8c5a75324822e5ed1cdd87210d/markupsafe-3.0.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:bd3ce56ae2cbae3ba82b683bc425cd7e48d2ed8b10f3e818186b6f5646d9271c", size = 24733, upload-time = "2026-10-02T23:04:56.229Z" }, + { url = "https://files.pythonhosted.org/packages/4f/a7/aeedb5140afa41fc74c225e9184ab96723a6e873b6ee1c9fede7283456d8/markupsafe-3.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8e124f974786f831d6043728e38296969d3579db8896fe004682f5758e613581", size = 22985, upload-time = "2026-10-02T23:04:57.521Z" }, + { url = "https://files.pythonhosted.org/packages/c3/fc/e91352bb08c6a59da3ef0909d457bf95a5f5908fbf151b30a06d9dbcfbb4/markupsafe-3.0.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c02e8f18bdedba082cef725942ac823b9b60656db07f7e265cb31618dfd00d77", size = 22001, upload-time = "2026-10-02T23:04:58.597Z" }, + { url = "https://files.pythonhosted.org/packages/5d/f8/bffee5e7d2a3deb59748a797650a48af7e672025cf641a79344a771ad106/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9f098115c247e11d138ab83a28fa0323c77015007ea2df73ba5fd714dfefd67c", size = 23793, upload-time = "2026-10-02T23:04:59.686Z" }, + { url = "https://files.pythonhosted.org/packages/ed/59/b853d6628ecb4d658e1d637224846d5e9bb4adf4f8df97f3be9f29dce2ec/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d5f93ebbeb8032d47e349328ec8662d973d9b05a70b3c35df1f91fe419b84749", size = 22640, upload-time = "2026-10-02T23:05:00.768Z" }, + { url = "https://files.pythonhosted.org/packages/09/b2/1506df394f0f075797c418d0301498f49e43be194e3ffcb49e6fe6ccf022/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:64511c54db4e4987aef4c41923235927428729e8174c5dba488429be70a998ed", size = 24074, upload-time = "2026-10-02T23:05:01.813Z" }, + { url = "https://files.pythonhosted.org/packages/c7/81/5ed69cda630ac69ef60d06c09ba5a7f84ff66a2e28cf986fd5614ab3c6e6/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:e1a622f13970d81f95d0c72f9dc090dce9085fccfa4c9f2174377ee32bd15786", size = 21563, upload-time = "2026-10-02T23:05:03.239Z" }, + { url = "https://files.pythonhosted.org/packages/0c/fe/fb1e79be0fea60aa32602ebefc9c35a82bb42b4df157285ab7dfec12341a/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c9a7f43c0b202b334cc9184af09bb8f21d3a209e038efaf106936fb69e6b026e", size = 23048, upload-time = "2026-10-02T23:05:04.479Z" }, + { url = "https://files.pythonhosted.org/packages/c8/52/7632a53360671a9b750cdbabaf9cdd89f18b42248b8e4cb42c0b0296e459/markupsafe-3.0.4-cp312-cp312-win32.whl", hash = "sha256:f0ec3b750b59375eab5b0fb2b9254810c00a3375be6d789899f1055a1d556237", size = 14108, upload-time = "2026-10-02T23:05:05.513Z" }, + { url = "https://files.pythonhosted.org/packages/3f/bf/62495e180b7000aaf30000fff849e933f74264638057176cf46852500adc/markupsafe-3.0.4-cp312-cp312-win_amd64.whl", hash = "sha256:11935df9bf455ed0c04eb87bcd720f02b1fe5e02128a9430f23aed6f93336fc7", size = 14303, upload-time = "2026-10-02T23:05:06.538Z" }, + { url = "https://files.pythonhosted.org/packages/c5/8e/4c24208776a65878d656996945aacfbfe010d3720d1a98fc0eb8491fc03b/markupsafe-3.0.4-cp312-cp312-win_arm64.whl", hash = "sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9", size = 14174, upload-time = "2026-10-02T23:05:07.617Z" }, + { url = "https://files.pythonhosted.org/packages/6d/18/4bc5ba32499e87bb2b0ef5b3a9bb9c00a131fa961ddf0be548cb550f548b/markupsafe-3.0.4-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:de8b364c423ef0a4bad9069657d617f9a5d2b2062457a89b1fa16ee199c399c1", size = 12786, upload-time = "2026-10-02T23:05:08.709Z" }, + { url = "https://files.pythonhosted.org/packages/4e/6f/17f0c099bf25f3e31e63cc19244d9f6af861a9a4ab778c203997903cfdd0/markupsafe-3.0.4-cp313-cp313-android_24_x86_64.whl", hash = "sha256:34bdde374c5932765d7dc685c4a1d191a3207852d67e8e0a9eb6ea85156181f1", size = 12510, upload-time = "2026-10-02T23:05:09.93Z" }, + { url = "https://files.pythonhosted.org/packages/11/af/1a141081b905036ee904ec4bd945e1f70b4e1b32d33c4e59e8cf1d58b247/markupsafe-3.0.4-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:6bd9e1788e15bfcf6a9082de42e30387e7b85d211ab21e57a939bb8cfaaf8d96", size = 11583, upload-time = "2026-10-02T23:05:10.884Z" }, + { url = "https://files.pythonhosted.org/packages/e7/0a/a89385ae590232622a03e091805cff12f24fabe6c11e0e8bae096cece81c/markupsafe-3.0.4-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:5066b244f576f91afc8ee3ba029a89f99d39c79b1853fe9d39bea9f0afbec148", size = 11801, upload-time = "2026-10-02T23:05:11.913Z" }, + { url = "https://files.pythonhosted.org/packages/ed/85/ea548dc013962eb73653124bc595635fbf9e0fa41d1f181a967ccb784dfb/markupsafe-3.0.4-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:7a83aa6e4805df46fed18e989d3d16f86ef60cb50bbc8d9ce3a6be89165fbf6e", size = 11443, upload-time = "2026-10-02T23:05:12.887Z" }, + { url = "https://files.pythonhosted.org/packages/cc/72/15f2e5ec9cf2eb00d5cdfe968d94e4156a7bd7303832c3f3b2c403a36839/markupsafe-3.0.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:2d1b7d9308288661f56672b1b157d75fc536714d3638487bbea17b6318a78248", size = 11665, upload-time = "2026-10-02T23:05:13.829Z" }, + { url = "https://files.pythonhosted.org/packages/ca/e0/4030bea613677e333c8a2c901fd405055f657f9d06acba5b7357984b6ef7/markupsafe-3.0.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:73e77980c7207854f00fc4e71fb1626868d5740ab4012623d55c7a99ad122a72", size = 12061, upload-time = "2026-10-02T23:05:14.807Z" }, + { url = "https://files.pythonhosted.org/packages/f3/a5/28b76a7449eb702966b88bef599e2360b411fbb3afeee8fe560939be06ec/markupsafe-3.0.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7018d4af1cd272e847aa5917983ab5e83e4f6579f9dbfecd4a79c0ca80b144c2", size = 24395, upload-time = "2026-10-02T23:05:15.909Z" }, + { url = "https://files.pythonhosted.org/packages/07/6c/21232811afc3a063b5e934b1ae2efda52f46154ec382f585149c020e61fe/markupsafe-3.0.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c90d5b3d4e944e065a301d741b3c1d784f6bd1f503aa68b4967e32b2ba313d85", size = 27183, upload-time = "2026-10-02T23:05:16.976Z" }, + { url = "https://files.pythonhosted.org/packages/14/38/6ccdfa5b59049cb36fb80cbc80aee9cf1fc9bb77d1335ad435f2070b08cf/markupsafe-3.0.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:18a801868a884f216e784d7d14db2a4077143ce7610440aee2ce8f734e7cfcde", size = 24772, upload-time = "2026-10-02T23:05:18.209Z" }, + { url = "https://files.pythonhosted.org/packages/63/e0/cec6865dfe88cb48fedd4b20aed6af5158e41092adcbf3e028bcc6ec2108/markupsafe-3.0.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:434139499bb20b502ed3baa1f169e618f924a97e7a777fea1a49446d80106cf6", size = 23017, upload-time = "2026-10-02T23:05:19.286Z" }, + { url = "https://files.pythonhosted.org/packages/ee/76/6ed4940bb7648a9aac457c14f870cfdd5105f139a0fb1f29cd61fafa47d1/markupsafe-3.0.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9e227f3dbe6bde7491cf0a9965d00b88c6b1a4a95d11480ddf88bb96d397c19f", size = 22036, upload-time = "2026-10-02T23:05:20.352Z" }, + { url = "https://files.pythonhosted.org/packages/a1/4f/ed476226d4fe46a09090a36025bf319296810028df55eb12f1253b540f3a/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b8cd1f918b26fd7b1832ece557cc18f2d8747309ff8b3f0ef9d4250c5ad67a39", size = 23786, upload-time = "2026-10-02T23:05:21.576Z" }, + { url = "https://files.pythonhosted.org/packages/9a/35/66ff30450e35ef5fba9ebc930c9411747e537fd9447b65e44f5007e2b84d/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:a5fcffb37e602b0b3c1638a97746b9b96125caa9bcf6fa41d337a9261de231ee", size = 22672, upload-time = "2026-10-02T23:05:22.922Z" }, + { url = "https://files.pythonhosted.org/packages/32/0b/72f45ce4b4efcbca4b80cf1b06703eff0be8d37e82abb78f66c85a7ead1e/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5989cb26b2e1efc6a42216a9f6b5ee495ce5ace2e5b352a9af489976b32d1ee2", size = 24107, upload-time = "2026-10-02T23:05:24.175Z" }, + { url = "https://files.pythonhosted.org/packages/d2/03/71776e5fdcba04614b384cc102e8a4198208579d896fd1394cb7cb9aa900/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:add96447a86d205ab616665d53b2950ee81083757f56e6ea833c8b2917646b46", size = 21615, upload-time = "2026-10-02T23:05:25.215Z" }, + { url = "https://files.pythonhosted.org/packages/ab/5f/801ce02a02e7aee0f784b1ec7843026178f6adeb9c93ac67eb1992a9a84d/markupsafe-3.0.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:2628d3a8cb648ecebb3c5d6b0a1052d400e4d8b7ac0fb786be8d285b50040d17", size = 23076, upload-time = "2026-10-02T23:05:26.423Z" }, + { url = "https://files.pythonhosted.org/packages/4a/85/c43776625428f3bb4a61e8633940400e3efe6409e3c6f5bff26de5e45618/markupsafe-3.0.4-cp313-cp313-win32.whl", hash = "sha256:672d207103e6b16ca098611b0f9efad6bc00afd47c03d6ef62186495ca677dc0", size = 14118, upload-time = "2026-10-02T23:05:27.716Z" }, + { url = "https://files.pythonhosted.org/packages/6f/36/163da64de88a13db79214ef75fa041be7fa13bdb42261cf5b7484de14bfb/markupsafe-3.0.4-cp313-cp313-win_amd64.whl", hash = "sha256:1f1f9477e174582b0a1b583d60b66e1f2cf5d3fe12cee985e4aedf44766600e5", size = 14313, upload-time = "2026-10-02T23:05:28.749Z" }, + { url = "https://files.pythonhosted.org/packages/9f/a8/9b662783ffaa1149221432a923cee562f78b9cbbb8baa3df9b3753e63e1e/markupsafe-3.0.4-cp313-cp313-win_arm64.whl", hash = "sha256:06de8ef6331f6e822c28d577dc8bf43fe398800477c49498f38fc38b67ff33fc", size = 14189, upload-time = "2026-10-02T23:05:29.917Z" }, + { url = "https://files.pythonhosted.org/packages/5c/c3/a944f3b0df22bd129e96915b9f4e98d2eeca6516687d7618304a966c3c74/markupsafe-3.0.4-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:4ed644d75aa94a2baf7ec3a96eaa160ea58c742eb9d27c6506053c5c40fc84ed", size = 12787, upload-time = "2026-10-02T23:05:30.971Z" }, + { url = "https://files.pythonhosted.org/packages/d4/d6/a44863f69d88b6c7e27889108f70d47aed259edf89d5df3c5fca1eac87d6/markupsafe-3.0.4-cp314-cp314-android_24_x86_64.whl", hash = "sha256:6d2a9efe686f9de00d0d1ea32a4a5a86d558a2277501bd78d964214eab625e59", size = 12525, upload-time = "2026-10-02T23:05:32.263Z" }, + { url = "https://files.pythonhosted.org/packages/17/8f/168ba80e532dd6a93f96f8f706f1ad41d7990b6e1aeedc1cc0d211a33497/markupsafe-3.0.4-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:8781a792a070cf2bd1b86d3aa943894115faaba6e88122a7bf32d62072742453", size = 11589, upload-time = "2026-10-02T23:05:33.251Z" }, + { url = "https://files.pythonhosted.org/packages/32/b3/aa2c95a574d3af39403a469b295886eb9b6d448da568cbebb5a2cbfdc2e5/markupsafe-3.0.4-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:971a3bbb75d97ae4e2e8f7d4834236f86f85f0c85e04ab2e191db1123b04f80b", size = 11801, upload-time = "2026-10-02T23:05:34.315Z" }, + { url = "https://files.pythonhosted.org/packages/60/d0/34b810107d83840e768bf485de795893ebbae35b26ab061b487adfa0a692/markupsafe-3.0.4-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:8909c2f1c6dd65e054ac4b573a91c8384d1492281e55d82d159d653f7a13adf6", size = 11447, upload-time = "2026-10-02T23:05:35.302Z" }, + { url = "https://files.pythonhosted.org/packages/6c/ab/2f8488f0f817a39fca068d2b17daf446bf5cdb3eae28c3720af534d873b4/markupsafe-3.0.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:4cf3468d5ec187ffffcaca8e61929a37448f215dafc1386a12c750a72fe53634", size = 11722, upload-time = "2026-10-02T23:05:36.363Z" }, + { url = "https://files.pythonhosted.org/packages/ad/40/e2d117b048d47282ade906fbfd92814cbee5647afc13fda88a3406039372/markupsafe-3.0.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:52704c5d36eb6dda8866493decd61111fff86244c9b1ad225ca01b9e91e5970f", size = 12061, upload-time = "2026-10-02T23:05:37.397Z" }, + { url = "https://files.pythonhosted.org/packages/9a/a8/73a81135e85ba66217f5af7facb03bbb386807e1a729ab64532e4c802652/markupsafe-3.0.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1caa2fa5a6184fb233153b35f654e6687bd555476f6170f29d8ee9be1a8b0af9", size = 24434, upload-time = "2026-10-02T23:05:38.407Z" }, + { url = "https://files.pythonhosted.org/packages/ac/ca/fa9216dd01efee2dfdacafe7df32b4d0170fbac694b0c258a193d6e53999/markupsafe-3.0.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:387d8cd30e69b3f0a72877b9ae717033396404e19095b17fe89753a981fda44f", size = 27183, upload-time = "2026-10-02T23:05:39.581Z" }, + { url = "https://files.pythonhosted.org/packages/fa/4e/a469509e538d37af51103b17b073126973f2b1cbf197ff32c7ddf025cfe5/markupsafe-3.0.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:051417f74bcaaefa316276e0ff723f541616ca51043d070da00249d9bddd3e3c", size = 24813, upload-time = "2026-10-02T23:05:40.671Z" }, + { url = "https://files.pythonhosted.org/packages/8f/db/d7282caf7ab03af44d5d6fdbaa019b35c7d7f1c90588b839c07cba640d6a/markupsafe-3.0.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8e9f292fcda89b324f2f5c91d13f1424a153e40fc2756f38ee23b15835ff300", size = 23049, upload-time = "2026-10-02T23:05:41.864Z" }, + { url = "https://files.pythonhosted.org/packages/30/f3/b6a425206e6964efda6acee544d0eb01d1501784d0b8e2dcc74986f33b17/markupsafe-3.0.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:df1ae86ff54725a01fa1a0510b914ca53a161b7050be74f6204e24aded5971d0", size = 22088, upload-time = "2026-10-02T23:05:43.014Z" }, + { url = "https://files.pythonhosted.org/packages/ea/8a/84d3582fc1f0d5bd466cdf2eebf175e172158a6e70701aacec1de1b35430/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:8965520ac587c94a4ac48b729be3d8b8de00af39699b17585dfb599babe77977", size = 23846, upload-time = "2026-10-02T23:05:44.098Z" }, + { url = "https://files.pythonhosted.org/packages/1c/65/db101cce51b7ba4864ac491a9859d297dd1adf0e55b103fee9db9c47c527/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:340cbb1957ba99929cbf19a75626d36ba1ae21d1730b287d1cf7f824a20c4fc7", size = 22674, upload-time = "2026-10-02T23:05:45.23Z" }, + { url = "https://files.pythonhosted.org/packages/e0/49/ddee9813d71db0c7a5c9d97c832125e6758a0c844777f1cf076569bb0e22/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:3a93d9616ddecfb393727a0041a562cf0b15a244e20f2bd25efc7949be4c4f17", size = 24104, upload-time = "2026-10-02T23:05:46.398Z" }, + { url = "https://files.pythonhosted.org/packages/aa/0e/7d8518d726726870a2399d69fd30d0fa36c5e57a2132c336b58d7c491073/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:d2e56fd3b00222722abfb3f5f0759ddbae4b90811b5ad4343c64030ad1bde70c", size = 21637, upload-time = "2026-10-02T23:05:47.48Z" }, + { url = "https://files.pythonhosted.org/packages/b4/b0/b505e8a361ba557dbf3b3aa7331ea39b00d2022a26e925ff8463b9714bb3/markupsafe-3.0.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:0d9c47709875fdb321452056622e930c52afbc07a7d780762fbb8b4d91ce6fa4", size = 23081, upload-time = "2026-10-02T23:05:48.611Z" }, + { url = "https://files.pythonhosted.org/packages/1c/ea/9cc3cea873f980c75cbdb6f4277ce30ee955de38be0b3d02f14c108e0698/markupsafe-3.0.4-cp314-cp314-win32.whl", hash = "sha256:38fc55594dab834470b6733dead2ee9e3f657fb0608c769dcafa0ba5ab52f45c", size = 14272, upload-time = "2026-10-02T23:05:49.707Z" }, + { url = "https://files.pythonhosted.org/packages/80/f0/5792ff768a410f93ee3f84fc19345295ffc352d2c936b424cb37e514714c/markupsafe-3.0.4-cp314-cp314-win_amd64.whl", hash = "sha256:c1bc67752d5f21013cfe430df4062441714eab79f65a6a05e01505957e9c35fe", size = 14501, upload-time = "2026-10-02T23:05:50.788Z" }, + { url = "https://files.pythonhosted.org/packages/5f/cf/3d074a8edffcc6899355232ff2543ae8d929733239596423b7db79698bc9/markupsafe-3.0.4-cp314-cp314-win_arm64.whl", hash = "sha256:7e1636da3d8dfc220b6dd10264db5f2b165e4888c4518594898fbe381049af8a", size = 14364, upload-time = "2026-10-02T23:05:51.857Z" }, + { url = "https://files.pythonhosted.org/packages/d9/31/87ce42159aae2163cf3bbbd0c44bc87780510eecab1ea3859099aed95dcb/markupsafe-3.0.4-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:805c8b84534fa10891890f0e4be39f3a99e94615d93e8836bf9fa1fdca2feeb2", size = 11759, upload-time = "2026-10-02T23:05:52.951Z" }, + { url = "https://files.pythonhosted.org/packages/5f/53/b047207eeb7752e960aca3eb1df5fb7eefa7dd4c62ac49bb156456c8a702/markupsafe-3.0.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:fa95848c929b6a75f6848d3c9793e59db365ee436776e57db835cdbfa79ba977", size = 12096, upload-time = "2026-10-02T23:05:54.066Z" }, + { url = "https://files.pythonhosted.org/packages/ee/51/4326c88a13c7b755657d44b4bb986f8c3d9843ecba7e22d98661d87f9a57/markupsafe-3.0.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e916035e3e9930cbdfdd10abf48861340221857f45509565898e012263f7b289", size = 25699, upload-time = "2026-10-02T23:05:55.15Z" }, + { url = "https://files.pythonhosted.org/packages/f2/bb/990581b7474bfcf2cf34bed6ba5ea23bd87adb9d671213d68e88620e7a6b/markupsafe-3.0.4-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b4d12837e0203bbace818ff4a7461afdcd78bcd782351cea148139180d7bcffe", size = 27804, upload-time = "2026-10-02T23:05:56.29Z" }, + { url = "https://files.pythonhosted.org/packages/6b/89/89491878c28e8291f5aa2fffe2c2d57230d10ae366d55dd810b840513d78/markupsafe-3.0.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5086f9975abb1ab531ee6afca1761e4b59a19b446f3f6522ed776963228cfe5a", size = 25912, upload-time = "2026-10-02T23:05:57.416Z" }, + { url = "https://files.pythonhosted.org/packages/30/77/680998b54efdea06fc114565cd739b6d059f826a0279219b218dfa750d29/markupsafe-3.0.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b4a635a0487774f841cb1fb62e907e7195cc95bc761e053184b8acc3ceb20733", size = 23623, upload-time = "2026-10-02T23:05:58.557Z" }, + { url = "https://files.pythonhosted.org/packages/ae/75/2709f5ac5de9467b40b10e2bb8f89cc63dfb74582e09aa734b1124a217de/markupsafe-3.0.4-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb96e6e088d6cf71c1ea977510948320234824cf226e32f6f6e044f7a9c82b34", size = 23301, upload-time = "2026-10-02T23:05:59.94Z" }, + { url = "https://files.pythonhosted.org/packages/a0/c8/39eadc6c5b14c9c7679bfb98f4d4c6a97863b5beb91839aca4d2d6e16e55/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8b5d563170ff8ba3181caa967c99a3c804d1dedb702c7cb93a6a7c32247da978", size = 24950, upload-time = "2026-10-02T23:06:01.289Z" }, + { url = "https://files.pythonhosted.org/packages/1a/5e/01037f8a43e8ccb0bffb4fbdc5212db05bf080fdd7286cd392332d58128a/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:396ec4e65cc889f69786b3b89478b471cee5a3bcf468b9d9bb03e1a30fb291fc", size = 23330, upload-time = "2026-10-02T23:06:02.441Z" }, + { url = "https://files.pythonhosted.org/packages/d4/f4/23e83ce0596bb0cbe670502d31df8f757bbd01a392aa486fa3b40d1ed399/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:15ba9e28640feef770374b116a6f019c21f52404aeabe516aa7f800587b98cfc", size = 25239, upload-time = "2026-10-02T23:06:03.579Z" }, + { url = "https://files.pythonhosted.org/packages/88/5b/3708897368073cc683d524750474f41a77d2986152c380dcc55b20fdf340/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:d920abdfa61279ba1a2ef9484aab07bf03331f8c08a10120fa332353d06e6932", size = 22767, upload-time = "2026-10-02T23:06:04.699Z" }, + { url = "https://files.pythonhosted.org/packages/c6/61/ebda1307864b409e6b3115757a3d4a09cca46cfb6cc65191b5de226b424b/markupsafe-3.0.4-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a9f54054101545a9a9cccefddf54316aa6e4491611fcbef9e91b3b6bebec04f6", size = 23668, upload-time = "2026-10-02T23:06:05.9Z" }, + { url = "https://files.pythonhosted.org/packages/09/15/98075cceac3b5ba0dbb8e4762a847be967d2befc349a2cf2d0ac77f62c9d/markupsafe-3.0.4-cp314-cp314t-win32.whl", hash = "sha256:12a606a492de952afcb43b59a14aaaaad120e708d3663dd0fdf2d738d427a691", size = 14301, upload-time = "2026-10-02T23:06:07.109Z" }, + { url = "https://files.pythonhosted.org/packages/0b/a3/768b560fcc4156685cb563d922b217810cfa7bc135773367f62f1f9d2078/markupsafe-3.0.4-cp314-cp314t-win_amd64.whl", hash = "sha256:a18f38cafc329bac5e3c2b96c765b4c96d3d103421ed22ab7988c1e3fce27464", size = 14526, upload-time = "2026-10-02T23:06:08.276Z" }, + { url = "https://files.pythonhosted.org/packages/93/63/da554b4c97a6b0ea3229ca7fe8cbfb620be81613d517f482e85958550537/markupsafe-3.0.4-cp314-cp314t-win_arm64.whl", hash = "sha256:eba154571c16e032112afac0dc2dfe9e63c2ceb7aedd07bb7eecf2ce26d4dd4c", size = 14421, upload-time = "2026-10-02T23:06:09.402Z" }, + { url = "https://files.pythonhosted.org/packages/a9/30/54d11c8ca027114898cab97421fb39e4ffd9ddf47cdbc44df2ec76722da9/markupsafe-3.0.4-cp315-cp315-android_24_arm64_v8a.whl", hash = "sha256:737c9c3981998eba27f11786f84fddcbabc74068b72a4a1f454ea02094b57b65", size = 12791, upload-time = "2026-10-02T23:06:10.485Z" }, + { url = "https://files.pythonhosted.org/packages/10/6d/97c913e253a14bd3cd0e15a5c56d13203b823fa7ee32498342896a072dc4/markupsafe-3.0.4-cp315-cp315-android_24_x86_64.whl", hash = "sha256:489505b03f692c3f376394e49194fa7a7f9e8558d6e293a7056a0032b0c38163", size = 12527, upload-time = "2026-10-02T23:06:11.834Z" }, + { url = "https://files.pythonhosted.org/packages/26/f9/b86d032042a4d597d9e1997f0e5f63a3eedaf11258e0a05760b0a0a826ea/markupsafe-3.0.4-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:077293e425f28ec737dbcad442a71752e28f8ae27cde3d68acd1fb212091cd92", size = 11602, upload-time = "2026-10-02T23:06:13.122Z" }, + { url = "https://files.pythonhosted.org/packages/f2/dc/73c14c1eedf0ac5fa3292ba43435e6c49d2c2050f33cebde541f8f4807f1/markupsafe-3.0.4-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:9348cbb300d224fe3b89793262cb093504d4ae927004468463f745188a193e4a", size = 11817, upload-time = "2026-10-02T23:06:14.227Z" }, + { url = "https://files.pythonhosted.org/packages/8f/69/2c2fcaa5fcee22d72c7819c0d536fd181c74a688e6143845419579cd2863/markupsafe-3.0.4-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:b807e598953730f82e4eae3bd30f6a122cf6b31c398c6b504c0e04c13c170429", size = 11446, upload-time = "2026-10-02T23:06:15.574Z" }, + { url = "https://files.pythonhosted.org/packages/88/54/9e5ec76c62e6e2834d5a93623018c943e8b3bb41d663e3fd4c03303b9b85/markupsafe-3.0.4-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:799c39bdf5e2f1292fedd3009f7b3c9e760f10b2420cb9638d56920840ff6db8", size = 11719, upload-time = "2026-10-02T23:06:16.701Z" }, + { url = "https://files.pythonhosted.org/packages/96/24/3ec292b44064c16229e064d770b2625bd8ea941aa61f44905a9fa44942c0/markupsafe-3.0.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:ae9dcb8fbe244cb82f8a6458b455b927a03685e383d9bacf1ea5ce180b96dc97", size = 12075, upload-time = "2026-10-02T23:06:17.855Z" }, + { url = "https://files.pythonhosted.org/packages/aa/85/b64fdb1f304848518742136983c24e96d967bfb59a0ea160e92736901ab0/markupsafe-3.0.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bced6e2a6dba6a28f7dd3c6ce14df1b2dd495923f16ea484cad03decd463b2b", size = 24656, upload-time = "2026-10-02T23:06:18.963Z" }, + { url = "https://files.pythonhosted.org/packages/9c/18/23997d4c65b355da6390d61cd56e0ab3befd6ba8dda25cb40c602bd0fa6b/markupsafe-3.0.4-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3882fb412298575bae3b9c46868251f15cc69307359f87bb1b382e53d6e5a2c9", size = 27737, upload-time = "2026-10-02T23:06:20.117Z" }, + { url = "https://files.pythonhosted.org/packages/d4/36/35998dead3c6af88c38265a56e58100211f036234ab88eb2283fd4cbce44/markupsafe-3.0.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:04e7902ba80ee4bac1d50a549606527a1dcf0476cd81403db41099d3b60ec653", size = 25003, upload-time = "2026-10-02T23:06:21.284Z" }, + { url = "https://files.pythonhosted.org/packages/82/96/ef49135ce260db4ca4a12b119ed468449cd248db6b1468e2112b546d7a2e/markupsafe-3.0.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:925f929d6b59a8b3f8b8c6ac363cd0af7eecc81efb3071770b3c6717c450a369", size = 23111, upload-time = "2026-10-02T23:06:22.524Z" }, + { url = "https://files.pythonhosted.org/packages/50/7d/83126e338bd88c17a220668235368ad719fd4638e426739858cbb8508f77/markupsafe-3.0.4-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f68edfc67aabac33708941f26f22a7b8e9f81429bc0cf249fcf7d66b23af8d19", size = 22403, upload-time = "2026-10-02T23:06:23.785Z" }, + { url = "https://files.pythonhosted.org/packages/83/dd/daf7e420de23c8206c365204e7b85e1251d8e19d34196a56336f316e5ed2/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:e5c802729725bd07e2bc3ab7b76dc7e0bbfc53129d8f1eb1c002c24cf774717e", size = 24083, upload-time = "2026-10-02T23:06:25.037Z" }, + { url = "https://files.pythonhosted.org/packages/19/3c/11eecdc06bc44ad5570350085b572ebf049e8f9a38d1ece6d76640b739cd/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:55ffd6ce583d97dc71dc92e930324c8c0d25aea7e3ade6ae54ef77cedb096811", size = 22931, upload-time = "2026-10-02T23:06:26.328Z" }, + { url = "https://files.pythonhosted.org/packages/0d/9e/ac0fd77f2a726e56ecc3ca0235d095feace1358d1b822406c2a2ef26a4dc/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:2cb3dd71fc6be918ad4264346a8ed69485f9b7ed7bf35495d8e22807cd6b8bea", size = 24299, upload-time = "2026-10-02T23:06:27.742Z" }, + { url = "https://files.pythonhosted.org/packages/d7/09/c6bd842ad58ff5b3bc76eeed7e9a42a6f11adc5d090ec697b72c9672731e/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:94f5407f7bc64fa6463906b896f9904beeeb7dd8dc116ee8e9056c8714ff9916", size = 21948, upload-time = "2026-10-02T23:06:29.274Z" }, + { url = "https://files.pythonhosted.org/packages/a3/46/82f586711fed61e86faa1ee1bc317d68cd45a10c8bdbe3f7d1fdf9026ad8/markupsafe-3.0.4-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:2dad610540cb2e6272855c178f08ae9a1c7ac258a7fb71660553a5f104b42741", size = 23150, upload-time = "2026-10-02T23:06:30.583Z" }, + { url = "https://files.pythonhosted.org/packages/19/2d/2dfdce99318abbfa26925195fbc17db188c46a1ec6457be121b6f9cfeb42/markupsafe-3.0.4-cp315-cp315-win32.whl", hash = "sha256:03470d1a8268e692ecf79ecd565593e59d44219377a7ead61f1f1b94c1f7ff6b", size = 14269, upload-time = "2026-10-02T23:06:31.949Z" }, + { url = "https://files.pythonhosted.org/packages/5b/ec/6000fd82e8791e58fcd0456ec20f098957e2b03d5ed02eb73241a577c0ba/markupsafe-3.0.4-cp315-cp315-win_amd64.whl", hash = "sha256:d882a373d8093c2941e01291b7ced96e9cbe4781da9a7751ca7e6c70385e5214", size = 14496, upload-time = "2026-10-02T23:06:33.258Z" }, + { url = "https://files.pythonhosted.org/packages/bc/66/e73bd5016421d5d6e2fb6de7dd609f9de020942ac8c626526bd8c6eeaf82/markupsafe-3.0.4-cp315-cp315-win_arm64.whl", hash = "sha256:353bd63081912ab8cfa6a0c7d185934cdf8426f04c618bba6bc4b394f2069b67", size = 14361, upload-time = "2026-10-02T23:06:34.539Z" }, + { url = "https://files.pythonhosted.org/packages/90/df/cb8c3dc98d313a951df2f8968f44e4cb5643df6d3cab749a530ce2f7d972/markupsafe-3.0.4-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c61750fadcd119d0825bcb7d7d675dd264dcc89cc05292aab5be68ebdbb374ad", size = 11760, upload-time = "2026-10-02T23:06:35.807Z" }, + { url = "https://files.pythonhosted.org/packages/d6/bb/4af9b3ca0753d654ac75f9531d5bd741bb77ca6e696f36807c475ffc099a/markupsafe-3.0.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1c0df495a977d10460a94941799c72d5b5ab03d3858d949b55b5a66c8f371c99", size = 12108, upload-time = "2026-10-02T23:06:37.089Z" }, + { url = "https://files.pythonhosted.org/packages/3f/d4/b56429313aee5fd59b079c3df5615299959e25e7113eb6d8caadbdd7d38a/markupsafe-3.0.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002", size = 25762, upload-time = "2026-10-02T23:06:38.419Z" }, + { url = "https://files.pythonhosted.org/packages/65/f5/34c181e891aa4f7d59c918584672e0c5eb7fffe76c1387d1246008bf4081/markupsafe-3.0.4-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:05295589e619b9bed252a86b532b8e27350abc372d18ba89b59375325e91ec1e", size = 28400, upload-time = "2026-10-02T23:06:39.819Z" }, + { url = "https://files.pythonhosted.org/packages/ce/b5/ad14694fd0ac9a5ce30bc6498f2999378f418583dd1679cca5a1b512957e/markupsafe-3.0.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:be6cb0c799abb0e2ba3e618e6d28ddddf7e485f6c2ce938dfa237daf3905072c", size = 25946, upload-time = "2026-10-02T23:06:41.381Z" }, + { url = "https://files.pythonhosted.org/packages/d6/a8/26b606445387d0ceb1eb1f21840094b84e4e3c3c3983d80d10b89823b490/markupsafe-3.0.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:26e9867520db70d37f7fb421a7f0d8adb40171011fb84ce869afa1a83370dfa8", size = 23634, upload-time = "2026-10-02T23:06:42.748Z" }, + { url = "https://files.pythonhosted.org/packages/39/a2/b8814de672f1f0094d498bf646f2fec9d6356b503d28ef500b71c5095377/markupsafe-3.0.4-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f03460ff076f70ab595bb45a0205ccea1971443575b6920c52e755dec2b3fbfe", size = 23488, upload-time = "2026-10-02T23:06:44.176Z" }, + { url = "https://files.pythonhosted.org/packages/db/c7/287223376fb73335a3cc5d6eb22c6ab01358cf33945a9c39c06b9dac3f4b/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:436e3ffc6310d3c41878c601db29098102fe5d8a467c49da4a4125254e0980f2", size = 25037, upload-time = "2026-10-02T23:06:45.646Z" }, + { url = "https://files.pythonhosted.org/packages/f9/29/4df8355e313426d19e62ba33e0253c009ca12a0894ee77d67fa67255361c/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:4e2c4809c14559aa7ef426f27fb35afbb38104c349a903bf8f3600456764bb38", size = 23543, upload-time = "2026-10-02T23:06:47.264Z" }, + { url = "https://files.pythonhosted.org/packages/71/e5/8377731e8495668dcc768f645e717df18318c841edaf023a99395f6da9b4/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:da2af0d7aebfc2074080d72efa6ab8317c62481ef1f896f65d9999c1c01f4494", size = 25282, upload-time = "2026-10-02T23:06:48.795Z" }, + { url = "https://files.pythonhosted.org/packages/ed/5f/373456e37ceb1478d657d6fe769cbe0a39f0a8dfc1548eeb19c471eefdd9/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:aa2c838cc024642cc04c6854232f32b43e5e22833dd11119c1766c7873b8370d", size = 22993, upload-time = "2026-10-02T23:06:50.31Z" }, + { url = "https://files.pythonhosted.org/packages/d7/93/2cbd5628435afb6f541bbaced4bce0c2edac4b09a142e6e928b8b0da9858/markupsafe-3.0.4-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:b91cc9d336957239ff200f30097e6fea2dc6d6fb3c81e853eaa09eac904fd894", size = 23712, upload-time = "2026-10-02T23:06:51.759Z" }, + { url = "https://files.pythonhosted.org/packages/81/99/157e10966b033b363aeda5263e82596ee232a0b1d082fdbf90aa417ff083/markupsafe-3.0.4-cp315-cp315t-win32.whl", hash = "sha256:e49fb0d1ce92cfa0cb198cc5b1b11cdf9d0638658e2a2db2687e39db7c87fc78", size = 14300, upload-time = "2026-10-02T23:06:53.241Z" }, + { url = "https://files.pythonhosted.org/packages/33/05/55884815414c9706a23deca150b72c25a62109e65b0b6ce232077802c719/markupsafe-3.0.4-cp315-cp315t-win_amd64.whl", hash = "sha256:4f6e0852a0283b1b1fd776eeb7b766a5f440b3e2bd31ab51af3b400585f3965c", size = 14522, upload-time = "2026-10-02T23:06:54.729Z" }, + { url = "https://files.pythonhosted.org/packages/92/f9/ecbde7149e95b8a0f18e16d5d747f7dc06049d5da2e4f77f6f5e4a1f46a8/markupsafe-3.0.4-cp315-cp315t-win_arm64.whl", hash = "sha256:39dbacefc411633db5b4378b066a9aca70a3d7e2922c9e578d825f844026eeba", size = 14417, upload-time = "2026-10-02T23:06:56.246Z" }, +] + [[package]] name = "matplotcheck2" version = "0.2.1" @@ -901,6 +1061,8 @@ dev = [ { name = "scipy", version = "1.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, { name = "scipy", version = "1.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "sympy" }, + { name = "torch", version = "2.15.0", source = { registry = "https://pypi.org/simple" }, marker = "sys_platform != 'linux'" }, + { name = "torch", version = "2.15.0+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'linux'" }, { name = "types-networkx" }, ] @@ -927,6 +1089,8 @@ dev = [ { name = "ruff", specifier = ">=0.11.12" }, { name = "scipy" }, { name = "sympy" }, + { name = "torch", marker = "sys_platform != 'linux'", specifier = ">=2.0" }, + { name = "torch", marker = "sys_platform == 'linux'", specifier = ">=2.0", index = "https://download.pytorch.org/whl/cpu" }, { name = "types-networkx" }, ] @@ -1104,7 +1268,8 @@ name = "scipy" version = "1.17.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version < '3.12'", + "python_full_version < '3.12' and sys_platform == 'linux'", + "python_full_version < '3.12' and sys_platform != 'linux'", ] dependencies = [ { name = "numpy" }, @@ -1178,7 +1343,8 @@ name = "scipy" version = "1.18.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version >= '3.12'", + "python_full_version >= '3.12' and sys_platform == 'linux'", + "python_full_version >= '3.12' and sys_platform != 'linux'", ] dependencies = [ { name = "numpy" }, @@ -1247,6 +1413,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/63/ad/741c19fcb66755ff953daf9243af8480e4bf3d7fbe57583c178c7d2b6b51/scipy-1.18.1-cp315-cp315t-win_arm64.whl", hash = "sha256:eda632a7981f69730d6281f451db9c1c370993a2c0d7ddb43e2a809a2862b83a", size = 25319710, upload-time = "2026-08-21T23:28:45.713Z" }, ] +[[package]] +name = "setuptools" +version = "84.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/70/b3/c19426f783614d625699a4b247faf628ea9ab1db228674491767b417f9e1/setuptools-84.2.1.tar.gz", hash = "sha256:3ff8b3b5492a0aa66960f4419365a86b84e013070d4313e4d4a6894f5d64d6bc", size = 1230289, upload-time = "2026-10-20T19:01:37.742Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/55/6dc6d6bb953bdfc52519a0059592c52b6e3b8ad51cf8256dffceb55b0610/setuptools-84.2.1-py3-none-any.whl", hash = "sha256:ca140b45d5325a9478f880e351484f62fef15f336462e449ca0c03c873d589c2", size = 876263, upload-time = "2026-10-20T19:01:35.678Z" }, +] + [[package]] name = "six" version = "1.17.0" @@ -1268,6 +1443,79 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a2/09/77d55d46fd61b4a135c444fc97158ef34a095e5681d0a6c10b75bf356191/sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5", size = 6299353, upload-time = "2025-04-27T18:04:59.103Z" }, ] +[[package]] +name = "torch" +version = "2.15.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.12' and sys_platform != 'linux'", + "python_full_version < '3.12' and sys_platform != 'linux'", +] +dependencies = [ + { name = "filelock" }, + { name = "fsspec" }, + { name = "jinja2" }, + { name = "networkx" }, + { name = "setuptools" }, + { name = "sympy" }, + { name = "typing-extensions" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/2d/a5/fa947e2bbb072933f8c0ad5e02bd11126bcfc2b624fe234ac29a7b63600c/torch-2.15.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:e808b63d616a43b326e1a5677d45a2e5babe7a8ce27edb03ddb48e7dd9b6d663", size = 138527954, upload-time = "2026-10-28T15:16:30.29Z" }, + { url = "https://files.pythonhosted.org/packages/d1/7e/7f1252812e8048bc24f203fc0757a251f26af797b4ff986e19046e2b5f73/torch-2.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:d2c5938f593a47cf6d151a16d130a3cc3f0c105df1b905a571efc00b01e38c1f", size = 126720349, upload-time = "2026-10-28T15:16:25.498Z" }, + { url = "https://files.pythonhosted.org/packages/17/24/7b9b755e8c4dd2395c6a94bab6a4ed8aded1735ff2538bc63cbba8abeddd/torch-2.15.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:593e5fd0c204284890d1c3dff643be34e549e1d24523e13402510f960d4da438", size = 138558517, upload-time = "2026-10-28T15:16:35.918Z" }, + { url = "https://files.pythonhosted.org/packages/74/0b/a57c0b58a64b7a197dc40fc464bb96c0de867f95a2b1cbb3ec9e54414fde/torch-2.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:f2bd0a3709a7493a6ef2ac5a654111242a854439f7558f910b6b653b56f7504d", size = 126738207, upload-time = "2026-10-28T15:16:40.586Z" }, + { url = "https://files.pythonhosted.org/packages/87/fa/efeb85d3ba1d8ef497664db5358ac72a7d1d0f1d8a8ad487cba89753f279/torch-2.15.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:fbefd73b521d3c75c5a1d7c77056b2c6339b81468d14d4e33c55f525418a5855", size = 138556890, upload-time = "2026-10-28T15:16:45.195Z" }, + { url = "https://files.pythonhosted.org/packages/3d/6c/f26ed528d197859cf8a634bbfafc3bc136f5590b6620df179d1858a34fdc/torch-2.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:e079089d36401261ebe145504309d0114fb9a00529eac4b33048221d2376a15c", size = 126736947, upload-time = "2026-10-28T15:17:36.768Z" }, + { url = "https://files.pythonhosted.org/packages/8a/04/ff26bb464e61f83e0176deca01e72fffa779190bbb476011e89c45791589/torch-2.15.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:0d2b2d9674fa0b9b3f50e83231aa6545a0b19e437a52f0af939a224faaa45515", size = 138575002, upload-time = "2026-10-28T15:17:58.526Z" }, + { url = "https://files.pythonhosted.org/packages/40/4e/e31abad54b00c940b33f8c6de724c7b1240fa6ba86acee3cbbf65a17a0f8/torch-2.15.0-cp314-cp314-win_amd64.whl", hash = "sha256:cf02d11e13819807389e172ecb8f400f6135969af860e2a9f677f67a011e6194", size = 126735321, upload-time = "2026-10-28T15:18:03.587Z" }, + { url = "https://files.pythonhosted.org/packages/66/98/cad8d73df09e1517beeebd6090f00a0d1bdf762285a8082cf0f22a432e62/torch-2.15.0-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:628f54cb55a2363a5f14471a80c1b6efb63724449d2611ad2772fb5d4c42d19d", size = 138900111, upload-time = "2026-10-28T15:18:40.575Z" }, + { url = "https://files.pythonhosted.org/packages/4f/70/31911a8f46608a6c4fdc7744050a69168312984bed5ab7c8e18f4c9ad9d0/torch-2.15.0-cp314-cp314t-win_amd64.whl", hash = "sha256:4a906d0fa6dc9aa9a9b5f3b96437c8dfe661f855645b3f838c12fc5cf5cce562", size = 127025368, upload-time = "2026-10-28T15:19:00.808Z" }, + { url = "https://files.pythonhosted.org/packages/99/34/c7ff06165cb09238e945aa2ae63b9186583a47a9880aacd349d37e521f08/torch-2.15.0-cp315-cp315-macosx_14_0_arm64.whl", hash = "sha256:06a686eb717cd3d1662363082820be45497318887c596d691af0af0c7649c8f0", size = 138573101, upload-time = "2026-10-28T15:19:21.942Z" }, + { url = "https://files.pythonhosted.org/packages/14/37/003c96b78f95a0dc25368c371452ed01ea9d9b63d59120b8e970c93381f6/torch-2.15.0-cp315-cp315-win_amd64.whl", hash = "sha256:04597a77bbcc7a1a01e7b9efce78d258b18a7f31bcb190f4ee00360bff75e7f6", size = 126735953, upload-time = "2026-10-28T15:19:41.917Z" }, + { url = "https://files.pythonhosted.org/packages/8b/e6/1df516e9d3c0a551e118d21a2a6cbc7c47cdb4a09b7cc363ad8e696c4744/torch-2.15.0-cp315-cp315t-macosx_14_0_arm64.whl", hash = "sha256:02ac0b22211c1984e5dc002d2e57fdbc13d32116537ea6ae1a0c9d07cafce0c9", size = 138897802, upload-time = "2026-10-28T15:19:46.702Z" }, + { url = "https://files.pythonhosted.org/packages/7b/64/1ad0107cec15706e4d972fcbfaa6b3da26734959109861a60902c922b50c/torch-2.15.0-cp315-cp315t-win_amd64.whl", hash = "sha256:c521a00891e92aba2f34717671c268acd0bde26444623efcceaeaf51c87b3b36", size = 127024483, upload-time = "2026-10-28T15:20:23.183Z" }, +] + +[[package]] +name = "torch" +version = "2.15.0+cpu" +source = { registry = "https://download.pytorch.org/whl/cpu" } +resolution-markers = [ + "python_full_version >= '3.12' and sys_platform == 'linux'", + "python_full_version < '3.12' and sys_platform == 'linux'", +] +dependencies = [ + { name = "filelock" }, + { name = "fsspec" }, + { name = "jinja2" }, + { name = "networkx" }, + { name = "setuptools" }, + { name = "sympy" }, + { name = "typing-extensions" }, +] +wheels = [ + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp311-cp311-linux_s390x.whl", hash = "sha256:ef0bd617c9439a54d698d95fb7c3f63efcc48c29efdd42b177e87d862cb574fa", upload-time = "2026-10-28T13:17:54Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:97dc6b0a7cbad2109e615da3eac03df626c61e821e9486438b0248ba896178c6", upload-time = "2026-10-28T13:18:01Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:cee15855a32ad89a9bb27b8a9d6e07a859dcd2e11ed1b5561f3d6206e31a103b", upload-time = "2026-10-28T13:18:09Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp312-cp312-linux_s390x.whl", hash = "sha256:29c74659a82483d9a9c5d7f9e1112973dfa2dce5b3956dba5d1b97381b94cfae", upload-time = "2026-10-28T13:18:25Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:75941d429aaf4450bcd364345d7677e2d54aad45b38fbfcb1c0552450a6e9c40", upload-time = "2026-10-28T13:18:32Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:0955c7e3446326293f48af18fad67872fa31dee5a36a87690eb9e5be8b465be3", upload-time = "2026-10-28T13:18:39Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp313-cp313-linux_s390x.whl", hash = "sha256:88f5fe2c5d25a809a315a4a3f494e367539a307356f37752d89cd0b9d84f175a", upload-time = "2026-10-28T13:18:52Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:ab35875b15ac536a645e165b296300fed71df7b4f2ddbae40c725ab08f0a5e78", upload-time = "2026-10-28T13:18:58Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:0f6f69701b2d38ddc412364dfb92e2e13e74960d33fa3573b4930ced626e81c7", upload-time = "2026-10-28T13:19:05Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314-linux_s390x.whl", hash = "sha256:ef810702df4dd70fe1b8ebee9e7394c6491f779841571a71433829e44927eaa5", upload-time = "2026-10-28T13:19:19Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:01bdc7d291e3f6b5c03cf72d8a1718a5012d9fad5f380e67b563b0a76592055a", upload-time = "2026-10-28T13:19:25Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:f089c94912c955269a20e5fee6b6a371209b610849c9ece26e908a748d87a723", upload-time = "2026-10-28T13:19:32Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314t-linux_s390x.whl", hash = "sha256:7f8e2d696d12f965a5967bda4bc903decf6aa714b0b5ffb50e189733112a4dfd", upload-time = "2026-10-28T13:19:42Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:68e4595afffb1af18480b6ecb7217688c02a0f2a7b482c7a95b4896a3b38d49a", upload-time = "2026-10-28T13:19:48Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:17d66ae6f8a49d4dfca368b50b7dc15f7129175e80b4ae2832dfa0cce86d3159", upload-time = "2026-10-28T13:19:55Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp315-cp315-manylinux_2_28_aarch64.whl", hash = "sha256:2cec97b29524b3352bb794321976da7cef2ecee171866499c5630c865396c0a2", upload-time = "2026-10-28T13:20:08Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp315-cp315-manylinux_2_28_x86_64.whl", hash = "sha256:3552930ba3d358d3ff0b6fee19cb296e199767443c0c86be2a715471036d9233", upload-time = "2026-10-28T13:20:15Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp315-cp315t-manylinux_2_28_aarch64.whl", hash = "sha256:3fb23f534fdffdd3a178f8ef3327ab5fff833f291e5955be7edcaa7547a3f1fa", upload-time = "2026-10-28T13:20:26Z" }, + { url = "https://download-r2.pytorch.org/whl/cpu/torch-2.15.0%2Bcpu-cp315-cp315t-manylinux_2_28_x86_64.whl", hash = "sha256:92551daf5873fc6db15be48fe9644398f13143291c151ab6769f19e7c5ebd10c", upload-time = "2026-10-28T13:20:33Z" }, +] + [[package]] name = "traitlets" version = "5.14.3" From 32a7e159119f41be76bd51d786d83f7543b10ded Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 18:43:02 -0500 Subject: [PATCH 2/9] Let grader images set a default sandbox timeout ConfigObject.sandbox_timeout now defaults to None, meaning 'use the image/global default'. The plugin resolves an unset timeout from the PL_GRADER_SANDBOX_TIMEOUT environment variable (falling back to 1.0s), so an image can bake in a more sensible default while questions keep full control by setting an explicit value. Co-Authored-By: Claude Opus 4.8 --- src/pytest_prairielearn_grader/config.py | 10 ++++--- src/pytest_prairielearn_grader/plugin.py | 34 +++++++++++++++++++++--- tests/test_config.py | 21 ++++++++++++++- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/pytest_prairielearn_grader/config.py b/src/pytest_prairielearn_grader/config.py index e59a171..45697d6 100644 --- a/src/pytest_prairielearn_grader/config.py +++ b/src/pytest_prairielearn_grader/config.py @@ -53,10 +53,14 @@ def test_student_code(sandbox): ``` """ - sandbox_timeout: float = 1.0 + sandbox_timeout: float | None = None """Timeout in seconds for sandbox initialization and operations. - Must be a positive number. Default is 1.0 second. + Must be a positive number when set. When None (the default), the timeout falls back to the + grader image's default, which an image can set with the ``PL_GRADER_SANDBOX_TIMEOUT`` + environment variable (e.g. the torch image raises it to accommodate model work), and + otherwise to 1.0 second. Setting an explicit value here always overrides the image default. + This timeout applies to both sandbox initialization and individual student code operations. """ @@ -271,7 +275,7 @@ def test_student_code(sandbox): def __post_init__(self) -> None: """Validate configuration values after initialization.""" # Validate sandbox_timeout - if self.sandbox_timeout <= 0: + if self.sandbox_timeout is not None and self.sandbox_timeout <= 0: raise ValueError(f"sandbox_timeout must be positive, got {self.sandbox_timeout}") # Validate import_whitelist contains non-empty strings diff --git a/src/pytest_prairielearn_grader/plugin.py b/src/pytest_prairielearn_grader/plugin.py index 0f25504..6b83f2d 100644 --- a/src/pytest_prairielearn_grader/plugin.py +++ b/src/pytest_prairielearn_grader/plugin.py @@ -37,6 +37,32 @@ # Default configuration constants DEFAULT_SANDBOX_TIMEOUT = 1.0 DEFAULT_IMPORT_BLACKLIST = ["os", "sys", "subprocess", "pathlib", "shutil"] +# A grader image can raise the default sandbox timeout through this environment variable. Per-question +# configuration always overrides it, so questions can still set a lower (or higher) value. +ENV_DEFAULT_SANDBOX_TIMEOUT = "PL_GRADER_SANDBOX_TIMEOUT" + + +def _default_sandbox_timeout() -> float: + """The sandbox timeout used when a question doesn't set one. + + Reads ``PL_GRADER_SANDBOX_TIMEOUT`` so an image (such as the torch image, where importing the + framework and running a model easily exceeds a second) can bake in a more sensible default. + Falls back to ``DEFAULT_SANDBOX_TIMEOUT`` when the variable is unset or invalid. + """ + raw = os.environ.get(ENV_DEFAULT_SANDBOX_TIMEOUT) + if raw is None: + return DEFAULT_SANDBOX_TIMEOUT + try: + value = float(raw) + except ValueError: + logger.warning("Ignoring invalid %s=%r; using %s", ENV_DEFAULT_SANDBOX_TIMEOUT, raw, DEFAULT_SANDBOX_TIMEOUT) + return DEFAULT_SANDBOX_TIMEOUT + if value <= 0: + logger.warning("Ignoring non-positive %s=%r; using %s", ENV_DEFAULT_SANDBOX_TIMEOUT, raw, DEFAULT_SANDBOX_TIMEOUT) + return DEFAULT_SANDBOX_TIMEOUT + return value + + # Failing subtests shown in a test's message. The rest are only counted, to keep the message readable. MAX_SHOWN_SUBTEST_FAILURES = 5 @@ -321,7 +347,7 @@ def _resolve_sandbox_config( when there's no ConfigObject), merges them with the ConfigObject taking precedence, and injects the names_for_user values into starting_vars. """ - initialization_timeout: float = DEFAULT_SANDBOX_TIMEOUT + initialization_timeout: float = _default_sandbox_timeout() if data_json is None: params_dict = {} @@ -341,8 +367,10 @@ def _resolve_sandbox_config( pytest.fail(f"autograder_config must be a ConfigObject instance, got {type(config_object).__name__}") logger.debug("Using module-level autograder_config - overriding all other configuration sources") config_dict = config_object.to_dict() - # Handle timeout and starting_vars separately as they're not in to_dict() - initialization_timeout = config_object.sandbox_timeout + # Handle timeout and starting_vars separately as they're not in to_dict(). + # A None timeout means "use the image/global default" computed above. + if config_object.sandbox_timeout is not None: + initialization_timeout = config_object.sandbox_timeout config_starting_vars = config_object.starting_vars helper_module_names = config_object.helper_modules data_file_names = config_object.data_files diff --git a/tests/test_config.py b/tests/test_config.py index f772dbd..2112ba6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -3,7 +3,9 @@ import pytest from pytest_prairielearn_grader import ConfigObject +from pytest_prairielearn_grader.plugin import DEFAULT_SANDBOX_TIMEOUT from pytest_prairielearn_grader.plugin import _calculate_summary_scores +from pytest_prairielearn_grader.plugin import _default_sandbox_timeout # --------------------------------------------------------------------------- # Valid configurations @@ -13,10 +15,27 @@ def test_default_config() -> None: config = ConfigObject() assert config.workspace_mode is False - assert config.sandbox_timeout == 1.0 + # None means "defer to the image/global default"; it is resolved at grading time. + assert config.sandbox_timeout is None assert config.student_code_pattern == "student_code*.py" +def test_default_sandbox_timeout_without_env(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.delenv("PL_GRADER_SANDBOX_TIMEOUT", raising=False) + assert _default_sandbox_timeout() == DEFAULT_SANDBOX_TIMEOUT + + +def test_default_sandbox_timeout_from_env(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setenv("PL_GRADER_SANDBOX_TIMEOUT", "12.5") + assert _default_sandbox_timeout() == 12.5 + + +@pytest.mark.parametrize("bad_value", ["not-a-number", "0", "-3"]) +def test_default_sandbox_timeout_ignores_invalid_env(monkeypatch: pytest.MonkeyPatch, bad_value: str) -> None: + monkeypatch.setenv("PL_GRADER_SANDBOX_TIMEOUT", bad_value) + assert _default_sandbox_timeout() == DEFAULT_SANDBOX_TIMEOUT + + def test_single_file_mode_full() -> None: config = ConfigObject( sandbox_timeout=5.0, From b20c1697ec3ea963573707ccb3226148b3a8ef16 Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 18:45:09 -0500 Subject: [PATCH 3/9] Add a torch grader image with sensible baked-in defaults Add Dockerfile.torch (a glibc base, since PyTorch has no musl wheels) with a CPU build of torch, torchvision and torchinfo on top of the full scientific stack, and publish it as the :torch tag. The image bakes in a 10s default sandbox timeout (via PL_GRADER_SANDBOX_TIMEOUT) and single-threaded numeric defaults, all overridable per question. Documents the image, the tensor assertion helpers, and the dataset/determinism gotchas in torch.md. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/publish.yaml | 4 ++ README.md | 3 ++ docker/Dockerfile.torch | 48 +++++++++++++++++++++ docker/requirements-torch.txt | 12 ++++++ torch.md | 77 ++++++++++++++++++++++++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 docker/Dockerfile.torch create mode 100644 docker/requirements-torch.txt create mode 100644 torch.md diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b463486..880f305 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -42,6 +42,10 @@ jobs: dockerfile: Dockerfile.lite latest_tag: lite version_suffix: "-lite" + - variant: torch + dockerfile: Dockerfile.torch + latest_tag: torch + version_suffix: "-torch" steps: - uses: actions/checkout@v4 with: diff --git a/README.md b/README.md index 5becb0a..925abf6 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,8 @@ Available helpers: - `assert_fn_approx_equal(sandbox, func_name, args=..., expected=...)` — call + approx compare - `assert_true(condition)` / `assert_false(condition)` — boolean checks - `assert_plot_equal(plot, expected)` — compare a matplotlib plot with a reference plot +- `assert_tensor_allclose(actual, expected, rtol=1e-5, atol=1e-8)` — compare PyTorch tensors within a tolerance (torch image) +- `assert_tensor_equal(actual, expected)` — compare PyTorch tensors exactly (torch image) ### Partial Credit Across Inputs @@ -190,6 +192,7 @@ mypy src/ - `prairielearn/grader-python-pytest:latest` — full image with numpy, pandas, matplotlib, sympy - `prairielearn/grader-python-pytest:lite` — minimal image with core dependencies only +- `prairielearn/grader-python-pytest:torch` — full image plus a CPU build of PyTorch, torchvision, and torchinfo. See [torch.md](torch.md). ## Related Issues diff --git a/docker/Dockerfile.torch b/docker/Dockerfile.torch new file mode 100644 index 0000000..8fef0dd --- /dev/null +++ b/docker/Dockerfile.torch @@ -0,0 +1,48 @@ +# Torch grader image. +# +# Unlike the lite/full images, this one uses a glibc (Debian) base instead of Alpine, because +# PyTorch publishes only manylinux (glibc) wheels — there are no musl wheels to install on Alpine. +# It is pinned to Python 3.13, the newest version with stable CPU torch wheels. +# +# https://docs.astral.sh/uv/guides/integration/docker/#available-images +FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim + +# Needed to properly handle UTF-8 +ENV PYTHONIOENCODING=UTF-8 +ENV LANG=C.UTF-8 + +WORKDIR / + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + util-linux \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements-full.txt requirements-torch.txt / +ARG PACKAGE_VERSION=latest +# Install the CPU-only torch build from the PyTorch index so the image doesn't pull the +# multi-gigabyte CUDA packages. torchinfo and the grader itself come from PyPI. +RUN uv venv --seed \ + && uv pip install --no-cache-dir -r requirements-full.txt \ + && uv pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch torchvision \ + && uv pip install --no-cache-dir torchinfo \ + && uv pip install --no-cache-dir pytest-prairielearn-grader==${PACKAGE_VERSION} + +# Create 'ag' user for privilege dropping in student code sandbox +RUN adduser --disabled-password --gecos "" ag +COPY --chmod=755 run.sh /run.sh + +# Add serverFilesCourse to Python path +ENV PYTHONPATH=/grade/serverFilesCourse/ + +# --- Baked-in defaults (all overridable per question) --- +# Importing torch and running a model easily exceeds the 1-second default, so give questions more +# head-room. A question can still set any value via sandbox_timeout in its ConfigObject. +ENV PL_GRADER_SANDBOX_TIMEOUT=10 +# Keep the numeric libraries single-threaded by default for reproducible grading within the grader's +# CPU budget. Student code can override this by setting the thread count itself. +ENV OMP_NUM_THREADS=1 +ENV MKL_NUM_THREADS=1 + +ENTRYPOINT [ "/run.sh" ] diff --git a/docker/requirements-torch.txt b/docker/requirements-torch.txt new file mode 100644 index 0000000..02ed9b3 --- /dev/null +++ b/docker/requirements-torch.txt @@ -0,0 +1,12 @@ +# Extra packages for the torch image, on top of requirements-full.txt. +# +# torch and torchvision are installed from the PyTorch CPU index +# (https://download.pytorch.org/whl/cpu) in Dockerfile.torch so that no CUDA packages are pulled. +# torchinfo (the maintained successor to torchsummary, for model/parameter summaries) comes from +# PyPI. +# +# Versions are intentionally left as floors for now; pin them before cutting a release once the +# resolved CPU wheels have been validated in the image. +torch>=2.4 +torchvision>=0.19 +torchinfo>=1.8 diff --git a/torch.md b/torch.md new file mode 100644 index 0000000..1571a7c --- /dev/null +++ b/torch.md @@ -0,0 +1,77 @@ +# PyTorch grading + +The `prairielearn/grader-python-pytest:torch` image adds a CPU build of PyTorch (plus `torchvision` +and `torchinfo`) on top of the full scientific stack, for grading machine-learning and data-science +questions. + +Use it by setting the image in a question's `info.json`: + +```json +{ + "externalGradingOptions": { + "enabled": true, + "image": "prairielearn/grader-python-pytest:torch", + "timeout": 60 + } +} +``` + +The image uses a Debian (glibc) base rather than the Alpine base of the `lite`/`latest` images, +because PyTorch publishes only glibc wheels. Only the CPU build is installed, so the image stays far +smaller than a CUDA image and runs anywhere. + +## Baked-in defaults (all overridable) + +Importing torch and running a model takes much longer than the grader's usual 1-second budget, so +the image ships more sensible defaults. Every one of these can be overridden per question. + +| Setting | Image default | How to override | +| ------------------------- | ------------- | ----------------------------------------------------------------- | +| Sandbox timeout (seconds) | `10` | Set `sandbox_timeout` in the question's `ConfigObject` | +| `OMP_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | +| `MKL_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | + +The sandbox-timeout default comes from the `PL_GRADER_SANDBOX_TIMEOUT` environment variable, which +the image sets. A question that sets `sandbox_timeout` in its `ConfigObject` always wins: + +```python +from pytest_prairielearn_grader import ConfigObject + +# This question needs longer than the image's 10s default. +autograder_config = ConfigObject(sandbox_timeout=30.0) +``` + +Threads are pinned to 1 for reproducible grading within the grader's CPU budget. Raise them in setup +or student code if a question genuinely needs parallelism. + +## Comparing tensors + +Two assertion helpers produce clean, student-facing messages for tensor comparisons. Both accept +anything `torch.as_tensor` understands (a tensor, a NumPy array, or a nested list) and compare on the +CPU after detaching from autograd. + +```python +from pytest_prairielearn_grader.assertions import assert_tensor_allclose, assert_tensor_equal + +@pytest.mark.grading_data(name="forward pass", points=5) +def test_forward(sandbox: StudentFixture) -> None: + output = sandbox.query_function("forward", sample_input) + assert_tensor_allclose(output, expected_output, rtol=1e-4) +``` + +- `assert_tensor_allclose(actual, expected, *, rtol, atol, check_dtype=False, equal_nan=True)` — for + floating-point tensors. Reports shape mismatches, the number of differing elements, and the + maximum absolute difference. +- `assert_tensor_equal(actual, expected, *, check_dtype=False)` — for integer, boolean, or index + tensors where exact equality is meaningful. + +Student functions may also simply return a `torch.Tensor`; the grader serializes it automatically, +so `sandbox.query_function(...)` returns a tensor you can compare directly. + +## Gotchas + +- **No dataset downloads.** The grading sandbox has no network access, so + `torchvision.datasets(..., download=True)` won't work. Ship any dataset the question needs as a + `data_files` entry and load it from the local path instead. +- **Determinism.** Seed torch (and NumPy/`random`) in `setup_code.py` so grading is reproducible, + e.g. `torch.manual_seed(0)`. From ef1b0a89989366d70ed3a7a156c9cb20a782b93c Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 18:48:23 -0500 Subject: [PATCH 4/9] Keep torch tests and lockfile green across the CI matrix Gate the torch dev dependency below Python 3.14 (no wheels yet) so the lock resolves and the 3.14 job skips the torch tests, and guard the test's torch typing behind TYPE_CHECKING so mypy resolves torch.Tensor. Co-Authored-By: Claude Opus 4.8 --- pyproject.toml | 4 +++- tests/test_torch.py | 15 ++++++++++----- uv.lock | 8 ++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 190582f..506a104 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,9 @@ dev = [ "networkx", "types-networkx", "nbformat>=5.0", - "torch>=2.0", + # Gated below 3.14 because PyTorch doesn't publish wheels for 3.14 yet; the torch tests + # skip themselves when torch isn't installed (e.g. on the 3.14 CI job). + "torch>=2.0; python_version < '3.14'", ] [tool.uv.sources] diff --git a/tests/test_torch.py b/tests/test_torch.py index 05bdb4f..555902f 100644 --- a/tests/test_torch.py +++ b/tests/test_torch.py @@ -3,14 +3,19 @@ torch is an optional, heavy dependency, so these tests are skipped when it isn't installed. """ +from typing import TYPE_CHECKING + import pytest -torch = pytest.importorskip("torch") +if TYPE_CHECKING: + import torch +else: + torch = pytest.importorskip("torch") -from pytest_prairielearn_grader.assertions import assert_tensor_allclose # noqa: E402 -from pytest_prairielearn_grader.assertions import assert_tensor_equal # noqa: E402 -from pytest_prairielearn_grader.json_utils import from_json # noqa: E402 -from pytest_prairielearn_grader.json_utils import to_json # noqa: E402 +from pytest_prairielearn_grader.assertions import assert_tensor_allclose +from pytest_prairielearn_grader.assertions import assert_tensor_equal +from pytest_prairielearn_grader.json_utils import from_json +from pytest_prairielearn_grader.json_utils import to_json # --------------------------------------------------------------------------- # Serialization round-trips diff --git a/uv.lock b/uv.lock index 1154bdf..ba25aa6 100644 --- a/uv.lock +++ b/uv.lock @@ -1061,8 +1061,8 @@ dev = [ { name = "scipy", version = "1.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, { name = "scipy", version = "1.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "sympy" }, - { name = "torch", version = "2.15.0", source = { registry = "https://pypi.org/simple" }, marker = "sys_platform != 'linux'" }, - { name = "torch", version = "2.15.0+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'linux'" }, + { name = "torch", version = "2.15.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.14' and sys_platform != 'linux'" }, + { name = "torch", version = "2.15.0+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "python_full_version < '3.14' and sys_platform == 'linux'" }, { name = "types-networkx" }, ] @@ -1089,8 +1089,8 @@ dev = [ { name = "ruff", specifier = ">=0.11.12" }, { name = "scipy" }, { name = "sympy" }, - { name = "torch", marker = "sys_platform != 'linux'", specifier = ">=2.0" }, - { name = "torch", marker = "sys_platform == 'linux'", specifier = ">=2.0", index = "https://download.pytorch.org/whl/cpu" }, + { name = "torch", marker = "python_full_version < '3.14' and sys_platform == 'linux'", specifier = ">=2.0", index = "https://download.pytorch.org/whl/cpu" }, + { name = "torch", marker = "python_full_version < '3.14' and sys_platform != 'linux'", specifier = ">=2.0" }, { name = "types-networkx" }, ] From 721a02aebc47c006ca77ce621a2dfc6fb113599c Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 22:56:37 -0500 Subject: [PATCH 5/9] Make the torch image's dependencies self-contained and pinned Give the torch image its own fully pinned requirements file instead of layering on requirements-full.txt. The torch image runs on a different Python and libc than the full image and pins torch tightly to specific numpy/Pillow versions, so it should pin its scientific stack on its own terms rather than silently inheriting the full image's bumps. Also fixes a latent bug: Dockerfile.torch copied requirements-torch.txt but installed torch/torchvision/torchinfo by bare name, so the file was never actually used. The whole set now installs from that one file, with the PyTorch CPU index as the primary index so only CPU wheels are pulled. Co-Authored-By: Claude Opus 4.8 --- docker/Dockerfile.torch | 15 ++++++---- docker/requirements-torch.txt | 52 ++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/docker/Dockerfile.torch b/docker/Dockerfile.torch index 8fef0dd..c0a5848 100644 --- a/docker/Dockerfile.torch +++ b/docker/Dockerfile.torch @@ -19,14 +19,17 @@ RUN apt-get update \ sudo \ && rm -rf /var/lib/apt/lists/* -COPY requirements-full.txt requirements-torch.txt / +COPY requirements-torch.txt / ARG PACKAGE_VERSION=latest -# Install the CPU-only torch build from the PyTorch index so the image doesn't pull the -# multi-gigabyte CUDA packages. torchinfo and the grader itself come from PyPI. +# Install everything from one self-contained, pinned requirements file. The PyTorch CPU index is the +# primary index, so torch/torchvision resolve to CPU-only wheels (no multi-gigabyte CUDA packages); +# every other package falls through to PyPI. uv's default first-index strategy keeps that routing +# safe because the PyTorch index hosts only torch packages. RUN uv venv --seed \ - && uv pip install --no-cache-dir -r requirements-full.txt \ - && uv pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch torchvision \ - && uv pip install --no-cache-dir torchinfo \ + && uv pip install --no-cache-dir \ + --index-url https://download.pytorch.org/whl/cpu \ + --extra-index-url https://pypi.org/simple \ + -r requirements-torch.txt \ && uv pip install --no-cache-dir pytest-prairielearn-grader==${PACKAGE_VERSION} # Create 'ag' user for privilege dropping in student code sandbox diff --git a/docker/requirements-torch.txt b/docker/requirements-torch.txt index 02ed9b3..ca69061 100644 --- a/docker/requirements-torch.txt +++ b/docker/requirements-torch.txt @@ -1,12 +1,44 @@ -# Extra packages for the torch image, on top of requirements-full.txt. +# Self-contained, fully pinned dependency set for the torch grader image. # -# torch and torchvision are installed from the PyTorch CPU index -# (https://download.pytorch.org/whl/cpu) in Dockerfile.torch so that no CUDA packages are pulled. -# torchinfo (the maintained successor to torchsummary, for model/parameter summaries) comes from -# PyPI. +# This image is NOT built on top of requirements-full.txt: it carries its own copy of the scientific +# stack so its build is reproducible and can pin versions independently of the full image. PyTorch is +# tightly coupled to specific numpy/Pillow versions, and this image runs on a different Python and +# libc (glibc / 3.13) than the full image (musl / 3.14), so it needs to pin those on its own terms. # -# Versions are intentionally left as floors for now; pin them before cutting a release once the -# resolved CPU wheels have been validated in the image. -torch>=2.4 -torchvision>=0.19 -torchinfo>=1.8 +# Trade-off: when a package is added to the full image it must be mirrored here by hand; that drift is +# intentional, so that changes to this heavy ML image are always explicit and reviewed. +# +# torch and torchvision are served from the PyTorch CPU index (https://download.pytorch.org/whl/cpu), +# which Dockerfile.torch sets as the primary index so only CPU wheels are pulled (no CUDA). Every +# other package falls through to PyPI. torchinfo (the maintained successor to torchsummary, for +# model/parameter summaries) comes from PyPI. + +# --- Scientific stack (kept in sync with the full image, pinned independently) --- +beautifulsoup4==4.15.0 +defusedxml==0.7.1 +Faker==40.44.0 +matplotcheck2==0.2.1 +matplotlib==3.11.2 +nbformat==5.11.1 +networkx==3.7 +nltk==3.10.4 +numpy==2.5.4 +openpyxl==3.1.5 +pandas==3.1.0 +Pillow==13.0.0 +PuLP==4.2.0 +Pygments==2.21.0 +pytest==9.2.0 +requests==2.34.2 +scikit-learn==1.9.1 +scipy==1.18.1 +seaborn==0.13.2 +sympy==1.14.0 +typing-extensions==4.16.0 + +# --- Torch stack (CPU wheels from the PyTorch index; torchinfo from PyPI) --- +# These exact versions are provisional until a torch image build validates that the CPU wheels +# resolve against the pinned numpy/Pillow above. Bump them once that build is green. +torch==2.8.0 +torchvision==0.23.0 +torchinfo==1.8.0 From de6ca585ab1e431e5d3b540a9664d9d3aaa5ff77 Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 23:08:07 -0500 Subject: [PATCH 6/9] Build the full grader image on a glibc base instead of Alpine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the Alpine (musl) base, scikit-learn has no prebuilt wheel, so it compiled from source on every build — pulling in the build-base toolchain and pushing the image build to close to an hour. Every compiled dependency (numpy, scipy, scikit-learn, pandas, matplotlib, Pillow) ships a manylinux wheel for Python 3.14, so switching to the Debian slim base the torch image already uses lets the whole stack install from wheels. No compiler is needed, the build drops to a few minutes, and the image no longer carries build-base. Co-Authored-By: Claude Opus 4.8 --- docker/Dockerfile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c91f913..fef4ef9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,37 +1,36 @@ +# Full grader image: the lite image plus the scientific Python stack. +# +# Uses a glibc (Debian) base rather than Alpine so numpy/scipy/scikit-learn/pandas/matplotlib/Pillow +# all install from prebuilt manylinux wheels. On Alpine (musl), scikit-learn has no wheel and +# compiles from source, which needs a full C/C++ toolchain (build-base) and pushes the build to +# close to an hour. On glibc no compiler is needed, so the build is a few minutes and the image no +# longer carries the toolchain. +# # https://docs.astral.sh/uv/guides/integration/docker/#available-images -FROM ghcr.io/astral-sh/uv:python3.14-alpine -#ARG CACHEBUST=2025-07-15-14-16-18 +FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim # Needed to properly handle UTF-8 ENV PYTHONIOENCODING=UTF-8 -ENV LANG=en_US.UTF-8 +ENV LANG=C.UTF-8 WORKDIR / -RUN apk update \ - && apk add --no-cache \ +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ util-linux \ sudo \ - build-base - -# NOTE all the crap below is needed to make pygraphviz work, but we probably don't need to include this -# in the new grader image? We can add back if necessary but not sure what the use cases are. -# dos2unix \ -# graphviz \ -# graphviz-devel + && rm -rf /var/lib/apt/lists/* COPY requirements-full.txt / ARG PACKAGE_VERSION=latest RUN uv venv --seed && uv pip install --no-cache-dir -r requirements-full.txt && \ uv pip install --no-cache-dir pytest-prairielearn-grader==${PACKAGE_VERSION} -# Anything that needs to be run post-install # Create 'ag' user for privilege dropping in student code sandbox -RUN adduser -D ag +RUN adduser --disabled-password --gecos "" ag COPY --chmod=755 run.sh /run.sh # Add serverFilesCourse to Python path -# TODO do we need to copy anything here? ENV PYTHONPATH=/grade/serverFilesCourse/ ENTRYPOINT [ "/run.sh" ] From 47846a9e2ed66be692fb734aeb9976288fde0e99 Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 23:08:07 -0500 Subject: [PATCH 7/9] Add a build-only CI workflow for the grader images The publish workflow only builds the images on a release tag, so a broken dependency combination wouldn't surface until release. This builds all three images on PRs and pushes that touch docker/**, amd64-only and without pushing, with per-variant layer caching so unchanged images stay fast. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/docker-build.yaml | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..aa90676 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,66 @@ +name: Docker build + +# Validates that the grader images actually build, without publishing anything. The publish +# workflow only runs on a release tag, so without this a broken dependency combination (for example +# a torch/numpy pin that doesn't resolve) wouldn't surface until release time. +# +# Builds are amd64-only and never pushed. Per-variant layer caching keeps unchanged images close to +# instant, so a change to one image's files doesn't pay to rebuild the others from scratch. + +on: + push: + branches: [main] + paths: + - "docker/**" + - ".github/workflows/docker-build.yaml" + pull_request: + branches: [main] + paths: + - "docker/**" + - ".github/workflows/docker-build.yaml" + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - variant: lite + dockerfile: Dockerfile.lite + - variant: full + dockerfile: Dockerfile + - variant: torch + dockerfile: Dockerfile.torch + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Resolve latest published grader version + id: pkg + run: | + VERSION=$(curl -fsSL https://pypi.org/pypi/pytest-prairielearn-grader/json \ + | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") + if [ -z "$VERSION" ]; then + echo "Could not resolve grader version from PyPI" >&2 + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Build ${{ matrix.variant }} image (no push) + uses: docker/build-push-action@v5 + with: + context: ./docker + file: ./docker/${{ matrix.dockerfile }} + push: false + # amd64 only: this validates the dependency resolution (the real risk) without paying for a + # second architecture. arm64 wheels resolve the same way and can be added if needed. + platforms: linux/amd64 + build-args: | + PACKAGE_VERSION=${{ steps.pkg.outputs.version }} + cache-from: type=gha,scope=${{ matrix.variant }} + cache-to: type=gha,mode=max,scope=${{ matrix.variant }} From 7df2129c1255aa86a1ef932e62bae43b2044dd51 Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 23:41:52 -0500 Subject: [PATCH 8/9] Cross-reference the two image matrices to keep them in sync The publish and build-only workflows each carry their own copy of the image matrix. Add a comment in each pointing at the other so a new image isn't added to one and forgotten in the other. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/docker-build.yaml | 1 + .github/workflows/publish.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index aa90676..67777da 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -26,6 +26,7 @@ jobs: contents: read strategy: fail-fast: false + # Keep this image list in sync with the publish matrix in publish.yaml. matrix: include: - variant: lite diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 880f305..34c5755 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -32,6 +32,7 @@ jobs: permissions: contents: read strategy: + # Keep this image list in sync with the build-only matrix in docker-build.yaml. matrix: include: - variant: full From e117646f183802c3dd63a1faacc8af37e216e57b Mon Sep 17 00:00:00 2001 From: Eliot Robson Date: Wed, 25 Nov 2026 23:49:34 -0500 Subject: [PATCH 9/9] Fold the torch docs into the quick start guide Move the standalone torch.md into a PyTorch grading section of quick_start.md, add the :torch row to the image table (which still listed only two variants), and point the README there. A later PR will reorganize these docs further. Co-Authored-By: Claude Opus 4.8 --- README.md | 2 +- quick_start.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-- torch.md | 77 ----------------------------------------------- 3 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 torch.md diff --git a/README.md b/README.md index 925abf6..836272b 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ mypy src/ - `prairielearn/grader-python-pytest:latest` — full image with numpy, pandas, matplotlib, sympy - `prairielearn/grader-python-pytest:lite` — minimal image with core dependencies only -- `prairielearn/grader-python-pytest:torch` — full image plus a CPU build of PyTorch, torchvision, and torchinfo. See [torch.md](torch.md). +- `prairielearn/grader-python-pytest:torch` — full image plus a CPU build of PyTorch, torchvision, and torchinfo. See the [PyTorch grading](quick_start.md#pytorch-grading) section of the quick start guide. ## Related Issues diff --git a/quick_start.md b/quick_start.md index 78ec905..3ded6e1 100644 --- a/quick_start.md +++ b/quick_start.md @@ -57,16 +57,17 @@ Set `gradingMethod` to `"External"` and pick a grader image: ### Choosing an Image -Two image variants are published. Pick the smallest one that includes what your question needs — a smaller image means faster cold-start pull times and a reduced security surface. +Three image variants are published. Pick the smallest one that includes what your question needs — a smaller image means faster cold-start pull times and a reduced security surface. | Tag | Size (approx.) | Includes | Best for | | --------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `:latest` | ~400–500 MB | Full scientific stack: `numpy`, `pandas`, `scipy`, `matplotlib` + `matplotcheck2`, `seaborn`, `scikit-learn`, `sympy`, `networkx`, `nltk`, `nbformat`, and more | Any course that needs scientific computing, data science, plotting, or Jupyter notebook grading | | `:lite` | ~60–80 MB | Grader core only: `pytest-prairielearn-grader`, `Pygments`, `beautifulsoup4`, `defusedxml`, `requests` | Introductory CS courses where student code uses only the Python standard library | +| `:torch` | ~1–1.5 GB | Everything in `:latest` plus a CPU build of PyTorch, `torchvision`, and `torchinfo` | Machine-learning and data-science questions that grade PyTorch tensors or models. See [PyTorch grading](#pytorch-grading) | > **Note:** If a student's code imports a package that isn't present in the image (e.g., `numpy` in `:lite`), it will raise an `ImportError` and the test will fail with an exception. Make sure the image you choose contains everything both your test code and the expected student solution require. -Pinned version tags (e.g., `:v1.2.3` and `:v1.2.3-lite`) are also published alongside each release if you need a reproducible build. +Pinned version tags (e.g., `:v1.2.3`, `:v1.2.3-lite`, and `:v1.2.3-torch`) are also published alongside each release if you need a reproducible build. ### `question.html` @@ -2095,6 +2096,82 @@ def divide(a, b): return a / b ``` +## PyTorch grading + +The `prairielearn/grader-python-pytest:torch` image adds a CPU build of PyTorch (plus `torchvision` +and `torchinfo`) on top of the full scientific stack, for grading machine-learning and data-science +questions. Select it like any other image (see [Choosing an Image](#choosing-an-image)): + +```json +{ + "externalGradingOptions": { + "enabled": true, + "image": "prairielearn/grader-python-pytest:torch", + "timeout": 60 + } +} +``` + +The image uses a Debian (glibc) base rather than the Alpine base of the `lite`/`latest` images, +because PyTorch publishes only glibc wheels. Only the CPU build is installed, so the image stays far +smaller than a CUDA image and runs anywhere. + +### Baked-in defaults (all overridable) + +Importing torch and running a model takes much longer than the grader's usual 1-second budget, so +the image ships more sensible defaults. Every one of these can be overridden per question. + +| Setting | Image default | How to override | +| ------------------------- | ------------- | --------------------------------------------------------------- | +| Sandbox timeout (seconds) | `10` | Set `sandbox_timeout` in the question's `ConfigObject` | +| `OMP_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | +| `MKL_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | + +The sandbox-timeout default comes from the `PL_GRADER_SANDBOX_TIMEOUT` environment variable, which +the image sets. A question that sets `sandbox_timeout` in its `ConfigObject` always wins: + +```python +from pytest_prairielearn_grader import ConfigObject + +# This question needs longer than the image's 10s default. +autograder_config = ConfigObject(sandbox_timeout=30.0) +``` + +Threads are pinned to 1 for reproducible grading within the grader's CPU budget. Raise them in setup +or student code if a question genuinely needs parallelism. + +### Comparing tensors + +Two assertion helpers produce clean, student-facing messages for tensor comparisons. Both accept +anything `torch.as_tensor` understands (a tensor, a NumPy array, or a nested list) and compare on the +CPU after detaching from autograd. + +```python +from pytest_prairielearn_grader.assertions import assert_tensor_allclose, assert_tensor_equal + +@pytest.mark.grading_data(name="forward pass", points=5) +def test_forward(sandbox: StudentFixture) -> None: + output = sandbox.query_function("forward", sample_input) + assert_tensor_allclose(output, expected_output, rtol=1e-4) +``` + +- `assert_tensor_allclose(actual, expected, *, rtol, atol, check_dtype=False, equal_nan=True)` — for + floating-point tensors. Reports shape mismatches, the number of differing elements, and the + maximum absolute difference. +- `assert_tensor_equal(actual, expected, *, check_dtype=False)` — for integer, boolean, or index + tensors where exact equality is meaningful. + +Student functions may also simply return a `torch.Tensor`; the grader serializes it automatically, +so `sandbox.query_function(...)` returns a tensor you can compare directly. + +### Gotchas + +- **No dataset downloads.** The grading sandbox has no network access, so + `torchvision.datasets(..., download=True)` won't work. Ship any dataset the question needs as a + `data_files` entry and load it from the local path instead. +- **Determinism.** Seed torch (and NumPy/`random`) in `setup_code.py` so grading is reproducible, + e.g. `torch.manual_seed(0)`. + ## More Examples To see more examples of what is possible in these test files, look at the test cases in diff --git a/torch.md b/torch.md deleted file mode 100644 index 1571a7c..0000000 --- a/torch.md +++ /dev/null @@ -1,77 +0,0 @@ -# PyTorch grading - -The `prairielearn/grader-python-pytest:torch` image adds a CPU build of PyTorch (plus `torchvision` -and `torchinfo`) on top of the full scientific stack, for grading machine-learning and data-science -questions. - -Use it by setting the image in a question's `info.json`: - -```json -{ - "externalGradingOptions": { - "enabled": true, - "image": "prairielearn/grader-python-pytest:torch", - "timeout": 60 - } -} -``` - -The image uses a Debian (glibc) base rather than the Alpine base of the `lite`/`latest` images, -because PyTorch publishes only glibc wheels. Only the CPU build is installed, so the image stays far -smaller than a CUDA image and runs anywhere. - -## Baked-in defaults (all overridable) - -Importing torch and running a model takes much longer than the grader's usual 1-second budget, so -the image ships more sensible defaults. Every one of these can be overridden per question. - -| Setting | Image default | How to override | -| ------------------------- | ------------- | ----------------------------------------------------------------- | -| Sandbox timeout (seconds) | `10` | Set `sandbox_timeout` in the question's `ConfigObject` | -| `OMP_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | -| `MKL_NUM_THREADS` | `1` | Set the thread count in student/setup code, or override the env | - -The sandbox-timeout default comes from the `PL_GRADER_SANDBOX_TIMEOUT` environment variable, which -the image sets. A question that sets `sandbox_timeout` in its `ConfigObject` always wins: - -```python -from pytest_prairielearn_grader import ConfigObject - -# This question needs longer than the image's 10s default. -autograder_config = ConfigObject(sandbox_timeout=30.0) -``` - -Threads are pinned to 1 for reproducible grading within the grader's CPU budget. Raise them in setup -or student code if a question genuinely needs parallelism. - -## Comparing tensors - -Two assertion helpers produce clean, student-facing messages for tensor comparisons. Both accept -anything `torch.as_tensor` understands (a tensor, a NumPy array, or a nested list) and compare on the -CPU after detaching from autograd. - -```python -from pytest_prairielearn_grader.assertions import assert_tensor_allclose, assert_tensor_equal - -@pytest.mark.grading_data(name="forward pass", points=5) -def test_forward(sandbox: StudentFixture) -> None: - output = sandbox.query_function("forward", sample_input) - assert_tensor_allclose(output, expected_output, rtol=1e-4) -``` - -- `assert_tensor_allclose(actual, expected, *, rtol, atol, check_dtype=False, equal_nan=True)` — for - floating-point tensors. Reports shape mismatches, the number of differing elements, and the - maximum absolute difference. -- `assert_tensor_equal(actual, expected, *, check_dtype=False)` — for integer, boolean, or index - tensors where exact equality is meaningful. - -Student functions may also simply return a `torch.Tensor`; the grader serializes it automatically, -so `sandbox.query_function(...)` returns a tensor you can compare directly. - -## Gotchas - -- **No dataset downloads.** The grading sandbox has no network access, so - `torchvision.datasets(..., download=True)` won't work. Ship any dataset the question needs as a - `data_files` entry and load it from the local path instead. -- **Determinism.** Seed torch (and NumPy/`random`) in `setup_code.py` so grading is reproducible, - e.g. `torch.manual_seed(0)`.