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:
@@ -28,7 +28,10 @@ from typing import Optional
|
|||||||
try:
|
try:
|
||||||
import tomllib # Python 3.11+
|
import tomllib # Python 3.11+
|
||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
tomllib = None # type: ignore
|
try:
|
||||||
|
import tomli as tomllib # Python 3.9/3.10 backport
|
||||||
|
except ImportError:
|
||||||
|
tomllib = None # type: ignore
|
||||||
|
|
||||||
|
|
||||||
SKIP_DIRS = {
|
SKIP_DIRS = {
|
||||||
@@ -130,7 +133,7 @@ def _parse_toml(path: Path) -> dict:
|
|||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
return tomllib.load(f)
|
return tomllib.load(f)
|
||||||
except (OSError, Exception):
|
except (OSError, tomllib.TOMLDecodeError):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ classifiers = [
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"chromadb>=1.5.4,<2",
|
"chromadb>=1.5.4,<2",
|
||||||
"pyyaml>=6.0,<7",
|
"pyyaml>=6.0,<7",
|
||||||
|
"tomli>=2.0.0; python_version < '3.11'",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|||||||
Reference in New Issue
Block a user