chore: require python 3.12 and simplify config
This commit is contained in:
@@ -1 +1,6 @@
|
|||||||
.codex/
|
.codex/
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
*.sqlite3-shm
|
||||||
|
*.sqlite3-wal
|
||||||
|
uv.lock
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ name = "codex-telegram-bridge"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Telegram bridge tools for Codex."
|
description = "Telegram bridge tools for Codex."
|
||||||
readme = "readme.md"
|
readme = "readme.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"markdown-it-py",
|
"markdown-it-py",
|
||||||
"sulguk",
|
"sulguk",
|
||||||
"tomli; python_version < '3.11'",
|
|
||||||
"typer",
|
"typer",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ bot_token = "123:abc"
|
|||||||
chat_id = 123456789
|
chat_id = 123456789
|
||||||
```
|
```
|
||||||
|
|
||||||
For Python < 3.11, install `tomli` to read TOML. `chat_id` is used both for allowed messages
|
`chat_id` is used both for allowed messages and startup notifications.
|
||||||
and startup notifications.
|
|
||||||
|
|
||||||
Optional keys (by mode):
|
Optional keys (by mode):
|
||||||
|
|
||||||
|
|||||||
@@ -26,16 +26,8 @@ def _now_unix() -> int:
|
|||||||
def _load_toml(path: Path) -> Dict[str, Any]:
|
def _load_toml(path: Path) -> Dict[str, Any]:
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
return {}
|
return {}
|
||||||
try:
|
import tomllib
|
||||||
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
|
|
||||||
return tomllib.loads(path.read_text(encoding="utf-8"))
|
return tomllib.loads(path.read_text(encoding="utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.10"
|
# requires-python = ">=3.10"
|
||||||
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
|
# dependencies = ["markdown-it-py", "sulguk", "typer"]
|
||||||
# ///
|
# ///
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.10"
|
# requires-python = ">=3.10"
|
||||||
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
|
# dependencies = ["markdown-it-py", "sulguk", "typer"]
|
||||||
# ///
|
# ///
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.10"
|
# requires-python = ">=3.10"
|
||||||
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
|
# dependencies = ["markdown-it-py", "sulguk", "typer"]
|
||||||
# ///
|
# ///
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.10"
|
# requires-python = ">=3.10"
|
||||||
# dependencies = ["markdown-it-py", "sulguk", "tomli; python_version < '3.11'"]
|
# dependencies = ["markdown-it-py", "sulguk", "typer"]
|
||||||
# ///
|
# ///
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user