diff --git a/.gitignore b/.gitignore index 28531ab..76faa90 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ .codex/ +*.sqlite +*.sqlite3 +*.sqlite3-shm +*.sqlite3-wal +uv.lock diff --git a/codex_telegram_bridge/pyproject.toml b/codex_telegram_bridge/pyproject.toml index 8e59571..cf84bd9 100644 --- a/codex_telegram_bridge/pyproject.toml +++ b/codex_telegram_bridge/pyproject.toml @@ -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", ] diff --git a/codex_telegram_bridge/readme.md b/codex_telegram_bridge/readme.md index 260a77c..b2d6d65 100644 --- a/codex_telegram_bridge/readme.md +++ b/codex_telegram_bridge/readme.md @@ -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): diff --git a/codex_telegram_bridge/src/codex_telegram_bridge/bridge_common.py b/codex_telegram_bridge/src/codex_telegram_bridge/bridge_common.py index 6662654..f44c742 100644 --- a/codex_telegram_bridge/src/codex_telegram_bridge/bridge_common.py +++ b/codex_telegram_bridge/src/codex_telegram_bridge/bridge_common.py @@ -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")) diff --git a/codex_telegram_bridge/src/codex_telegram_bridge/exec_bridge.py b/codex_telegram_bridge/src/codex_telegram_bridge/exec_bridge.py index e16e922..faeb66d 100644 --- a/codex_telegram_bridge/src/codex_telegram_bridge/exec_bridge.py +++ b/codex_telegram_bridge/src/codex_telegram_bridge/exec_bridge.py @@ -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 diff --git a/codex_telegram_bridge/src/codex_telegram_bridge/mcp_bridge.py b/codex_telegram_bridge/src/codex_telegram_bridge/mcp_bridge.py index 149cd13..1bb6fd8 100644 --- a/codex_telegram_bridge/src/codex_telegram_bridge/mcp_bridge.py +++ b/codex_telegram_bridge/src/codex_telegram_bridge/mcp_bridge.py @@ -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 diff --git a/codex_telegram_bridge/src/codex_telegram_bridge/tmux_notify.py b/codex_telegram_bridge/src/codex_telegram_bridge/tmux_notify.py index f3ff26a..57c050e 100644 --- a/codex_telegram_bridge/src/codex_telegram_bridge/tmux_notify.py +++ b/codex_telegram_bridge/src/codex_telegram_bridge/tmux_notify.py @@ -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 diff --git a/codex_telegram_bridge/src/codex_telegram_bridge/tmux_reply_bot.py b/codex_telegram_bridge/src/codex_telegram_bridge/tmux_reply_bot.py index 743490b..0a4e4f5 100644 --- a/codex_telegram_bridge/src/codex_telegram_bridge/tmux_reply_bot.py +++ b/codex_telegram_bridge/src/codex_telegram_bridge/tmux_reply_bot.py @@ -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