Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

chore: remove Python 3.10 leftovers from pyproject and tests (#2104)

Sameer Kadam09dc294b88a5
diff --git a/pyproject.toml b/pyproject.toml
index cd22c5d5..2c25cdbf 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -101,10 +101,9 @@ llm-deepseek = ["openai>=1.0.0"]
llm-novita = ["openai>=1.0.0"]
llm-litellm = ["litellm>=1.83.9"]
llm-instructor = ["instructor>=1.15.3"]
-# TypeSafe SDK has no Python 3.9 release. Jev is also early-access, so keep the
-# integration on the reviewed 0.7 response contract until compatibility with a
-# newer minor line is verified.
-llm-typesafe = ["typesafe-sdk>=0.7.0,<0.8.0; python_version >= '3.10'"]
+# Jev is early-access, so keep the integration on the reviewed 0.7 response
+# contract until compatibility with a newer minor line is verified.
+llm-typesafe = ["typesafe-sdk>=0.7.0,<0.8.0"]
llm-all = [
"semantica[llm-openai,llm-groq,llm-gemini,llm-anthropic,llm-ollama,llm-deepseek,llm-novita,llm-litellm,llm-instructor,llm-typesafe]"
diff --git a/semantica/explorer/routes/ontology.py b/semantica/explorer/routes/ontology.py
index 3e02461c..f5f0c6e3 100644
--- a/semantica/explorer/routes/ontology.py
+++ b/semantica/explorer/routes/ontology.py
@@ -10,9 +10,8 @@ import socket
import uuid
from datetime import datetime, timezone
from difflib import SequenceMatcher
-from typing import Any, Dict, List, Optional, Tuple
+from typing import Any, Dict, List, Literal, Optional, Tuple
from urllib.parse import urljoin, urlparse
-from typing_extensions import Literal
from fastapi import APIRouter, Depends, HTTPException, Query, Request
from pydantic import BaseModel, Field
diff --git a/semantica/ingest/tableau_ingestor.py b/semantica/ingest/tableau_ingestor.py
index 30a3a925..42408047 100644
--- a/semantica/ingest/tableau_ingestor.py
+++ b/semantica/ingest/tableau_ingestor.py
@@ -44,9 +44,7 @@ License: MIT
import os
from dataclasses import dataclass, field
from datetime import datetime
-from typing import Any
-
-from typing_extensions import Self
+from typing import Any, Self
from ..utils.exceptions import ProcessingError, ValidationError
from ..utils.logging import get_logger
diff --git a/tests/test_bigquery_ingestor.py b/tests/test_bigquery_ingestor.py
index 9d389a80..595c8650 100644
--- a/tests/test_bigquery_ingestor.py
+++ b/tests/test_bigquery_ingestor.py
@@ -2028,13 +2028,8 @@ class TestNullIdHandling:
def _load_pyproject_toml():
- try:
- import tomllib # Python 3.11+
- except ModuleNotFoundError:
- try:
- import tomli as tomllib # backport for <3.11
- except ModuleNotFoundError:
- pytest.skip("tomllib / tomli not available — skipping TOML-based tests")
+ # stdlib since 3.11, the supported floor, so these tests can no longer skip.
+ import tomllib
from pathlib import Path
toml_path = Path(__file__).resolve().parents[1] / "pyproject.toml"
diff --git a/tests/test_issue_1513_slim_core.py b/tests/test_issue_1513_slim_core.py
index 2c4d3edd..478a0a80 100644
--- a/tests/test_issue_1513_slim_core.py
+++ b/tests/test_issue_1513_slim_core.py
@@ -1,3 +1,4 @@
+import tomllib
from pathlib import Path
from unittest.mock import patch
import pytest
@@ -10,21 +11,9 @@ from semantica.utils.exceptions import ProcessingError
def _load_toml(file_path: Path) -> dict:
- """Load and parse a TOML file across Python 3.8-3.14+ without mode mismatches."""
- content = file_path.read_text(encoding="utf-8")
- try:
- import tomllib # Python 3.11+ standard library
-
- return tomllib.loads(content)
- except ImportError:
- try:
- import tomli # Fast PEP 680 compatible parser for Python < 3.11
-
- return tomli.loads(content)
- except ImportError:
- import toml # Fallback toml parser
-
- return toml.loads(content)
+ """Load and parse a TOML file with the stdlib parser (3.11+ is the floor)."""
+ with open(file_path, "rb") as f:
+ return tomllib.load(f)
def test_core_dependencies_count():
diff --git a/tests/test_llm_typesafe.py b/tests/test_llm_typesafe.py
index 70fbab83..e6d9fd44 100644
--- a/tests/test_llm_typesafe.py
+++ b/tests/test_llm_typesafe.py
@@ -562,12 +562,12 @@ def test_result_round_trips_as_decision_provenance():
assert restored.metadata["typesafe_jev"]["probabilities"]["approve"] == 0.91
-def test_pyproject_guards_sdk_on_python_310_and_includes_aggregate_extra():
+def test_pyproject_pins_reviewed_sdk_line_and_includes_aggregate_extra():
pyproject = toml.load(Path(__file__).resolve().parents[1] / "pyproject.toml")
extras = pyproject["project"]["optional-dependencies"]
assert extras["llm-typesafe"] == [
- "typesafe-sdk>=0.7.0,<0.8.0; python_version >= '3.10'"
+ "typesafe-sdk>=0.7.0,<0.8.0"
]
assert "llm-typesafe" in extras["llm-all"][0]
diff --git a/tests/test_pyproject_extras.py b/tests/test_pyproject_extras.py
index 2c84e22a..8c85f730 100644
--- a/tests/test_pyproject_extras.py
+++ b/tests/test_pyproject_extras.py
@@ -2,26 +2,30 @@
Review of #1508 caught ``parse-pdf`` missing from every ``all`` bundle:
``semantica[all]`` installed the package without pdfplumber, so the default
-PDFParser raised ProcessingError on first use. The bundle block is parsed
-textually because the repo supported Python 3.9/3.10 when this was written,
-and tomllib is stdlib only from 3.11.
+PDFParser raised ProcessingError on first use.
"""
import re
+import tomllib
from pathlib import Path
PYPROJECT = Path(__file__).resolve().parents[1] / "pyproject.toml"
+def _extras():
+ with open(PYPROJECT, "rb") as f:
+ return tomllib.load(f)["project"]["optional-dependencies"]
+
+
def _extras_in_all_bundles():
- """Collect every extra name referenced inside the ``all = [...]`` block."""
- text = PYPROJECT.read_text(encoding="utf-8")
- match = re.search(r"^all = \[\n(.*?)^\]", text, re.MULTILINE | re.DOTALL)
- assert match, "pyproject.toml must define an aggregate 'all' extra"
+ """Collect every extra name referenced by the aggregate ``all`` extra."""
+ extras = _extras()
+ assert "all" in extras, "pyproject.toml must define an aggregate 'all' extra"
names = set()
- for bundle in re.findall(r"semantica\[([^\]]+)\]", match.group(1)):
- names.update(part.strip() for part in bundle.split(","))
+ for spec in extras["all"]:
+ for bundle in re.findall(r"semantica\[([^\]]+)\]", spec):
+ names.update(part.strip() for part in bundle.split(","))
assert names, "'all' bundles must reference at least one extra"
return names
@@ -40,6 +44,4 @@ def test_all_bundles_include_langdetect():
"""#1807: without langdetect, LanguageDetector reports every text as the
default language, so ``semantica[all]`` has to pull it in."""
assert "nlp-langdetect" in _extras_in_all_bundles()
- text = PYPROJECT.read_text(encoding="utf-8")
- match = re.search(r"^nlp-langdetect = \[\n(.*?)^\]", text, re.MULTILINE | re.DOTALL)
- assert match and "langdetect" in match.group(1)
+ assert any("langdetect" in spec for spec in _extras()["nlp-langdetect"])
diff --git a/uv.lock b/uv.lock
index fd780cef..df0da42e 100644
--- a/uv.lock
+++ b/uv.lock
@@ -7454,7 +7454,7 @@ requires-dist = [
{ name = "torch", marker = "extra == 'models-huggingface'", specifier = ">=1.13.1" },
{ name = "tqdm", specifier = ">=4.68.3" },
{ name = "transformers", marker = "extra == 'models-huggingface'", specifier = ">=4.20.0" },
- { name = "typesafe-sdk", marker = "python_full_version >= '3.10' and extra == 'llm-typesafe'", specifier = ">=0.7.0,<0.8.0" },
+ { name = "typesafe-sdk", marker = "extra == 'llm-typesafe'", specifier = ">=0.7.0,<0.8.0" },
{ name = "umap-learn", marker = "extra == 'viz'", specifier = ">=0.5.12" },
{ name = "uvicorn", extras = ["standard"], marker = "extra == 'explorer'", specifier = ">=0.22.0" },
{ name = "watchdog", marker = "extra == 'watch'", specifier = ">=6.0.0" },