chore: require python 3.12 and simplify config
This commit is contained in:
@@ -1 +1,6 @@
|
||||
.codex/
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
*.sqlite3-shm
|
||||
*.sqlite3-wal
|
||||
uv.lock
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user