chore: require python 3.12 and simplify config

This commit is contained in:
banteg
2025-12-28 21:44:18 +04:00
parent 8be15d7df3
commit 540aeaeea4
8 changed files with 13 additions and 18 deletions
+5
View File
@@ -1 +1,6 @@
.codex/
*.sqlite
*.sqlite3
*.sqlite3-shm
*.sqlite3-wal
uv.lock
+1 -2
View File
@@ -3,11 +3,10 @@ name = "codex-telegram-bridge"
version = "0.1.0"
description = "Telegram bridge tools for Codex."
readme = "readme.md"
requires-python = ">=3.10"
requires-python = ">=3.12"
dependencies = [
"markdown-it-py",
"sulguk",
"tomli; python_version < '3.11'",
"typer",
]
+1 -2
View File
@@ -21,8 +21,7 @@ bot_token = "123:abc"
chat_id = 123456789
```
For Python < 3.11, install `tomli` to read TOML. `chat_id` is used both for allowed messages
and startup notifications.
`chat_id` is used both for allowed messages and startup notifications.
Optional keys (by mode):
@@ -26,16 +26,8 @@ def _now_unix() -> int:
def _load_toml(path: Path) -> Dict[str, Any]:
if not path.exists():
return {}
try:
import tomllib # type: ignore[attr-defined]
except ModuleNotFoundError:
try:
import tomli as tomllib # type: ignore[import-not-found]
except ModuleNotFoundError as e:
raise RuntimeError(
f"TOML config found at {path} but tomllib/tomli is unavailable. "
"Use Python 3.11+ or install tomli."
) from e
import tomllib
return tomllib.loads(path.read_text(encoding="utf-8"))
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
# dependencies = ["markdown-it-py", "sulguk", "typer"]
# ///
from __future__ import annotations
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
# dependencies = ["markdown-it-py", "sulguk", "typer"]
# ///
from __future__ import annotations
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
# dependencies = ["markdown-it-py", "sulguk", "typer"]
# ///
from __future__ import annotations
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
# dependencies = ["markdown-it-py", "sulguk", "typer"]
# ///
from __future__ import annotations