mirror of
https://github.com/andrewyng/openworker.git
synced 2026-09-03 04:49:26 +00:00
fix: import tomllib's tomli fallback on Python 3.10
requires-python declares >=3.10 and the README says "Python 3.10+", but coworker/config.py imports tomllib at module top and tomllib only landed in the 3.11 stdlib — on 3.10 the package cannot even be imported (every test module fails collection through the coworker.config import chain), so the advertised floor is broken in practice. Fall back to the tomli package (the pre-stdlib implementation of the same API) and declare it as a dependency only for python_version < '3.11', so 3.11+ installs are unchanged. Verified on 3.10: importing coworker.config and load_config() parsing a workspace config.toml both work through the fallback; the config suite still passes on 3.12. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
e0cb129d20
commit
abb7eef863
+4
-1
@@ -9,7 +9,10 @@ workspace path. Other permission grants remain global-only.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import tomllib
|
||||
try:
|
||||
import tomllib # stdlib since 3.11
|
||||
except ModuleNotFoundError: # 3.10, the floor requires-python declares
|
||||
import tomli as tomllib # type: ignore[no-redef]
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
@@ -34,6 +34,8 @@ dependencies = [
|
||||
# IANA tz database for zoneinfo. Windows ships no system tz db, so without this every
|
||||
# named schedule timezone (UTC, Asia/Kolkata, …) silently falls back to local time.
|
||||
"tzdata; sys_platform == 'win32'",
|
||||
# tomllib landed in the 3.11 stdlib; on the 3.10 floor config.py falls back to tomli.
|
||||
"tomli>=2; python_version < '3.11'",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user