fix: restore CI compatibility for release versioning

Lazy-load tomllib so Python 3.10 test collection succeeds, and apply the repo formatter change required by the 3.12 lint job.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
JerrettDavis 2026-04-16 17:59:18 -05:00
parent 8ac100aa7a
commit ffe3391b2d
2 changed files with 7 additions and 3 deletions

View file

@ -2532,7 +2532,8 @@ if __name__ == "__main__":
"--openai-api-url", help=f"Custom OpenAI API URL (default: {HeadroomProxy.OPENAI_API_URL})"
)
parser.add_argument(
"--anthropic-api-url", help=f"Custom Anthropic API URL (default: {HeadroomProxy.ANTHROPIC_API_URL})"
"--anthropic-api-url",
help=f"Custom Anthropic API URL (default: {HeadroomProxy.ANTHROPIC_API_URL})",
)
# Backend (anthropic direct, bedrock, openrouter, anyllm, or litellm-<provider>)

View file

@ -9,8 +9,6 @@ from collections.abc import Sequence
from dataclasses import dataclass, replace
from pathlib import Path
import tomllib
SEMVER_RE = re.compile(r"^(\d+)\.(\d+)\.(\d+)$")
RELEASE_TAG_RE = re.compile(r"^v(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?$")
@ -126,6 +124,11 @@ def compute_release_version(
def get_canonical_version(root: Path) -> str:
"""Read the canonical project version from pyproject.toml."""
try:
import tomllib
except ModuleNotFoundError: # pragma: no cover - Python 3.10 compatibility
import tomli as tomllib
with open(root / "pyproject.toml", "rb") as file:
data = tomllib.load(file)
return data["project"]["version"]