fix(deps): add tomli fallback for Python <3.11

`tomllib` is stdlib only in Python 3.11+. On Python 3.9/3.10 (and the
macOS runner) the scanner's toml parsing returned empty, so manifest
lookups for `pyproject.toml` / `Cargo.toml` produced no name. CI
surfaced this via 4 test_project_scanner.py failures on the 3.9 matrix.

Add `tomli>=2.0.0` as a conditional dependency for `python_version <
'3.11'` and fall back to it in `project_scanner.py`. The project still
declares `requires-python = ">=3.9"` so the fallback is the correct
shape.
This commit is contained in:
Igor Lins e Silva
2026-04-24 00:27:09 -03:00
parent 9e7fa1ceb5
commit 14d7444abe
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -28,6 +28,9 @@ from typing import Optional
try:
import tomllib # Python 3.11+
except ImportError: # pragma: no cover
try:
import tomli as tomllib # Python 3.9/3.10 backport
except ImportError:
tomllib = None # type: ignore
@@ -130,7 +133,7 @@ def _parse_toml(path: Path) -> dict:
try:
with open(path, "rb") as f:
return tomllib.load(f)
except (OSError, Exception):
except (OSError, tomllib.TOMLDecodeError):
return {}
+1
View File
@@ -29,6 +29,7 @@ classifiers = [
dependencies = [
"chromadb>=1.5.4,<2",
"pyyaml>=6.0,<7",
"tomli>=2.0.0; python_version < '3.11'",
]
[project.urls]