Skip to content

Commit 3f779bf

Browse files
committed
ci: fix tomllib ModuleNotFoundError on Python 3.10
Root cause: `tomllib` is stdlib only in Python 3.11+. The CI matrix includes 3.10, so `import tomllib` blew up with ModuleNotFoundError in the "Validate pyproject" step on the 3.10 leg. Fix: - ci.yml + publish.yml: try `tomllib`, fall back to `tomli`. - publish.yml: add explicit `pip install tomli` step (publish runs on 3.12 so tomllib usually works, but the fallback is now safe either way). No code changes; CI/publish only.
1 parent 398a333 commit 3f779bf

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ jobs:
4545
- name: Validate pyproject.toml
4646
run: |
4747
python - <<'PY'
48-
import tomllib, sys
48+
try:
49+
import tomllib
50+
except ModuleNotFoundError:
51+
import tomli as tomllib
52+
import sys
4953
d = tomllib.load(open("pyproject.toml", "rb"))
5054
assert "project" in d, "missing [project]"
5155
p = d["project"]

.github/workflows/publish.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@ jobs:
3737
python-version: "3.12"
3838
cache: pip
3939

40+
- name: Install validation deps
41+
run: pip install --upgrade pip tomli
42+
4043
- name: Validate pyproject for Comfy
4144
shell: bash
4245
run: |
4346
python - <<'PY'
44-
import tomllib
47+
try:
48+
import tomllib
49+
except ModuleNotFoundError:
50+
import tomli as tomllib
4551
d = tomllib.load(open("pyproject.toml", "rb"))
4652
p = d.get("project", {})
4753
assert p.get("name"), "[project].name required"

0 commit comments

Comments
 (0)