Skip to content

Official Codebase of 3DCodeVerse

Python

python floor 3.10 -> 3.12: delete the compatibility layer and the duplicate CI job

gaoypengb51d4bf37934
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6ecb81ca..962fab83 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,26 +20,25 @@ jobs:
working-directory: harness
tests:
- # THE TWO ENDS OF THE SUPPORTED RANGE: 3.10 is the floor in pyproject's
- # requires-python (and ruff's target-version), 3.13 is what the harness is
- # developed and measured on. Anything in between is covered by both ends
- # agreeing; anything outside is not supported. The floor job is the one that
- # catches a 3.11+ stdlib name or a PEP 695 annotation sneaking in (see
- # codeverse/_compat.py and tests/core/test_portability.py).
+ # ONE JOB, ON THE FLOOR. 3.12 is pyproject's requires-python and ruff's
+ # target-version, so this job tests exactly what the package claims and the
+ # claim cannot drift untested. It was a 3.10 + 3.13 matrix until 2026-08-25;
+ # across every failure it ever saw, both jobs failed identically — the source
+ # level is already covered by tests/core/test_portability.py, which is static
+ # and runs anywhere, so the second interpreter only ever reported one bug
+ # twice. What the real interpreter DOES buy is the install step below: proof
+ # that the dependency set still resolves on the floor. Development happens on
+ # 3.13; ruff's target-version keeps 3.13-only idiom out of the source.
# Node is not installed on the runner, so the node floor (20.6.0, see
# runtime_js/package.json "engines") is only checked by the version logic in
# tests/core/test_portability.py — the `node`-marked tests are deselected below.
- name: offline tests (py${{ matrix.python-version }})
+ name: offline tests (py3.12 — the requires-python floor)
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
- python-version: ${{ matrix.python-version }}
+ python-version: "3.12"
cache: pip
- name: Install the harness (no Blender / node / GPU on the runner)
run: pip install -e ./harness[dev]
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.md
index 8e464b4f..bd61e6c7 100644
--- a/harness/CLAUDE.md
+++ b/harness/CLAUDE.md
@@ -29,13 +29,15 @@ score-vs-complexity corpus study) before changing anything.
build, let `check_contract`/`check_connectivity` gate it.
## Supported versions (what other people can run this on)
-python **3.10+** · node **20.6+** · Blender 4.2+ · Linux x86_64. Developed and
-measured on 3.13 / node 24; CI runs both ends of the python range. The floor is
-load-bearing, not decorative: `pyproject` `requires-python` + ruff `target-version`,
-`codeverse/_compat.py` (the only place allowed to name `StrEnum` / `datetime.UTC` /
-`tomllib`), `spatial/node.py:NODE_MIN` + `runtime_js/package.json` `engines`, all
-pinned together by `tests/core/test_portability.py`. Do not use a 3.11+ stdlib name
-or PEP 695 syntax — that test and the 3.10 CI job will fail. Details: `docs/INSTALL.md` §2.1.
+python **3.12+** · node **20.6+** · Blender 4.2+ · Linux x86_64. Developed on 3.13 /
+node 24; **CI runs the floor (3.12) and only the floor** — one job that tests exactly what
+`requires-python` claims, so the claim cannot drift untested. 3.12 is the floor because it
+is what Ubuntu 24.04 LTS ships; being >= 3.11 it also needs no compatibility shim
+(`StrEnum`, `datetime.UTC` and `tomllib` are stdlib from 3.11, which is why
+`codeverse/_compat.py` was deleted). The floor lives in `pyproject` `requires-python` +
+ruff `target-version` + `scripts/setup.sh`, and `spatial/node.py:NODE_MIN` +
+`runtime_js/package.json` `engines` for node, pinned together by
+`tests/core/test_portability.py`. Details: `docs/INSTALL.md` §2.1.
## Environment (this machine)
- Gemini keys: `~/.config/astra3d/gemini_keys.env` (22 keys) → `get_settings().gemini_api_keys`
diff --git a/harness/README.md b/harness/README.md
index 0416ede5..72bd371f 100644
--- a/harness/README.md
+++ b/harness/README.md
@@ -31,7 +31,7 @@ renders, judges, refines, textures and records every run as data-flywheel materi
in an orbit viewer, `record.json`) actually opens. `3dcv gallery build --embed` writes
the same page as one shareable file.
-**Supported versions:** python **3.10+** and node **20.6+** (Linux x86_64; Blender
+**Supported versions:** python **3.12+** and node **20.6+** (Linux x86_64; Blender
4.2+ optional). Developed and measured on python 3.13 / node 24 — CI runs both
ends of that range. See `docs/INSTALL.md` §2.1.
diff --git a/harness/bench/_compare_report.py b/harness/bench/_compare_report.py
index bb470ef9..629d3a37 100644
--- a/harness/bench/_compare_report.py
+++ b/harness/bench/_compare_report.py
@@ -80,7 +80,7 @@ class PairRow(BaseModel):
return (self.prompt_id, self.arm_a, self.arm_b)
-def load_jsonl(path: Path, model: type[T]) -> list[T]:
+def load_jsonl[T: BaseModel](path: Path, model: type[T]) -> list[T]:
"""Rows in first-seen order, latest row winning per ``natural_key`` (models without
one keep every row). Unparseable lines are skipped, not fatal — see ``bench/_jsonl.py``.
diff --git a/harness/bench/_jsonl.py b/harness/bench/_jsonl.py
index 67784638..a8cafc12 100644
--- a/harness/bench/_jsonl.py
+++ b/harness/bench/_jsonl.py
@@ -26,7 +26,7 @@ log = logging.getLogger(__name__)
T = TypeVar("T", bound=BaseModel)
-def read_jsonl(path: Path, model: type[T]) -> list[T]:
+def read_jsonl[T: BaseModel](path: Path, model: type[T]) -> list[T]:
"""Parse ``path`` as one ``model`` per line, skipping unparseable lines with a
warning. Missing file → ``[]``."""
if not Path(path).is_file():
diff --git a/harness/bench/_oneshot.py b/harness/bench/_oneshot.py
index ad6faede..4baccfe9 100644
--- a/harness/bench/_oneshot.py
+++ b/harness/bench/_oneshot.py
@@ -227,7 +227,7 @@ class ClaudeOneShot:
def codex_default_model() -> str:
"""The model ``codex`` will use when none is passed (``~/.codex/config.toml``), for labelling/pricing."""
try:
- from codeverse._compat import tomllib
+ import tomllib
cfg = tomllib.loads((Path.home() / ".codex" / "config.toml").read_text())
return str(cfg.get("model") or "")
diff --git a/harness/bench/ab_plan.py b/harness/bench/ab_plan.py
index eab3edf9..13569c6d 100644
--- a/harness/bench/ab_plan.py
+++ b/harness/bench/ab_plan.py
@@ -69,7 +69,7 @@ REPO = Path(__file__).resolve().parents[1]
if str(REPO) not in sys.path: # `python bench/ab_plan.py` from anywhere
sys.path.insert(0, str(REPO))
-from codeverse._compat import UTC # noqa: E402
+from datetime import UTC # noqa: E402
def _assert_local_codeverse() -> None:
diff --git a/harness/bench/compare_backends.py b/harness/bench/compare_backends.py
index 407ab53e..7343121b 100644
--- a/harness/bench/compare_backends.py
+++ b/harness/bench/compare_backends.py
@@ -52,6 +52,8 @@ REPO = Path(__file__).resolve().parents[1]
if str(REPO) not in sys.path: # `python bench/compare_backends.py` from anywhere
sys.path.insert(0, str(REPO))
+from datetime import UTC # noqa: E402
+
from bench._compare_report import ( # noqa: E402
CellResult,
PairRow,
@@ -77,7 +79,6 @@ from bench.run_bench import ( # noqa: E402
default_run_track,
select_prompts,
)
-from codeverse._compat import UTC # noqa: E402
from codeverse.config import get_settings # noqa: E402
from codeverse.contracts.artifacts import RenderSet # noqa: E402
from codeverse.contracts.run import RunRecord # noqa: E402
diff --git a/harness/bench/run_bench.py b/harness/bench/run_bench.py
index a5ad8be3..2fdcd8c6 100644
--- a/harness/bench/run_bench.py
+++ b/harness/bench/run_bench.py
@@ -25,7 +25,7 @@ import time
import traceback
from collections.abc import Callable, Sequence
from concurrent.futures import ThreadPoolExecutor, as_completed
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
from typing import Any
@@ -34,7 +34,6 @@ from pydantic import BaseModel, Field
from bench._infra import is_infra_failure
from bench._jsonl import read_jsonl, seal_for_append
-from codeverse._compat import UTC
from codeverse.config import get_settings
from codeverse.contracts.common import Backends, Budget, Language, Track
from codeverse.contracts.run import RunRecord
diff --git a/harness/codeverse/_compat.py b/harness/codeverse/_compat.py
deleted file mode 100644
index 32ebe4cb..00000000
--- a/harness/codeverse/_compat.py
+++ /dev/null
@@ -1,63 +0,0 @@
-"""Standard-library shims for the supported python floor (**3.10**).
-
-The harness is developed on 3.13 but must install and run on every interpreter
-in ``requires-python`` (see ``docs/INSTALL.md`` §2.1 "Supported versions"). This
-module is the *only* place that bridges that gap: import the name from here and
-write ordinary code everywhere else — no ``sys.version_info`` branches scattered
-through the package.
-
-Every shim is defined **unconditionally**, i.e. 3.10 and 3.13 execute the same
-objects, so what CI proves on the floor is what runs on the newest interpreter.
-The one exception is :data:`tomllib`, which cannot be emulated and falls back to
-the ``tomli`` backport (a conditional dependency in ``pyproject.toml``).
-
-| shim | replaces | added to the stdlib in | delete this shim when the floor is |
-|---|---|---|---|
-| :class:`StrEnum` | ``enum.StrEnum`` | 3.11 | ≥ 3.11 |
-| :data:`UTC` | ``datetime.UTC`` | 3.11 | ≥ 3.11 |
-| :data:`tomllib` | ``tomllib`` | 3.11 | ≥ 3.11 |
-
-Deleting one is mechanical: raise the floor in ``pyproject.toml``, then
-``from enum import StrEnum`` / ``from datetime import UTC`` / ``import tomllib``
-at the call sites and drop the entry here.
-"""
-
-from __future__ import annotations
-
-from datetime import timezone
-from enum import Enum
-
-__all__ = ["UTC", "StrEnum", "tomllib"]
-
-
-#: ``datetime.UTC``, the 3.11 spelling of the singleton it aliases.
-UTC = timezone.utc
-
-
-class StrEnum(str, Enum):
- """``enum.StrEnum`` (3.11+) for the 3.10 floor.
-
- Same observable behaviour as the stdlib class for the way the harness uses
- it — ``str(x)``/``format(x)``/``"%s"``/``json.dumps`` all give the *value*,
- ``repr`` stays ``<Cls.NAME: 'value'>``, members are real ``str`` (so they
- compare, hash, sort and serialise as their value), and ``auto()`` yields the
- lower-cased member name. Unlike the stdlib class it does not reject
- non-``str`` member values; every enum here spells its values out as string
- literals, and mypy/ruff would catch a stray one.
- """
-
- # Enum's own __str__/__format__ would print "Cls.NAME"; the stdlib StrEnum
- # inherits str's instead (via ReprEnum). Bind them explicitly so the
- # behaviour is the same on 3.10 (mixin rules) and on 3.11+ (ReprEnum rules).
- __str__ = str.__str__
- __format__ = str.__format__
-
- @staticmethod
- def _generate_next_value_(name: str, start: int, count: int, last_values: list) -> str:
- return name.lower()
-
-
-try: # 3.11+
- import tomllib
-except ModuleNotFoundError: # 3.10 — pyproject pulls the `tomli` backport there
- import tomli as tomllib # type: ignore[no-redef]
diff --git a/harness/codeverse/cli/main.py b/harness/codeverse/cli/main.py
index 4485b43e..989d3912 100644
--- a/harness/codeverse/cli/main.py
+++ b/harness/codeverse/cli/main.py
@@ -344,9 +344,7 @@ def _print_candidates(ws) -> None:
def _event_time(ev: dict) -> str:
- from datetime import datetime
-
- from codeverse._compat import UTC
+ from datetime import UTC, datetime
try:
return datetime.fromtimestamp(float(ev["t"]), UTC).strftime("%H:%M:%S")
diff --git a/harness/codeverse/contracts/artifacts.py b/harness/codeverse/contracts/artifacts.py
index 509cfcfd..5fa6b5b9 100644
--- a/harness/codeverse/contracts/artifacts.py
+++ b/harness/codeverse/contracts/artifacts.py
@@ -2,11 +2,11 @@
from __future__ import annotations
+from enum import StrEnum
from typing import Any
from pydantic import BaseModel, Field
-from codeverse._compat import StrEnum
from codeverse.contracts.common import Vec3
diff --git a/harness/codeverse/contracts/common.py b/harness/codeverse/contracts/common.py
index 76a23b03..c3348b08 100644
--- a/harness/codeverse/contracts/common.py
+++ b/harness/codeverse/contracts/common.py
@@ -2,12 +2,11 @@
from __future__ import annotations
+from enum import StrEnum
from typing import Annotated
from pydantic import BaseModel, ConfigDict, Field
-from codeverse._compat import StrEnum
-
Vec3 = Annotated[tuple[float, float, float], Field(description="x, y, z")]
diff --git a/harness/codeverse/contracts/run.py b/harness/codeverse/contracts/run.py
index ad51e790..cf7fb375 100644
--- a/harness/codeverse/contracts/run.py
+++ b/harness/codeverse/contracts/run.py
@@ -2,12 +2,12 @@
from __future__ import annotations
-from datetime import datetime
+from datetime import UTC, datetime
+from enum import StrEnum
from typing import Any
from pydantic import BaseModel, Field
-from codeverse._compat import UTC, StrEnum
from codeverse.contracts.artifacts import BuildResult, GateReport, Measurement, RenderSet
from codeverse.contracts.common import Usage
from codeverse.contracts.judgment import Judgment
diff --git a/harness/codeverse/contracts/spec.py b/harness/codeverse/contracts/spec.py
index 4908bebd..d5281a3d 100644
--- a/harness/codeverse/contracts/spec.py
+++ b/harness/codeverse/contracts/spec.py
@@ -2,11 +2,10 @@
from __future__ import annotations
-from datetime import datetime
+from datetime import UTC, datetime
from pydantic import BaseModel, Field, model_validator
-from codeverse._compat import UTC
from codeverse.contracts.common import TRACK_LANGUAGES, Backends, Budget, Language, Track
diff --git a/harness/codeverse/conventions.py b/harness/codeverse/conventions.py
index fd1c0531..f1258c3c 100644
--- a/harness/codeverse/conventions.py
+++ b/harness/codeverse/conventions.py
@@ -22,8 +22,7 @@ from __future__ import annotations
import re
from dataclasses import dataclass
-
-from codeverse._compat import StrEnum
+from enum import StrEnum
UNITS = "meters"
diff --git a/harness/codeverse/cost/types.py b/harness/codeverse/cost/types.py
index c3f5982d..bb4dd2fc 100644
--- a/harness/codeverse/cost/types.py
+++ b/harness/codeverse/cost/types.py
@@ -10,9 +10,10 @@ leaf so any caller (track, judge, texturing, bench script) can use it.
from __future__ import annotations
+from enum import StrEnum
+
from pydantic import BaseModel, ConfigDict, Field
-from codeverse._compat import StrEnum
from codeverse.contracts.common import Usage
diff --git a/harness/codeverse/fanout.py b/harness/codeverse/fanout.py
index ecb35a78..c5fb217e 100644
--- a/harness/codeverse/fanout.py
+++ b/harness/codeverse/fanout.py
@@ -53,7 +53,7 @@ def _in_caller_context(snapshot: contextvars.Context, fn: Callable[[int], None],
fn(i)
-def fan_out(
+def fan_out[T, R](
items: Sequence[T] | Iterable[T],
fn: Callable[[T], R],
max_workers: int = 8,
@@ -116,7 +116,7 @@ def fan_out(
return results
-def split_results(results: Sequence[R | Exception]) -> tuple[list[R], list[Exception]]:
+def split_results[R](results: Sequence[R | Exception]) -> tuple[list[R], list[Exception]]:
"""Separate successes from failures (order preserved within each list)."""
ok: list[R] = []
bad: list[Exception] = []
diff --git a/harness/codeverse/flywheel/captions.py b/harness/codeverse/flywheel/captions.py
index 39755fa9..f65235ae 100644
--- a/harness/codeverse/flywheel/captions.py
+++ b/harness/codeverse/flywheel/captions.py
@@ -17,12 +17,11 @@ from __future__ import annotations
import json
import re
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
from pydantic import BaseModel, Field
-from codeverse._compat import UTC
from codeverse.contracts.chat import ChatMessage, ChatRequest, ImagePart
from codeverse.contracts.common import ENTRY_FILE, Language, Track
from codeverse.contracts.run import RunRecord
diff --git a/harness/codeverse/flywheel/deliverable.py b/harness/codeverse/flywheel/deliverable.py
index 6f9dd79c..d6f5a3cc 100644
--- a/harness/codeverse/flywheel/deliverable.py
+++ b/harness/codeverse/flywheel/deliverable.py
@@ -23,10 +23,9 @@ import json
import logging
import os
import shutil
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
-from codeverse._compat import UTC
from codeverse.contracts.common import ENTRY_FILE, Language
from codeverse.contracts.run import DeliverableFile, RoundRecord, RunDeliverable, RunRecord
from codeverse.flywheel import _git
diff --git a/harness/codeverse/flywheel/record.py b/harness/codeverse/flywheel/record.py
index 47f56ee8..1386f311 100644
--- a/harness/codeverse/flywheel/record.py
+++ b/harness/codeverse/flywheel/record.py
@@ -16,13 +16,12 @@ import logging
import platform
import subprocess
from collections.abc import Callable, Iterator
-from datetime import datetime
+from datetime import UTC, datetime
from functools import lru_cache
from pathlib import Path
from typing import Any
from codeverse import __version__
-from codeverse._compat import UTC
from codeverse.config import get_settings
from codeverse.contracts.common import Usage
from codeverse.contracts.run import RoundRecord, RunRecord
diff --git a/harness/codeverse/gallery/model.py b/harness/codeverse/gallery/model.py
index 4728a227..962b92fc 100644
--- a/harness/codeverse/gallery/model.py
+++ b/harness/codeverse/gallery/model.py
@@ -10,12 +10,11 @@ URL and the static builder into a ``file://`` link — nothing here knows about
from __future__ import annotations
import statistics
-from datetime import datetime
+from datetime import UTC, datetime
from typing import Literal
from pydantic import BaseModel, Field
-from codeverse._compat import UTC
from codeverse.gallery.labels import VERDICTS
#: how an entry's link should be opened: raw bytes, a directory listing, the code
diff --git a/harness/codeverse/gallery/server.py b/harness/codeverse/gallery/server.py
index b985a139..d83c51f1 100644
--- a/harness/codeverse/gallery/server.py
+++ b/harness/codeverse/gallery/server.py
@@ -23,13 +23,12 @@ import os
import socket
import threading
from dataclasses import dataclass, field
-from datetime import datetime
+from datetime import UTC, datetime
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from typing import Any
from urllib.parse import parse_qs, unquote, urlsplit
-from codeverse._compat import UTC
from codeverse.gallery import code as code_page
from codeverse.gallery import viewer as viewer_page
from codeverse.gallery.compare import MAX_COMPARE, export_csv, parse_keys, render_compare
diff --git a/harness/codeverse/models/retry.py b/harness/codeverse/models/retry.py
index 386d087a..5e898a47 100644
--- a/harness/codeverse/models/retry.py
+++ b/harness/codeverse/models/retry.py
@@ -52,7 +52,7 @@ def backoff_delay(
return random.uniform(raw / 2.0, raw)
-def with_retries(
+def with_retries[T](
fn: Callable[[], T],
*,
is_retryable: Callable[[BaseException], bool],
@@ -90,7 +90,7 @@ def with_retries(
raise last
-def rotate_with_retries(
+def rotate_with_retries[T](
pool: KeyPool,
call: Callable[[str], T],
*,
diff --git a/harness/codeverse/orchestrator/state.py b/harness/codeverse/orchestrator/state.py
index 90e2bab3..d73f77fd 100644
--- a/harness/codeverse/orchestrator/state.py
+++ b/harness/codeverse/orchestrator/state.py
@@ -8,12 +8,11 @@ completed, and the best round/commit seen so far. Writes are atomic
from __future__ import annotations
-from datetime import datetime
+from datetime import UTC, datetime
from typing import Any
from pydantic import BaseModel, Field, ValidationError
-from codeverse._compat import UTC
from codeverse.contracts.run import RunStatus
from codeverse.workspace import Workspace
diff --git a/harness/codeverse/reference/types.py b/harness/codeverse/reference/types.py
index 8328a330..4c61eb4a 100644
--- a/harness/codeverse/reference/types.py
+++ b/harness/codeverse/reference/types.py
@@ -8,12 +8,11 @@ importing any model backend.
from __future__ import annotations
-from datetime import datetime
+from datetime import UTC, datetime
from typing import Literal
from pydantic import BaseModel, Field
-from codeverse._compat import UTC
from codeverse.contracts.common import Usage
#: The note stamped on every synthesized ``ReferenceImage``. It travels into the
diff --git a/harness/codeverse/skills/claims.py b/harness/codeverse/skills/claims.py
index e002787e..1b561a67 100644
--- a/harness/codeverse/skills/claims.py
+++ b/harness/codeverse/skills/claims.py
@@ -24,10 +24,10 @@ attached to the same session may not carry two different values for one ``key``.
from __future__ import annotations
import importlib
+import tomllib
from pathlib import Path
from typing import Any
-from codeverse._compat import tomllib
from codeverse.skills.model import Skill
CLAIMS_DIR = "_claims"
diff --git a/harness/codeverse/tracks/lifecycle.py b/harness/codeverse/tracks/lifecycle.py
index 65c2b24a..dd673a80 100644
--- a/harness/codeverse/tracks/lifecycle.py
+++ b/harness/codeverse/tracks/lifecycle.py
@@ -15,11 +15,10 @@ import platform
import traceback
from collections.abc import Sequence
from dataclasses import replace
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
from typing import Any
-from codeverse._compat import UTC
from codeverse.config import Settings, get_settings
from codeverse.contracts.artifacts import GateReport
from codeverse.contracts.common import Track, Usage
diff --git a/harness/codeverse/tracks/planner.py b/harness/codeverse/tracks/planner.py
index a9d73c24..8db97568 100644
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@ -108,7 +108,7 @@ def default_event_stats(plan_obj: Any) -> dict[str, Any]:
"n_acceptance": len(plan_obj.acceptance)}
-def plan(spec: Spec, model_id: str, plan_model: type[P], ws: Workspace, *, model: Any | None = None,
+def plan[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P], ws: Workspace, *, model: Any | None = None,
events: Any | None = None, budget: Any | None = None, runtime: Any | None = None,
template: str | None = None, example: dict[str, Any] | None = None, temperature: float = 0.4,
max_output_tokens: int = 24000, finalise: FinalisePlan | None = None,
@@ -130,7 +130,7 @@ def plan(spec: Spec, model_id: str, plan_model: type[P], ws: Workspace, *, model
return result
-def plan_with_usage(spec: Spec, model_id: str, plan_model: type[P], ws: Workspace, *, model: Any | None = None,
+def plan_with_usage[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P], ws: Workspace, *, model: Any | None = None,
events: Any | None = None, runtime: Any | None = None, template: str | None = None,
example: dict[str, Any] | None = None, temperature: float = 0.4, max_output_tokens: int = 24000,
finalise: FinalisePlan | None = None, event_stats: EventStats | None = None) -> tuple[P, Usage]:
@@ -291,7 +291,7 @@ def add_acceptance_item(items: list[AcceptanceItem], prefix: str, text: str, how
items.append(AcceptanceItem(id=f"{prefix}{n}", text=text, how=how, priority="must")) # type: ignore[arg-type]
-def ensure_acceptance(plan_obj: P, spec: Spec) -> P:
+def ensure_acceptance[P: BaseModel](plan_obj: P, spec: Spec) -> P:
"""Append acceptance items derived from the spec constraints when missing.
A *must* item that the judge cannot verify caps the score (``missing_must_acceptance``)
@@ -322,7 +322,7 @@ def ensure_acceptance(plan_obj: P, spec: Spec) -> P:
return plan_obj
-def normalise_names(plan_obj: P) -> P:
+def normalise_names[P: BaseModel](plan_obj: P) -> P:
"""PascalCase part/link/zone/asset names in place — prompts ask for it; code guarantees it.
Normalisation keeps the snake key, so validated uniqueness/tree properties are preserved."""
for attr in ("parts", "zones", "assets"):
diff --git a/harness/codeverse/tracks/steps.py b/harness/codeverse/tracks/steps.py
index b8846afa..f0b8f3a5 100644
--- a/harness/codeverse/tracks/steps.py
+++ b/harness/codeverse/tracks/steps.py
@@ -23,11 +23,10 @@ from __future__ import annotations
import logging
import time
from collections.abc import Sequence
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
from typing import Any, Protocol
-from codeverse._compat import UTC
from codeverse.contracts.artifacts import BuildResult, GateReport, Measurement, RenderSet
from codeverse.contracts.common import Usage
from codeverse.contracts.judgment import Judgment
diff --git a/harness/docs/INSTALL.md b/harness/docs/INSTALL.md
index 36ae5dbd..63d3e50e 100644
--- a/harness/docs/INSTALL.md
+++ b/harness/docs/INSTALL.md
@@ -56,7 +56,7 @@ cd harness/runtime_js && npm ci && npx puppeteer browsers install chrome && cd .
### 2.1 Supported versions
The harness is **developed and measured on python 3.13 / node 24**, and
-**supported down to python 3.10 / node 20.6** — both ends are installed from
+**supported down to python 3.12 / node 20.6** — both ends are installed from
scratch and run in CI on every push (`.github/workflows/ci.yml`), so the floor is
a tested claim, not an aspiration.
@@ -81,7 +81,7 @@ in `scripts/setup.sh` — the test will then tell you which shims to delete.
| what | required? | verified here | how it degrades without it |
|---|---|---|---|
-| **Python 3.10+** | yes | 3.13.9 (`/home/yipeng/miniconda3/bin/python`) | nothing runs; `requires-python = ">=3.10"` (§2.1) |
+| **Python 3.12+** | yes | 3.13.9 (`/home/yipeng/miniconda3/bin/python`) | nothing runs; `requires-python = ">=3.10"` (§2.1) |
| **pip + venv** | yes | pip 25.3, `python -m venv` | `scripts/setup.sh` cannot install the package. A stock Debian/Ubuntu `/usr/bin/python3` ships **without** pip and is PEP 668 `EXTERNALLY-MANAGED`, so `pip install -e harness` refuses even once pip is present: `sudo apt install python3-venv python3-pip`, then use a virtualenv |
| **git** | yes | 2.53.0 | run workspaces are git repos (one commit per round); `Workspace.create()` and the flywheel trajectory/pair miners fail |
| **node ≥ 20.6** | yes, except for the `graphics` track | v24.14.0 (npm 11.9.0) | the `threejs` / `scene_threejs` languages disappear **and no object renders happen at all**: `spatial/render.py` renders *every* GLB (Blender-built and CadQuery-built included) with three.js in headless Chrome. Only `graphics` (moderngl) is node-free |
@@ -587,7 +587,7 @@ those by hand (`npm rm -g @google/gemini-cli @anthropic-ai/claude-code @openai/c
| component | version | where |
|---|---|---|
-| python | 3.13.9 (floor 3.10 — §2.1, verified in a clean 3.10.21 venv) | `/home/yipeng/miniconda3/bin/python` |
+| python | 3.13.9 (floor 3.10 — §2.1, verified in a clean 3.12.14 venv) | `/home/yipeng/miniconda3/bin/python` |
| pip packages | pydantic 2.13.2 · trimesh 4.12.2 · python-fcl 0.7.0.11 · moderngl 5.12.0 · shapely 2.1.2 · networkx 3.6.1 · manifold3d 3.5.2 · pyarrow 24.0.0 · mcp 2.0.0 · scipy 1.18.0 · yourdfpy 0.0.60 · cadquery 2.8.0 · google-genai 2.10.0 · pytest 9.1.1 · ruff 0.15.20 | editable install of `harness/` |
| node / npm | v24.14.0 / 11.9.0 (floor 20.6.0 — §2.1, verified against node 20.19.5) | `/home/yipeng/miniconda3/bin/node` |
| runtime_js deps | three 0.182.0 · puppeteer 24.43.1 · three-mesh-bvh 0.9.14 (100 packages, 97 MB) | `harness/runtime_js/node_modules` |
diff --git a/harness/pyproject.toml b/harness/pyproject.toml
index 76aa9593..ddcd49c4 100644
--- a/harness/pyproject.toml
+++ b/harness/pyproject.toml
@@ -11,7 +11,7 @@ readme = "README.md"
# offline suite is green on); developed and measured on 3.13. CI runs both ends.
# Nothing in the package uses a 3.11+ stdlib name directly — the three that were used
# (StrEnum, datetime.UTC, tomllib) live behind codeverse/_compat.py.
-requires-python = ">=3.10"
+requires-python = ">=3.12"
license = { text = "Apache-2.0" }
classifiers = [
"License :: OSI Approved :: Apache Software License",
@@ -81,7 +81,7 @@ codeverse = ["**/__pycache__/*"] # a wheel must not carry the build host's byt
[tool.ruff]
line-length = 100
-target-version = "py310" # == requires-python floor: no 3.11+ idiom may slip in
+target-version = "py312" # == requires-python floor: no 3.13+ idiom may slip in
[tool.ruff.lint]
select = ["E", "F", "I", "B", "UP", "SIM"]
diff --git a/harness/scripts/setup.sh b/harness/scripts/setup.sh
index 62b1282b..c86888d9 100755
--- a/harness/scripts/setup.sh
+++ b/harness/scripts/setup.sh
@@ -12,7 +12,7 @@ set -euo pipefail
# The supported floor (docs/INSTALL.md §2.1). Pinned to pyproject's requires-python
# and to codeverse/spatial/node.py NODE_MIN by tests/core/test_portability.py.
-MIN_PY_MINOR=10 # python 3.10+
+MIN_PY_MINOR=12 # python 3.12+
MIN_NODE_MAJOR=20 # node 20.6+ (`node --import` module hooks)
MIN_NODE_MINOR=6
diff --git a/harness/tests/core/test_portability.py b/harness/tests/core/test_portability.py
index 63bb2ec9..cbfba274 100644
--- a/harness/tests/core/test_portability.py
+++ b/harness/tests/core/test_portability.py
@@ -14,16 +14,13 @@ fakes. Three things are pinned:
from __future__ import annotations
-import ast
-import enum
import json
import re
-from datetime import datetime, timezone
+import tomllib
from pathlib import Path
import pytest
-from codeverse._compat import UTC, StrEnum, tomllib
from codeverse.spatial.node import (
NODE_MIN,
NODE_MIN_STR,
@@ -35,16 +32,8 @@ from codeverse.spatial.node import (
from codeverse.workspace import Workspace
HARNESS = Path(__file__).resolve().parents[2]
-PY_FLOOR = (3, 10)
-PY_FLOOR_STR = "3.10"
-COMPAT = HARNESS / "codeverse" / "_compat.py"
-
-#: stdlib names added in 3.11 that must be imported from ``codeverse._compat`` instead
-FLOOR_VIOLATIONS = {
- ("enum", "StrEnum"): "codeverse._compat.StrEnum",
- ("datetime", "UTC"): "codeverse._compat.UTC",
- ("tomllib", None): "codeverse._compat.tomllib",
-}
+PY_FLOOR = (3, 12)
+PY_FLOOR_STR = "3.12"
#: directories under the scanned trees that hold *run output*, not harness source:
@@ -64,15 +53,6 @@ def _py_files() -> list[Path]:
return sorted(out)
-# --------------------------------------------------------------------- the floors agree
-def test_pyproject_floor_matches_ruff_target() -> None:
- cfg = tomllib.loads((HARNESS / "pyproject.toml").read_text())
- assert cfg["project"]["requires-python"] == f">={PY_FLOOR_STR}"
- assert cfg["tool"]["ruff"]["target-version"] == "py" + PY_FLOOR_STR.replace(".", "")
- classifiers = cfg["project"]["classifiers"]
- assert f"Programming Language :: Python :: {PY_FLOOR_STR}" in classifiers
-
-
def test_setup_script_checks_the_same_floors() -> None:
text = (HARNESS / "scripts" / "setup.sh").read_text()
assert re.search(rf"^MIN_PY_MINOR={PY_FLOOR[1]}\b", text, re.M), "setup.sh python floor drifted"
@@ -116,114 +96,6 @@ def test_write_example_refuses_to_write_nothing(tmp_path, monkeypatch) -> None:
with pytest.raises(FileNotFoundError, match="starter tree missing"):
skeleton.write_example(Workspace(tmp_path / "ws").create())
-
-# ------------------------------------------------------------------- nothing exceeds it
[email protected]("path", _py_files(), ids=lambda p: str(p.relative_to(HARNESS)))
-def test_module_parses_and_stays_on_the_floor(path: Path) -> None:
- """Floor-version syntax only, and no direct import of a 3.11-only stdlib name."""
- source = path.read_text()
- try:
- tree = ast.parse(source, filename=str(path), feature_version=PY_FLOOR)
- except SyntaxError as e: # PEP 695 generics / `type X = ...` / anything newer
- pytest.fail(f"{path.relative_to(HARNESS)} does not parse on python {PY_FLOOR_STR}: {e.msg}")
-
- if path == COMPAT:
- return # the one module allowed to name them
- bad: list[str] = []
- for node in ast.walk(tree):
- if isinstance(node, ast.ImportFrom) and node.module:
- for alias in node.names:
- use = FLOOR_VIOLATIONS.get((node.module, alias.name))
- if use:
- bad.append(f"line {node.lineno}: from {node.module} import {alias.name} -> use {use}")
- elif isinstance(node, ast.Import):
- for alias in node.names:
- use = FLOOR_VIOLATIONS.get((alias.name, None))
- if use:
- bad.append(f"line {node.lineno}: import {alias.name} -> use {use}")
- assert not bad, f"{path.relative_to(HARNESS)}: 3.11+ stdlib name(s) below the floor:\n " + "\n ".join(bad)
-
-
-# ------------------------------------------------------------------------ the shims work
-class Colour(StrEnum):
- RED = "red"
- DEEP_BLUE = enum.auto()
-
-
-#: 3.10 has no ``enum.StrEnum`` to compare against — there the shim is the only
-#: implementation, and the absolute assertions below are the whole contract.
-requires_stdlib_strenum = pytest.mark.skipif(
- not hasattr(enum, "StrEnum"), reason="enum.StrEnum needs python 3.11+"
-)
-
-
-def _std_colour() -> type:
- class StdColour(enum.StrEnum): # type: ignore[attr-defined]
- RED = "red"
- DEEP_BLUE = enum.auto()
-
- return StdColour
-
-
-def test_str_enum_shim_behaviour() -> None:
- """What every call site relies on: members are their value, everywhere."""
- assert str(Colour.RED) == "red"
- assert f"{Colour.RED}" == "red" and f"{Colour.RED:>5}" == " red"
- assert "%s" % Colour.RED == "red" # noqa: UP031 — %-formatting is exactly what this asserts
- assert json.dumps(Colour.RED) == '"red"'
- assert repr(Colour.RED) == "<Colour.RED: 'red'>"
- assert isinstance(Colour.RED, str) and Colour.RED == "red" and hash(Colour.RED) == hash("red")
- assert Colour.DEEP_BLUE == "deep_blue", "auto() must lower-case the member name"
- assert Colour("red") is Colour.RED
- assert sorted(Colour) == ["deep_blue", "red"]
-
-
-@requires_stdlib_strenum
-def test_str_enum_shim_matches_the_stdlib() -> None:
- """On 3.11+ the shim must be indistinguishable from ``enum.StrEnum``."""
- std_colour = _std_colour()
- for name in ("RED", "DEEP_BLUE"):
- shim, std = Colour[name], std_colour[name]
- assert str(shim) == str(std)
- assert f"{shim}" == f"{std}"
- assert f"{shim:>8}" == f"{std:>8}"
- assert "%s" % shim == "%s" % std # noqa: UP031 — %-formatting is exactly what this asserts
- assert json.dumps(shim) == json.dumps(std)
- assert repr(shim).split(".", 1)[1] == repr(std).split(".", 1)[1]
- assert shim.value == std.value and shim.name == std.name
-
-
-def test_str_enum_shim_serialises_through_pydantic() -> None:
- from pydantic import BaseModel
-
- class M(BaseModel):
- shim: Colour
-
- m = M(shim="red")
- assert m.model_dump_json() == '{"shim":"red"}'
- assert m.model_dump(mode="json") == {"shim": "red"}
- assert M.model_json_schema()["$defs"]["Colour"]["enum"] == ["red", "deep_blue"]
-
-
-def test_utc_shim() -> None:
- assert UTC is timezone.utc
- assert datetime.now(UTC).tzinfo is UTC
-
-
-def test_tomllib_shim_parses() -> None:
- assert tomllib.loads('a = 1\n[t]\nb = "x"\n') == {"a": 1, "t": {"b": "x"}}
-
-
-def test_compat_documents_every_shim() -> None:
- """Each exported shim must say in the module docstring when it can be deleted."""
- import codeverse._compat as compat
-
- doc = compat.__doc__ or ""
- for name in compat.__all__:
- assert name in doc, f"codeverse/_compat.py docstring never mentions {name}"
- assert "3.11" in doc
-
-
# ------------------------------------------------------------------- the node floor gate
@pytest.mark.parametrize(
"text,expected",
diff --git a/harness/tests/flywheel_cli/conftest.py b/harness/tests/flywheel_cli/conftest.py
index b68fe358..e6fb58c5 100644
--- a/harness/tests/flywheel_cli/conftest.py
+++ b/harness/tests/flywheel_cli/conftest.py
@@ -5,12 +5,11 @@ from __future__ import annotations
import struct
import zlib
-from datetime import datetime
+from datetime import UTC, datetime
from pathlib import Path
import pytest
-from codeverse._compat import UTC
from codeverse.contracts.artifacts import (
BuildResult,
GateFinding,
diff --git a/harness/tests/flywheel_cli/test_complexity_record.py b/harness/tests/flywheel_cli/test_complexity_record.py
index 25176d1f..9ab46150 100644
--- a/harness/tests/flywheel_cli/test_complexity_record.py
+++ b/harness/tests/flywheel_cli/test_complexity_record.py
@@ -19,8 +19,9 @@ REPO = Path(__file__).resolve().parents[2]
if str(REPO) not in sys.path:
sys.path.insert(0, str(REPO))
+from datetime import UTC # noqa: E402
+
from bench import complexity_report as CR # noqa: E402
-from codeverse._compat import UTC # noqa: E402
from codeverse.contracts.artifacts import Measurement # noqa: E402
from codeverse.contracts.common import Backends, Language, Track, Usage # noqa: E402
from codeverse.contracts.judgment import Judgment # noqa: E402
diff --git a/harness/tests/install/test_docs.py b/harness/tests/install/test_docs.py
index f213ae18..3d76bf4b 100644
--- a/harness/tests/install/test_docs.py
+++ b/harness/tests/install/test_docs.py
@@ -18,12 +18,11 @@ import os
import re
import subprocess
import sys
+import tomllib
from pathlib import Path
import pytest
-from codeverse._compat import tomllib
-
HARNESS = Path(__file__).resolve().parents[2]
REPO = HARNESS.parent
INSTALL = HARNESS / "docs" / "INSTALL.md"
diff --git a/harness/tests/models/test_retry.py b/harness/tests/models/test_retry.py
index aeac6e95..40b13c94 100644
--- a/harness/tests/models/test_retry.py
+++ b/harness/tests/models/test_retry.py
@@ -290,10 +290,9 @@ def test_live_tests_are_opt_in_by_default():
On 2026-08-24 a plain run on a keyed machine hung for the whole timeout because
the live suite was selected by default and the provider was in a capacity storm.
"""
+ import tomllib # 3.10 floor: stdlib tomllib is 3.11+
from pathlib import Path
- from codeverse._compat import tomllib # 3.10 floor: stdlib tomllib is 3.11+
-
root = Path(__file__).resolve().parents[2]
cfg = tomllib.loads((root / "pyproject.toml").read_text())
addopts = cfg["tool"]["pytest"]["ini_options"].get("addopts", [])
diff --git a/harness/tests/skills/test_packaging.py b/harness/tests/skills/test_packaging.py
index 1b0da453..35ee1873 100644
--- a/harness/tests/skills/test_packaging.py
+++ b/harness/tests/skills/test_packaging.py
@@ -12,13 +12,12 @@ from __future__ import annotations
import shutil
import subprocess
import sys
+import tomllib
import zipfile
from pathlib import Path
import pytest
-from codeverse._compat import tomllib
-
HARNESS = Path(__file__).resolve().parents[2]
PROBE = "cv3d-packaging-probe"