Dmitry Beresnev commited on
Commit
820c4b2
·
1 Parent(s): 47b314d

Add Telegram bot control interface for HuggingFace Spaces deployment

Browse files

The platform is now controlled through Telegram: app.py starts a FastAPI
webhook server (port 7860) while the polling loop runs in a background
thread managed by a new PlatformController.

New src/telegram_bot/ package:
- server.py: webhook endpoint /webhook/{WEBHOOK_SECRET}, health endpoints,
/set_webhook helper for registering the webhook with Telegram
- telegram_client.py: async httpx client routing all outbound calls through
the Google Apps Script proxy (GOOGLE_APPS_SCRIPT_URL) since HF Spaces
blocks direct api.telegram.org traffic; direct fallback for local dev
- bot_service.py: commands /status /regime /universe /events /telemetry
/subscribe /unsubscribe, plus admin-only /pause /resume /mute /unmute
/interval (restricted to TELEGRAM_CHAT_ID when set)
- controller.py: pause/resume flags, runtime poll-interval override,
ring buffers of recent risk events and regime changes

Core changes:
- Runtime now exposes risk, envelope_store and telemetry for the bot
- TelegramNotifier supports the Apps Script proxy, muting, and broadcast
to dynamically subscribed chats
- RiskEngine.regime property, Telemetry.snapshot()

Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ # curl for the HEALTHCHECK
4
+ RUN apt-get update && apt-get install -y --no-install-recommends curl && \
5
+ apt-get clean && rm -rf /var/lib/apt/lists/*
6
+
7
+ # HuggingFace Spaces runs containers as user 1000
8
+ RUN useradd -m -u 1000 user
9
+ USER user
10
+
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH \
13
+ PYTHONPATH=/home/user/app \
14
+ PYTHONUNBUFFERED=1 \
15
+ PYTHONDONTWRITEBYTECODE=1
16
+
17
+ WORKDIR $HOME/app
18
+
19
+ RUN pip install --no-cache-dir --upgrade pip
20
+
21
+ # Install dependencies first for layer caching
22
+ COPY --chown=user pyproject.toml README.md $HOME/app/
23
+ RUN pip install --no-cache-dir fastapi httpx lxml numpy pandas pydantic pyyaml requests uvicorn yfinance
24
+
25
+ COPY --chown=user src/ $HOME/app/src/
26
+ COPY --chown=user configs/ $HOME/app/configs/
27
+ COPY --chown=user app.py $HOME/app/
28
+
29
+ EXPOSE 7860
30
+
31
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
32
+ CMD curl --fail http://localhost:7860/health || exit 1
33
+
34
+ CMD ["python", "app.py"]
app.py CHANGED
@@ -1,5 +1,10 @@
1
- from src.core.main import run_forever
 
 
 
 
 
2
 
3
 
4
  if __name__ == "__main__":
5
- run_forever()
 
1
+ """HuggingFace Spaces entrypoint: Telegram bot webhook server + platform loop.
2
+
3
+ For the headless polling loop without the bot, run `python -m src.core.main`.
4
+ """
5
+
6
+ from src.telegram_bot.server import main
7
 
8
 
9
  if __name__ == "__main__":
10
+ main()
pyproject.toml CHANGED
@@ -5,11 +5,15 @@ description = "Market-wide risk radar with universe loading, price ingestion, an
5
  readme = "README.md"
6
  requires-python = ">=3.10,<3.13"
7
  dependencies = [
 
 
8
  "lxml",
9
  "numpy",
10
  "pandas",
 
11
  "pyyaml",
12
  "requests",
 
13
  "yfinance",
14
  ]
15
 
 
5
  readme = "README.md"
6
  requires-python = ">=3.10,<3.13"
7
  dependencies = [
8
+ "fastapi",
9
+ "httpx",
10
  "lxml",
11
  "numpy",
12
  "pandas",
13
+ "pydantic",
14
  "pyyaml",
15
  "requests",
16
+ "uvicorn",
17
  "yfinance",
18
  ]
19
 
src/core/alerting.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Dict, List
2
  import logging
3
  import time
4
  import uuid
@@ -11,6 +11,7 @@ from .config import (
11
  TIMEFRAMES_MIN,
12
  TELEGRAM_BOT_TOKEN_ENV,
13
  TELEGRAM_CHAT_ID_ENV,
 
14
  )
15
  from .retry_utils import backoff_delay
16
 
@@ -88,21 +89,54 @@ def build_data_gap_alert(gap_event: Dict) -> Dict:
88
 
89
 
90
  class TelegramNotifier:
 
 
 
 
 
 
 
 
91
  def __init__(self) -> None:
92
  self._token = os.getenv(TELEGRAM_BOT_TOKEN_ENV)
93
  self._chat_id = os.getenv(TELEGRAM_CHAT_ID_ENV)
 
 
 
94
 
95
  def send(self, alert: Dict) -> bool:
96
- if not self._token or not self._chat_id:
 
 
 
 
 
 
 
97
  logger.info("telegram credentials missing, alert not delivered: %s", alert["message"])
98
  return True
99
- url = f"https://api.telegram.org/bot{self._token}/sendMessage"
100
- payload = {"chat_id": self._chat_id, "text": alert["message"]}
 
 
 
 
 
101
  try:
102
- resp = requests.post(url, json=payload, timeout=10)
 
 
 
 
 
 
 
 
 
 
103
  return resp.status_code == 200
104
  except Exception:
105
- logger.warning("telegram send failed: %s", alert["message"])
106
  return False
107
 
108
 
 
1
+ from typing import Callable, Dict, Iterable, List, Optional
2
  import logging
3
  import time
4
  import uuid
 
11
  TIMEFRAMES_MIN,
12
  TELEGRAM_BOT_TOKEN_ENV,
13
  TELEGRAM_CHAT_ID_ENV,
14
+ TELEGRAM_PROXY_URL_ENV,
15
  )
16
  from .retry_utils import backoff_delay
17
 
 
89
 
90
 
91
  class TelegramNotifier:
92
+ """Delivers alerts to Telegram, either directly or through a Google Apps
93
+ Script proxy (HuggingFace Spaces blocks direct api.telegram.org calls).
94
+
95
+ `chat_ids_provider` lets the Telegram bot add dynamically subscribed chats
96
+ on top of the static TELEGRAM_CHAT_ID; `muted` silences delivery without
97
+ touching the alert pipeline.
98
+ """
99
+
100
  def __init__(self) -> None:
101
  self._token = os.getenv(TELEGRAM_BOT_TOKEN_ENV)
102
  self._chat_id = os.getenv(TELEGRAM_CHAT_ID_ENV)
103
+ self._proxy_url = os.getenv(TELEGRAM_PROXY_URL_ENV)
104
+ self.muted = False
105
+ self.chat_ids_provider: Optional[Callable[[], Iterable[str]]] = None
106
 
107
  def send(self, alert: Dict) -> bool:
108
+ if self.muted:
109
+ return True
110
+
111
+ chat_ids = {str(self._chat_id)} if self._chat_id else set()
112
+ if self.chat_ids_provider is not None:
113
+ chat_ids.update(str(chat_id) for chat_id in self.chat_ids_provider())
114
+
115
+ if not self._token or not chat_ids:
116
  logger.info("telegram credentials missing, alert not delivered: %s", alert["message"])
117
  return True
118
+
119
+ ok = True
120
+ for chat_id in chat_ids:
121
+ ok = self._send_one(chat_id, alert["message"]) and ok
122
+ return ok
123
+
124
+ def _send_one(self, chat_id: str, text: str) -> bool:
125
  try:
126
+ if self._proxy_url:
127
+ payload = {
128
+ "method": "sendMessage",
129
+ "bot_token": self._token,
130
+ "chat_id": chat_id,
131
+ "text": text,
132
+ }
133
+ resp = requests.post(self._proxy_url, json=payload, timeout=15)
134
+ else:
135
+ url = f"https://api.telegram.org/bot{self._token}/sendMessage"
136
+ resp = requests.post(url, json={"chat_id": chat_id, "text": text}, timeout=10)
137
  return resp.status_code == 200
138
  except Exception:
139
+ logger.warning("telegram send failed for chat %s: %s", chat_id, text)
140
  return False
141
 
142
 
src/core/config.py CHANGED
@@ -115,6 +115,9 @@ COMMODITY_TICKERS = [
115
  # Telegram bot (no auth on load; uses env vars at runtime)
116
  TELEGRAM_BOT_TOKEN_ENV = "TELEGRAM_BOT_TOKEN"
117
  TELEGRAM_CHAT_ID_ENV = "TELEGRAM_CHAT_ID"
 
 
 
118
 
119
  # yfinance backoff
120
  YF_MAX_RETRIES = 3
 
115
  # Telegram bot (no auth on load; uses env vars at runtime)
116
  TELEGRAM_BOT_TOKEN_ENV = "TELEGRAM_BOT_TOKEN"
117
  TELEGRAM_CHAT_ID_ENV = "TELEGRAM_CHAT_ID"
118
+ # Google Apps Script proxy for Telegram API calls (HuggingFace Spaces blocks
119
+ # direct calls to api.telegram.org); empty = call Telegram directly
120
+ TELEGRAM_PROXY_URL_ENV = "GOOGLE_APPS_SCRIPT_URL"
121
 
122
  # yfinance backoff
123
  YF_MAX_RETRIES = 3
src/core/main.py CHANGED
@@ -37,6 +37,9 @@ class Runtime:
37
  queue: AlertQueue
38
  loader: UniverseLoader
39
  universe: Dict[str, List[str]]
 
 
 
40
  ingestors: Dict[str, PriceIngestor] = field(default_factory=dict)
41
  cycle: int = 0
42
 
@@ -70,6 +73,9 @@ def build_runtime() -> Runtime:
70
  queue=queue,
71
  loader=UniverseLoader(),
72
  universe={},
 
 
 
73
  )
74
  _load_universe(runtime)
75
  return runtime
 
37
  queue: AlertQueue
38
  loader: UniverseLoader
39
  universe: Dict[str, List[str]]
40
+ risk: RiskEngine
41
+ envelope_store: RiskEnvelopeStore
42
+ telemetry: Telemetry
43
  ingestors: Dict[str, PriceIngestor] = field(default_factory=dict)
44
  cycle: int = 0
45
 
 
73
  queue=queue,
74
  loader=UniverseLoader(),
75
  universe={},
76
+ risk=risk,
77
+ envelope_store=envelope_store,
78
+ telemetry=telemetry,
79
  )
80
  _load_universe(runtime)
81
  return runtime
src/core/risk_engine.py CHANGED
@@ -33,6 +33,10 @@ class RiskEngine:
33
  self._cycle_worst_drop = 0.0
34
  self._cycle_high_severity = 0
35
 
 
 
 
 
36
  def on_universe_snapshot(self, universe_snapshot: Dict) -> None:
37
  self._universe_id = universe_snapshot.get("universe_id", "unknown")
38
 
 
33
  self._cycle_worst_drop = 0.0
34
  self._cycle_high_severity = 0
35
 
36
+ @property
37
+ def regime(self) -> str:
38
+ return self._regime.state
39
+
40
  def on_universe_snapshot(self, universe_snapshot: Dict) -> None:
41
  self._universe_id = universe_snapshot.get("universe_id", "unknown")
42
 
src/core/telemetry.py CHANGED
@@ -34,6 +34,9 @@ class Telemetry:
34
  self._counters[f"risk_regime_to:{to_regime}"] += 1
35
  self._maybe_report()
36
 
 
 
 
37
  def report(self) -> None:
38
  if not self._counters:
39
  return
 
34
  self._counters[f"risk_regime_to:{to_regime}"] += 1
35
  self._maybe_report()
36
 
37
+ def snapshot(self) -> Dict[str, int]:
38
+ return dict(self._counters)
39
+
40
  def report(self) -> None:
41
  if not self._counters:
42
  return
src/telegram_bot/__init__.py ADDED
File without changes
src/telegram_bot/bot_service.py ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Telegram command interface for the market analyzing platform."""
2
+
3
+ import logging
4
+ from datetime import datetime, timezone
5
+
6
+ from .config import BotConfig
7
+ from .controller import PlatformController
8
+ from .telegram_client import TelegramClient
9
+ from .tg_models import TelegramUpdate
10
+
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+ STATE_EMOJI = {"running": "🟢", "paused": "⏸", "starting": "⏳", "failed": "🔴"}
15
+ REGIME_EMOJI = {"normal": "🟢", "tension": "🟡", "stress": "🟠", "panic": "🔴"}
16
+
17
+ # Commands that change platform behaviour; restricted to the admin chat
18
+ # (TELEGRAM_CHAT_ID) when one is configured.
19
+ CONTROL_COMMANDS = {"/pause", "/resume", "/mute", "/unmute", "/interval"}
20
+
21
+ HELP_TEXT = """🤖 <b>Market Risk Radar — control bot</b>
22
+
23
+ <b>Monitoring:</b>
24
+ /status - Platform state, cycle, regime, universe sizes
25
+ /regime - Current risk regime + trading envelope
26
+ /universe [venue] - Ticker counts, or tickers of one venue
27
+ /events [N] - Last N detected risk events (default 10)
28
+ /telemetry - Event counters since start
29
+
30
+ <b>Alerts:</b>
31
+ /subscribe - Receive risk alerts in this chat
32
+ /unsubscribe - Stop receiving alerts here
33
+ /mute - Silence all alert delivery
34
+ /unmute - Re-enable alert delivery
35
+
36
+ <b>Control:</b>
37
+ /pause - Pause the polling loop
38
+ /resume - Resume the polling loop
39
+ /interval SECONDS - Set poll interval (15-3600)
40
+
41
+ /help - This message"""
42
+
43
+
44
+ class TelegramBotService:
45
+ def __init__(
46
+ self,
47
+ controller: PlatformController,
48
+ client: TelegramClient,
49
+ config: type[BotConfig] = BotConfig,
50
+ ) -> None:
51
+ self._controller = controller
52
+ self._client = client
53
+ self._config = config
54
+
55
+ async def process_update(self, update: TelegramUpdate) -> None:
56
+ try:
57
+ message = update.message or update.edited_message
58
+ if not message:
59
+ logger.debug("update %s has no message, skipping", update.update_id)
60
+ return
61
+
62
+ chat_id = message.get("chat", {}).get("id")
63
+ text = (message.get("text") or "").strip()
64
+ user_name = message.get("from", {}).get("first_name", "User")
65
+ if not chat_id:
66
+ logger.warning("no chat id in update %s", update.update_id)
67
+ return
68
+
69
+ logger.info("message %r from %s (chat %s)", text, user_name, chat_id)
70
+ if text.startswith("/"):
71
+ await self._handle_command(chat_id, text, user_name)
72
+ else:
73
+ await self._client.send_message(
74
+ chat_id,
75
+ f"Hello {user_name}! 👋 I control the market risk radar.\n"
76
+ "Type /help to see what I can do.",
77
+ )
78
+ except Exception:
79
+ logger.exception("error processing update")
80
+ message = update.message or update.edited_message
81
+ chat_id = (message or {}).get("chat", {}).get("id")
82
+ if chat_id:
83
+ await self._client.send_message(
84
+ chat_id, "Sorry, something went wrong. Please try again later."
85
+ )
86
+
87
+ async def _handle_command(self, chat_id: int, text: str, user_name: str) -> None:
88
+ parts = text.split()
89
+ # Strip the bot-name suffix Telegram adds in groups (/status@MyBot)
90
+ command = parts[0].lower().split("@")[0]
91
+ args = parts[1:]
92
+
93
+ if command in CONTROL_COMMANDS and not self._is_admin(chat_id):
94
+ await self._client.send_message(
95
+ chat_id, "⛔ This command is restricted to the admin chat."
96
+ )
97
+ return
98
+
99
+ handlers = {
100
+ "/start": self._cmd_start,
101
+ "/hello": self._cmd_start,
102
+ "/help": self._cmd_help,
103
+ "/status": self._cmd_status,
104
+ "/regime": self._cmd_regime,
105
+ "/universe": self._cmd_universe,
106
+ "/events": self._cmd_events,
107
+ "/telemetry": self._cmd_telemetry,
108
+ "/subscribe": self._cmd_subscribe,
109
+ "/unsubscribe": self._cmd_unsubscribe,
110
+ "/mute": self._cmd_mute,
111
+ "/unmute": self._cmd_unmute,
112
+ "/pause": self._cmd_pause,
113
+ "/resume": self._cmd_resume,
114
+ "/interval": self._cmd_interval,
115
+ }
116
+ handler = handlers.get(command)
117
+ if handler is None:
118
+ await self._client.send_message(
119
+ chat_id, f"❓ Unknown command: {command}\n\nType /help to see available commands."
120
+ )
121
+ return
122
+ await handler(chat_id, args, user_name)
123
+
124
+ def _is_admin(self, chat_id: int) -> bool:
125
+ admin = self._config.ADMIN_CHAT_ID
126
+ return not admin or str(chat_id) == str(admin)
127
+
128
+ # -- handlers ----------------------------------------------------------
129
+
130
+ async def _cmd_start(self, chat_id: int, args: list[str], user_name: str) -> None:
131
+ await self._client.send_message(
132
+ chat_id,
133
+ f"👋 Hello, {user_name}! I'm the control interface of the "
134
+ f"<b>Market Risk Radar</b> — a platform polling US/EU equities, "
135
+ f"crypto and commodities for abnormal price moves.\n\n{HELP_TEXT}",
136
+ )
137
+
138
+ async def _cmd_help(self, chat_id: int, args: list[str], user_name: str) -> None:
139
+ await self._client.send_message(chat_id, HELP_TEXT)
140
+
141
+ async def _cmd_status(self, chat_id: int, args: list[str], user_name: str) -> None:
142
+ status = self._controller.status()
143
+ state = status["state"]
144
+ lines = [
145
+ "📊 <b>Platform Status</b>",
146
+ "",
147
+ f"{STATE_EMOJI.get(state, '❔')} State: <b>{state}</b>",
148
+ ]
149
+ if status["startup_error"]:
150
+ lines.append(f"❌ Startup error: {status['startup_error']}")
151
+ lines += [
152
+ f"⏱ Uptime: {_fmt_duration(status['uptime_sec'])}",
153
+ f"🔁 Poll interval: {status['poll_interval_sec']}s",
154
+ f"🔔 Alerts: {'muted 🔇' if status['muted'] else 'active 🔊'}",
155
+ f"👥 Subscribed chats: {status['subscribers']}",
156
+ ]
157
+ if "cycle" in status:
158
+ regime = status["regime"]
159
+ lines += [
160
+ f"🔄 Cycles completed: {status['cycle']}",
161
+ f"{REGIME_EMOJI.get(regime, '❔')} Regime: <b>{regime}</b>",
162
+ ]
163
+ if status["last_cycle_duration_sec"] is not None:
164
+ lines.append(f"⚙️ Last cycle took: {status['last_cycle_duration_sec']}s")
165
+ lines.append("")
166
+ lines.append("<b>Universe:</b>")
167
+ total = 0
168
+ for venue, count in sorted(status["universe"].items()):
169
+ lines.append(f" • {venue}: {count}")
170
+ total += count
171
+ lines.append(f" Σ {total} tickers")
172
+ elif state == "starting":
173
+ lines.append("\n⏳ Universe is loading, try again in a minute.")
174
+ await self._client.send_message(chat_id, "\n".join(lines))
175
+
176
+ async def _cmd_regime(self, chat_id: int, args: list[str], user_name: str) -> None:
177
+ info = self._controller.regime_info()
178
+ if info is None:
179
+ await self._client.send_message(chat_id, "⏳ Platform is still starting, try again soon.")
180
+ return
181
+ regime = info["regime"]
182
+ policy = info["policy"]
183
+ lines = [
184
+ f"{REGIME_EMOJI.get(regime, '❔')} <b>Risk regime: {regime.upper()}</b>",
185
+ "",
186
+ "<b>Trading envelope:</b>",
187
+ f" • Trading allowed: {'✅ yes' if policy.get('allowed') else '🚫 no'}",
188
+ f" • Max position: ${policy.get('max_position_usd', 0):,.0f}",
189
+ f" • Max order: ${policy.get('max_order_usd', 0):,.0f}",
190
+ f" • Max leverage: {policy.get('max_leverage', 0)}",
191
+ f" • Cooldown: {policy.get('cooldown_seconds', 0)}s",
192
+ f" • Confidence: {policy.get('confidence', 0)}",
193
+ ]
194
+ envelope = info["envelope"]
195
+ if envelope:
196
+ valid_until = datetime.fromtimestamp(
197
+ envelope["valid_until_ms"] / 1000, tz=timezone.utc
198
+ ).strftime("%H:%M:%S UTC")
199
+ lines.append(f" • Active envelope valid until: {valid_until}")
200
+ changes = self._controller.regime_changes()
201
+ if changes:
202
+ lines += ["", "<b>Recent regime changes:</b>"]
203
+ for change in changes:
204
+ lines.append(
205
+ f" • {_fmt_ts(change['ts'])} "
206
+ f"{change['from_regime']} → {change['to_regime']}"
207
+ )
208
+ await self._client.send_message(chat_id, "\n".join(lines))
209
+
210
+ async def _cmd_universe(self, chat_id: int, args: list[str], user_name: str) -> None:
211
+ universe = self._controller.universe()
212
+ if universe is None:
213
+ await self._client.send_message(chat_id, "⏳ Universe is still loading, try again soon.")
214
+ return
215
+ if args:
216
+ venue = args[0].lower()
217
+ tickers = universe.get(venue)
218
+ if tickers is None:
219
+ await self._client.send_message(
220
+ chat_id,
221
+ f"❓ Unknown venue <code>{venue}</code>.\n"
222
+ f"Known venues: {', '.join(sorted(universe))}",
223
+ )
224
+ return
225
+ preview = ", ".join(tickers[:50])
226
+ more = f" … (+{len(tickers) - 50} more)" if len(tickers) > 50 else ""
227
+ await self._client.send_long_message(
228
+ chat_id, f"🌐 <b>{venue}</b> — {len(tickers)} tickers:\n{preview}{more}"
229
+ )
230
+ return
231
+ lines = ["🌐 <b>Universe</b>", ""]
232
+ total = 0
233
+ for venue, tickers in sorted(universe.items()):
234
+ lines.append(f" • {venue}: {len(tickers)}")
235
+ total += len(tickers)
236
+ lines += ["", f"Σ {total} tickers. Use /universe VENUE to list tickers."]
237
+ await self._client.send_message(chat_id, "\n".join(lines))
238
+
239
+ async def _cmd_events(self, chat_id: int, args: list[str], user_name: str) -> None:
240
+ limit = 10
241
+ if args:
242
+ try:
243
+ limit = max(1, min(50, int(args[0])))
244
+ except ValueError:
245
+ pass
246
+ events = self._controller.events(limit)
247
+ if not events:
248
+ await self._client.send_message(chat_id, "ℹ️ No risk events detected yet.")
249
+ return
250
+ lines = [f"🚨 <b>Last {len(events)} risk events</b>", ""]
251
+ for event in events:
252
+ sev_emoji = "🔴" if event.get("severity") == "high" else "🟠"
253
+ lines.append(
254
+ f"{sev_emoji} {_fmt_ts(event['ts'])} <b>{event['ticker']}</b> "
255
+ f"{event['timeframe']} {event['delta_pct']:+.2f}% "
256
+ f"(thr {event['threshold']:.2f}%)"
257
+ )
258
+ await self._client.send_long_message(chat_id, "\n".join(lines))
259
+
260
+ async def _cmd_telemetry(self, chat_id: int, args: list[str], user_name: str) -> None:
261
+ counters = self._controller.telemetry()
262
+ if counters is None:
263
+ await self._client.send_message(chat_id, "⏳ Platform is still starting, try again soon.")
264
+ return
265
+ if not counters:
266
+ await self._client.send_message(chat_id, "ℹ️ No telemetry counters yet.")
267
+ return
268
+ lines = ["📈 <b>Telemetry</b>", ""]
269
+ for key, value in sorted(counters.items()):
270
+ lines.append(f" • {key}: {value}")
271
+ await self._client.send_long_message(chat_id, "\n".join(lines))
272
+
273
+ async def _cmd_subscribe(self, chat_id: int, args: list[str], user_name: str) -> None:
274
+ if self._controller.subscribe(chat_id):
275
+ await self._client.send_message(
276
+ chat_id, "✅ Subscribed — risk alerts will be delivered to this chat."
277
+ )
278
+ else:
279
+ await self._client.send_message(chat_id, "ℹ️ This chat is already subscribed.")
280
+
281
+ async def _cmd_unsubscribe(self, chat_id: int, args: list[str], user_name: str) -> None:
282
+ if self._controller.unsubscribe(chat_id):
283
+ await self._client.send_message(chat_id, "✅ Unsubscribed — no more alerts here.")
284
+ else:
285
+ await self._client.send_message(chat_id, "ℹ️ This chat was not subscribed.")
286
+
287
+ async def _cmd_mute(self, chat_id: int, args: list[str], user_name: str) -> None:
288
+ if self._controller.set_muted(True):
289
+ await self._client.send_message(chat_id, "🔇 Alert delivery muted for all chats.")
290
+ else:
291
+ await self._client.send_message(chat_id, "⏳ Platform is still starting, try again soon.")
292
+
293
+ async def _cmd_unmute(self, chat_id: int, args: list[str], user_name: str) -> None:
294
+ if self._controller.set_muted(False):
295
+ await self._client.send_message(chat_id, "🔊 Alert delivery re-enabled.")
296
+ else:
297
+ await self._client.send_message(chat_id, "⏳ Platform is still starting, try again soon.")
298
+
299
+ async def _cmd_pause(self, chat_id: int, args: list[str], user_name: str) -> None:
300
+ if self._controller.pause():
301
+ await self._client.send_message(chat_id, "⏸ Polling loop paused. /resume to continue.")
302
+ else:
303
+ await self._client.send_message(chat_id, "ℹ️ Polling loop is already paused.")
304
+
305
+ async def _cmd_resume(self, chat_id: int, args: list[str], user_name: str) -> None:
306
+ if self._controller.resume():
307
+ await self._client.send_message(chat_id, "▶️ Polling loop resumed.")
308
+ else:
309
+ await self._client.send_message(chat_id, "ℹ️ Polling loop is not paused.")
310
+
311
+ async def _cmd_interval(self, chat_id: int, args: list[str], user_name: str) -> None:
312
+ if not args:
313
+ await self._client.send_message(
314
+ chat_id,
315
+ f"ℹ️ Current poll interval: {self._controller.poll_interval}s.\n"
316
+ "Usage: /interval SECONDS (15-3600)",
317
+ )
318
+ return
319
+ try:
320
+ requested = int(args[0])
321
+ except ValueError:
322
+ await self._client.send_message(chat_id, "❌ Interval must be a number of seconds.")
323
+ return
324
+ applied = self._controller.set_poll_interval(requested)
325
+ note = "" if applied == requested else f" (requested {requested}s was clamped)"
326
+ await self._client.send_message(chat_id, f"✅ Poll interval set to {applied}s{note}.")
327
+
328
+
329
+ def _fmt_duration(seconds: int) -> str:
330
+ hours, rem = divmod(seconds, 3600)
331
+ minutes, secs = divmod(rem, 60)
332
+ if hours:
333
+ return f"{hours}h {minutes}m"
334
+ if minutes:
335
+ return f"{minutes}m {secs}s"
336
+ return f"{secs}s"
337
+
338
+
339
+ def _fmt_ts(ts_ms: int) -> str:
340
+ return datetime.fromtimestamp(ts_ms / 1000, tz=timezone.utc).strftime("%m-%d %H:%M")
src/telegram_bot/config.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Telegram bot configuration.
2
+
3
+ All values come from environment variables at import time — there is no .env
4
+ file parsing. On HuggingFace Spaces set these as Space secrets/variables.
5
+ """
6
+
7
+ import logging
8
+ import os
9
+
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class BotConfig:
15
+ # Reuses the same env vars as the core alerting pipeline
16
+ BOT_TOKEN: str = os.getenv("TELEGRAM_BOT_TOKEN", "")
17
+ ADMIN_CHAT_ID: str = os.getenv("TELEGRAM_CHAT_ID", "")
18
+
19
+ # Google Apps Script proxy; required on HuggingFace Spaces because direct
20
+ # calls to api.telegram.org are blocked there. Empty = call Telegram directly.
21
+ PROXY_URL: str = os.getenv("GOOGLE_APPS_SCRIPT_URL", "")
22
+
23
+ # Secret path segment of the webhook URL: /webhook/{WEBHOOK_SECRET}
24
+ WEBHOOK_SECRET: str = os.getenv("WEBHOOK_SECRET", "secret-key")
25
+
26
+ # Set automatically by HuggingFace Spaces (e.g. "user-space.hf.space")
27
+ SPACE_HOST: str = os.getenv("SPACE_HOST", "")
28
+
29
+ PORT: int = int(os.getenv("PORT", "7860"))
30
+
31
+ @classmethod
32
+ def webhook_url(cls) -> str:
33
+ if not cls.SPACE_HOST:
34
+ return ""
35
+ return f"https://{cls.SPACE_HOST}/webhook/{cls.WEBHOOK_SECRET}"
36
+
37
+ @classmethod
38
+ def validate(cls) -> bool:
39
+ """Log missing settings; the platform still runs without them."""
40
+ ok = True
41
+ if not cls.BOT_TOKEN:
42
+ logger.warning("TELEGRAM_BOT_TOKEN is not set — bot cannot send messages")
43
+ ok = False
44
+ if not cls.PROXY_URL:
45
+ logger.warning(
46
+ "GOOGLE_APPS_SCRIPT_URL is not set — falling back to direct "
47
+ "Telegram API calls (blocked on HuggingFace Spaces)"
48
+ )
49
+ return ok
src/telegram_bot/controller.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Bridge between the async Telegram bot and the synchronous polling core.
2
+
3
+ The platform loop (build_runtime/run_once) runs in a daemon thread; the bot
4
+ reads state snapshots and flips thread-safe flags (pause, mute, interval).
5
+ Consistent with the rest of the POC, subscriber chats and pause state are
6
+ in-memory only and reset on restart.
7
+ """
8
+
9
+ import logging
10
+ import threading
11
+ import time
12
+ from collections import deque
13
+ from typing import Dict, List, Optional
14
+
15
+ from src.core.config import POLL_INTERVAL_SEC, RISK_ENVELOPE_POLICY
16
+ from src.core.main import Runtime, build_runtime, run_once
17
+ from src.core.topics import TOPICS
18
+
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+ MIN_POLL_INTERVAL_SEC = 15
23
+ MAX_POLL_INTERVAL_SEC = 3600
24
+
25
+
26
+ class PlatformController:
27
+ def __init__(self) -> None:
28
+ self.runtime: Optional[Runtime] = None
29
+ self.poll_interval = POLL_INTERVAL_SEC
30
+ self.started_at = time.time()
31
+ self.startup_error: Optional[str] = None
32
+ self.last_cycle_ts: Optional[float] = None
33
+ self.last_cycle_duration: Optional[float] = None
34
+
35
+ self.recent_risk_events: deque = deque(maxlen=50)
36
+ self.recent_regime_changes: deque = deque(maxlen=20)
37
+
38
+ self._subscribers: set[str] = set()
39
+ self._subscribers_lock = threading.Lock()
40
+
41
+ self._paused = threading.Event()
42
+ self._stop = threading.Event()
43
+ self._thread: Optional[threading.Thread] = None
44
+
45
+ # -- lifecycle ---------------------------------------------------------
46
+
47
+ def start(self) -> None:
48
+ if self._thread is not None:
49
+ return
50
+ self._thread = threading.Thread(target=self._run_loop, name="platform-loop", daemon=True)
51
+ self._thread.start()
52
+
53
+ def stop(self) -> None:
54
+ self._stop.set()
55
+
56
+ def _run_loop(self) -> None:
57
+ try:
58
+ # Universe load hits GitHub/Wikipedia/Binance; may take a while
59
+ runtime = build_runtime()
60
+ except Exception as exc:
61
+ logger.exception("platform runtime failed to build")
62
+ self.startup_error = str(exc)
63
+ return
64
+
65
+ runtime.pubsub.subscribe(TOPICS["risk_event"], self.recent_risk_events.append)
66
+ runtime.pubsub.subscribe(TOPICS["risk_regime_change"], self.recent_regime_changes.append)
67
+ runtime.notifier.chat_ids_provider = self.subscribers
68
+ self.runtime = runtime
69
+ logger.info("platform runtime ready, entering poll loop")
70
+
71
+ while not self._stop.is_set():
72
+ if not self._paused.is_set():
73
+ started = time.time()
74
+ try:
75
+ run_once(runtime)
76
+ except Exception:
77
+ logger.exception("poll cycle failed")
78
+ self.last_cycle_ts = time.time()
79
+ self.last_cycle_duration = self.last_cycle_ts - started
80
+ # Sleep in small steps so pause/interval changes apply quickly
81
+ deadline = time.time() + self.poll_interval
82
+ while time.time() < deadline and not self._stop.is_set():
83
+ time.sleep(1)
84
+
85
+ # -- control commands --------------------------------------------------
86
+
87
+ def pause(self) -> bool:
88
+ """Returns False if already paused."""
89
+ if self._paused.is_set():
90
+ return False
91
+ self._paused.set()
92
+ return True
93
+
94
+ def resume(self) -> bool:
95
+ if not self._paused.is_set():
96
+ return False
97
+ self._paused.clear()
98
+ return True
99
+
100
+ @property
101
+ def paused(self) -> bool:
102
+ return self._paused.is_set()
103
+
104
+ def set_poll_interval(self, seconds: int) -> int:
105
+ seconds = max(MIN_POLL_INTERVAL_SEC, min(MAX_POLL_INTERVAL_SEC, seconds))
106
+ self.poll_interval = seconds
107
+ return seconds
108
+
109
+ def set_muted(self, muted: bool) -> bool:
110
+ """Returns False if the runtime is not ready yet."""
111
+ if self.runtime is None:
112
+ return False
113
+ self.runtime.notifier.muted = muted
114
+ return True
115
+
116
+ @property
117
+ def muted(self) -> bool:
118
+ return bool(self.runtime and self.runtime.notifier.muted)
119
+
120
+ # -- alert subscriptions ----------------------------------------------
121
+
122
+ def subscribe(self, chat_id: int | str) -> bool:
123
+ with self._subscribers_lock:
124
+ before = len(self._subscribers)
125
+ self._subscribers.add(str(chat_id))
126
+ return len(self._subscribers) > before
127
+
128
+ def unsubscribe(self, chat_id: int | str) -> bool:
129
+ with self._subscribers_lock:
130
+ try:
131
+ self._subscribers.remove(str(chat_id))
132
+ return True
133
+ except KeyError:
134
+ return False
135
+
136
+ def subscribers(self) -> List[str]:
137
+ with self._subscribers_lock:
138
+ return list(self._subscribers)
139
+
140
+ # -- state snapshots ---------------------------------------------------
141
+
142
+ def status(self) -> Dict:
143
+ if self.startup_error:
144
+ state = "failed"
145
+ elif self.runtime is None:
146
+ state = "starting"
147
+ elif self.paused:
148
+ state = "paused"
149
+ else:
150
+ state = "running"
151
+
152
+ info: Dict = {
153
+ "state": state,
154
+ "startup_error": self.startup_error,
155
+ "uptime_sec": int(time.time() - self.started_at),
156
+ "poll_interval_sec": self.poll_interval,
157
+ "muted": self.muted,
158
+ "subscribers": len(self.subscribers()),
159
+ }
160
+ if self.runtime is not None:
161
+ info.update(
162
+ {
163
+ "cycle": self.runtime.cycle,
164
+ "regime": self.runtime.risk.regime,
165
+ "universe": {venue: len(tickers) for venue, tickers in self.runtime.universe.items()},
166
+ "last_cycle_duration_sec": (
167
+ round(self.last_cycle_duration, 1) if self.last_cycle_duration else None
168
+ ),
169
+ }
170
+ )
171
+ return info
172
+
173
+ def regime_info(self) -> Optional[Dict]:
174
+ if self.runtime is None:
175
+ return None
176
+ regime = self.runtime.risk.regime
177
+ envelope = self.runtime.envelope_store.get()
178
+ policy = RISK_ENVELOPE_POLICY.get(regime, {})
179
+ return {"regime": regime, "envelope": envelope, "policy": policy}
180
+
181
+ def universe(self) -> Optional[Dict[str, List[str]]]:
182
+ if self.runtime is None:
183
+ return None
184
+ return self.runtime.universe
185
+
186
+ def telemetry(self) -> Optional[Dict[str, int]]:
187
+ if self.runtime is None:
188
+ return None
189
+ return self.runtime.telemetry.snapshot()
190
+
191
+ def events(self, limit: int = 10) -> List[Dict]:
192
+ return list(self.recent_risk_events)[-limit:]
193
+
194
+ def regime_changes(self, limit: int = 5) -> List[Dict]:
195
+ return list(self.recent_regime_changes)[-limit:]
src/telegram_bot/server.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FastAPI app hosting the Telegram webhook on HuggingFace Spaces.
2
+
3
+ Startup sequence:
4
+ 1. The platform polling loop starts in a background thread (PlatformController).
5
+ 2. The async Telegram client connects (through the Google Apps Script proxy
6
+ when GOOGLE_APPS_SCRIPT_URL is set — required on HF Spaces).
7
+ 3. Telegram pushes updates to POST /webhook/{WEBHOOK_SECRET}; register the URL
8
+ once via POST /set_webhook after deploying.
9
+ """
10
+
11
+ import asyncio
12
+ import logging
13
+ from contextlib import asynccontextmanager
14
+
15
+ import uvicorn
16
+ from fastapi import FastAPI, HTTPException, Request
17
+
18
+ from .bot_service import TelegramBotService
19
+ from .config import BotConfig
20
+ from .controller import PlatformController
21
+ from .telegram_client import TelegramClient
22
+ from .tg_models import TelegramUpdate
23
+
24
+
25
+ logger = logging.getLogger(__name__)
26
+
27
+ controller = PlatformController()
28
+ client = TelegramClient()
29
+ bot_service = TelegramBotService(controller, client)
30
+
31
+
32
+ @asynccontextmanager
33
+ async def lifespan(app: FastAPI):
34
+ logging.basicConfig(
35
+ level=logging.INFO,
36
+ format="%(asctime)s %(levelname)s %(name)s %(message)s",
37
+ )
38
+ BotConfig.validate()
39
+ controller.start()
40
+ await client.initialize()
41
+ logger.info("telegram bot server started")
42
+ yield
43
+ controller.stop()
44
+ await client.aclose()
45
+ logger.info("telegram bot server stopped")
46
+
47
+
48
+ app = FastAPI(
49
+ title="Market Analyzing Platform Bot",
50
+ description="Telegram control interface for the market-wide risk radar",
51
+ version="0.1.0",
52
+ lifespan=lifespan,
53
+ )
54
+
55
+
56
+ @app.get("/")
57
+ async def root():
58
+ """Health endpoint HuggingFace Spaces pings to keep the Space alive."""
59
+ return {
60
+ "status": "running",
61
+ "platform": controller.status(),
62
+ "bot_configured": bool(BotConfig.BOT_TOKEN),
63
+ "proxy_configured": bool(BotConfig.PROXY_URL),
64
+ }
65
+
66
+
67
+ @app.get("/health")
68
+ async def health():
69
+ return {"status": "healthy", "platform_state": controller.status()["state"]}
70
+
71
+
72
+ @app.post(f"/webhook/{BotConfig.WEBHOOK_SECRET}")
73
+ async def webhook(request: Request):
74
+ try:
75
+ json_data = await request.json()
76
+ update = TelegramUpdate(**json_data)
77
+ except Exception as exc:
78
+ logger.error("invalid webhook payload: %s", exc)
79
+ raise HTTPException(status_code=400, detail="Invalid update format")
80
+
81
+ # Ack Telegram immediately; process in the background so slow handlers
82
+ # don't trigger webhook retries
83
+ asyncio.create_task(bot_service.process_update(update))
84
+ return {"ok": True}
85
+
86
+
87
+ @app.post("/set_webhook")
88
+ async def set_webhook(url: str = ""):
89
+ """Register the webhook with Telegram (via the proxy when configured).
90
+
91
+ Uses https://{SPACE_HOST}/webhook/{WEBHOOK_SECRET} unless `url` is given.
92
+ """
93
+ target = url or BotConfig.webhook_url()
94
+ if not target:
95
+ raise HTTPException(
96
+ status_code=400,
97
+ detail="No url given and SPACE_HOST is not set; pass ?url=https://.../webhook/<secret>",
98
+ )
99
+ result = await client.call("setWebhook", url=target)
100
+ return {"webhook_url": target, "telegram_response": result}
101
+
102
+
103
+ @app.get("/webhook_info")
104
+ async def webhook_info():
105
+ result = await client.call("getWebhookInfo")
106
+ return {"expected_url": BotConfig.webhook_url() or "<set SPACE_HOST>", "telegram_response": result}
107
+
108
+
109
+ def main() -> None:
110
+ uvicorn.run(app, host="0.0.0.0", port=BotConfig.PORT, log_level="info")
111
+
112
+
113
+ if __name__ == "__main__":
114
+ main()
src/telegram_bot/telegram_client.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Async Telegram API client.
2
+
3
+ Routes every call through the Google Apps Script proxy when configured
4
+ (HuggingFace Spaces blocks direct api.telegram.org traffic), otherwise calls
5
+ the Telegram Bot API directly.
6
+ """
7
+
8
+ import asyncio
9
+ import logging
10
+ from typing import Any
11
+
12
+ import httpx
13
+
14
+ from .config import BotConfig
15
+
16
+
17
+ logger = logging.getLogger(__name__)
18
+
19
+ # Telegram hard limit is 4096; leave headroom for HTML tags
20
+ MAX_MESSAGE_LENGTH = 4000
21
+
22
+
23
+ class TelegramClient:
24
+ def __init__(self, config: type[BotConfig] = BotConfig) -> None:
25
+ self._config = config
26
+ self._http: httpx.AsyncClient | None = None
27
+
28
+ async def initialize(self) -> None:
29
+ self._http = httpx.AsyncClient(
30
+ timeout=httpx.Timeout(30.0),
31
+ limits=httpx.Limits(max_keepalive_connections=5, max_connections=10),
32
+ follow_redirects=True,
33
+ )
34
+
35
+ async def aclose(self) -> None:
36
+ if self._http:
37
+ await self._http.aclose()
38
+ self._http = None
39
+
40
+ async def call(self, method: str, **params: Any) -> dict[str, Any]:
41
+ """Invoke any Bot API method (sendMessage, setWebhook, ...)."""
42
+ if self._http is None:
43
+ raise RuntimeError("TelegramClient not initialized")
44
+ if not self._config.BOT_TOKEN:
45
+ logger.warning("BOT_TOKEN missing, dropping %s call", method)
46
+ return {"ok": False, "error": "BOT_TOKEN not configured"}
47
+
48
+ try:
49
+ if self._config.PROXY_URL:
50
+ payload = {"method": method, "bot_token": self._config.BOT_TOKEN, **params}
51
+ resp = await self._http.post(
52
+ self._config.PROXY_URL,
53
+ json=payload,
54
+ headers={"Content-Type": "application/json"},
55
+ )
56
+ else:
57
+ url = f"https://api.telegram.org/bot{self._config.BOT_TOKEN}/{method}"
58
+ resp = await self._http.post(url, json=params)
59
+ result = resp.json()
60
+ if not result.get("ok", False):
61
+ logger.warning("telegram %s failed: %s", method, result)
62
+ return result
63
+ except Exception as exc:
64
+ logger.error("telegram %s error: %s", method, exc)
65
+ return {"ok": False, "error": str(exc)}
66
+
67
+ async def send_message(
68
+ self, chat_id: int | str, text: str, parse_mode: str = "HTML"
69
+ ) -> dict[str, Any]:
70
+ if len(text) > MAX_MESSAGE_LENGTH:
71
+ text = text[: MAX_MESSAGE_LENGTH - 3] + "..."
72
+ return await self.call("sendMessage", chat_id=chat_id, text=text, parse_mode=parse_mode)
73
+
74
+ async def send_long_message(self, chat_id: int | str, text: str) -> None:
75
+ """Split on paragraph boundaries and send sequentially."""
76
+ if len(text) <= MAX_MESSAGE_LENGTH:
77
+ await self.send_message(chat_id, text)
78
+ return
79
+
80
+ chunk = ""
81
+ for part in text.split("\n\n"):
82
+ if not part.strip():
83
+ continue
84
+ part += "\n\n"
85
+ if len(chunk) + len(part) > MAX_MESSAGE_LENGTH:
86
+ if chunk:
87
+ await self.send_message(chat_id, chunk)
88
+ await asyncio.sleep(0.5) # keep ordering, avoid rate limits
89
+ chunk = part
90
+ else:
91
+ chunk += part
92
+ if chunk:
93
+ await self.send_message(chat_id, chunk)
src/telegram_bot/tg_models.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class TelegramUpdate(BaseModel):
7
+ update_id: int
8
+ message: dict[str, Any] | None = None
9
+ edited_message: dict[str, Any] | None = None
10
+ callback_query: dict[str, Any] | None = None
uv.lock CHANGED
@@ -11,6 +11,38 @@ resolution-markers = [
11
  "python_full_version < '3.11'",
12
  ]
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  [[package]]
15
  name = "beautifulsoup4"
16
  version = "4.15.0"
@@ -129,6 +161,18 @@ wheels = [
129
  { url = "https://files.pythonhosted.org/packages/98/2b/f97f1c193fb855c345d678f5077d6926034db0722df74c8f057020e05a25/charset_normalizer-3.4.9-py3-none-any.whl", hash = "sha256:68e5f26a1ad57ded6d1cfb85331d1c1a195314756471d97758c48498bb4dcdf5", size = 64538, upload-time = "2026-07-07T14:34:56.993Z" },
130
  ]
131
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  [[package]]
133
  name = "colorama"
134
  version = "0.4.6"
@@ -175,6 +219,59 @@ wheels = [
175
  { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
176
  ]
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  [[package]]
179
  name = "idna"
180
  version = "3.18"
@@ -274,14 +371,18 @@ name = "market-analyzing-platform"
274
  version = "0.1.0"
275
  source = { editable = "." }
276
  dependencies = [
 
 
277
  { name = "lxml" },
278
  { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
279
  { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" },
280
  { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
281
  { name = "pandas", version = "2.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
282
  { name = "pandas", version = "3.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
 
283
  { name = "pyyaml" },
284
  { name = "requests" },
 
285
  { name = "yfinance" },
286
  ]
287
 
@@ -292,11 +393,15 @@ dev = [
292
 
293
  [package.metadata]
294
  requires-dist = [
 
 
295
  { name = "lxml" },
296
  { name = "numpy" },
297
  { name = "pandas" },
 
298
  { name = "pyyaml" },
299
  { name = "requests" },
 
300
  { name = "yfinance" },
301
  ]
302
 
@@ -568,6 +673,92 @@ wheels = [
568
  { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" },
569
  ]
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  [[package]]
572
  name = "pygments"
573
  version = "2.20.0"
@@ -698,6 +889,19 @@ wheels = [
698
  { url = "https://files.pythonhosted.org/packages/5e/f5/0c41cb68dcae6b7de4fac4188a3a9589e21fb31df21ea3a2e888db95e6c9/soupsieve-2.8.4-py3-none-any.whl", hash = "sha256:e7e6b0769c8f51ed59acab6e994b00621096cfb1c640a7509295987388fbaf65", size = 37304, upload-time = "2026-05-24T13:55:55.406Z" },
699
  ]
700
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
  [[package]]
702
  name = "tomli"
703
  version = "2.4.1"
@@ -734,6 +938,18 @@ wheels = [
734
  { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
735
  ]
736
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  [[package]]
738
  name = "tzdata"
739
  version = "2026.3"
@@ -752,6 +968,20 @@ wheels = [
752
  { url = "https://files.pythonhosted.org/packages/7f/3e/5db95bcf282c52709639744ca2a8b149baccf648e39c8cc87553df9eae0c/urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897", size = 131087, upload-time = "2026-05-07T16:13:17.151Z" },
753
  ]
754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  [[package]]
756
  name = "websockets"
757
  version = "16.1"
 
11
  "python_full_version < '3.11'",
12
  ]
13
 
14
+ [[package]]
15
+ name = "annotated-doc"
16
+ version = "0.0.4"
17
+ source = { registry = "https://pypi.org/simple" }
18
+ sdist = { url = "https://files.pythonhosted.org/packages/57/ba/046ceea27344560984e26a590f90bc7f4a75b06701f653222458922b558c/annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4", size = 7288, upload-time = "2025-11-10T22:07:42.062Z" }
19
+ wheels = [
20
+ { url = "https://files.pythonhosted.org/packages/1e/d3/26bf1008eb3d2daa8ef4cacc7f3bfdc11818d111f7e2d0201bc6e3b49d45/annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320", size = 5303, upload-time = "2025-11-10T22:07:40.673Z" },
21
+ ]
22
+
23
+ [[package]]
24
+ name = "annotated-types"
25
+ version = "0.7.0"
26
+ source = { registry = "https://pypi.org/simple" }
27
+ sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" }
28
+ wheels = [
29
+ { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
30
+ ]
31
+
32
+ [[package]]
33
+ name = "anyio"
34
+ version = "4.14.2"
35
+ source = { registry = "https://pypi.org/simple" }
36
+ dependencies = [
37
+ { name = "exceptiongroup", marker = "python_full_version < '3.11'" },
38
+ { name = "idna" },
39
+ { name = "typing-extensions" },
40
+ ]
41
+ sdist = { url = "https://files.pythonhosted.org/packages/61/cc/a381afa6efea9f496eff839d4a6a1aed3bfafc7b3ab4b0d1b243a12573dd/anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f", size = 260176, upload-time = "2026-07-12T20:29:07.082Z" }
42
+ wheels = [
43
+ { url = "https://files.pythonhosted.org/packages/da/35/f2287558c17e29fafc8ef3daf819bb9834061cfa43bff8014f7df7f63bdc/anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494", size = 125813, upload-time = "2026-07-12T20:29:05.763Z" },
44
+ ]
45
+
46
  [[package]]
47
  name = "beautifulsoup4"
48
  version = "4.15.0"
 
161
  { url = "https://files.pythonhosted.org/packages/98/2b/f97f1c193fb855c345d678f5077d6926034db0722df74c8f057020e05a25/charset_normalizer-3.4.9-py3-none-any.whl", hash = "sha256:68e5f26a1ad57ded6d1cfb85331d1c1a195314756471d97758c48498bb4dcdf5", size = 64538, upload-time = "2026-07-07T14:34:56.993Z" },
162
  ]
163
 
164
+ [[package]]
165
+ name = "click"
166
+ version = "8.4.2"
167
+ source = { registry = "https://pypi.org/simple" }
168
+ dependencies = [
169
+ { name = "colorama", marker = "sys_platform == 'win32'" },
170
+ ]
171
+ sdist = { url = "https://files.pythonhosted.org/packages/76/d4/81420972a676e8ffea40450d8c8c92943e7218a78fe9b64359836cc9876b/click-8.4.2.tar.gz", hash = "sha256:9a6cea6e60b17ebe0a44c5cc636d94f09bd66142c1cd7d8b4cd731c4917a15f6", size = 338000, upload-time = "2026-06-24T17:45:15.148Z" }
172
+ wheels = [
173
+ { url = "https://files.pythonhosted.org/packages/fb/e2/79c688af8b210d232694e31e59da9f6ec747bae31c3f5946e4e9b98860d5/click-8.4.2-py3-none-any.whl", hash = "sha256:e6f9f66136c816745b9d65817da91d61d957fb16e02e4dcd0552553c5a197b76", size = 119243, upload-time = "2026-06-24T17:45:13.73Z" },
174
+ ]
175
+
176
  [[package]]
177
  name = "colorama"
178
  version = "0.4.6"
 
219
  { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
220
  ]
221
 
222
+ [[package]]
223
+ name = "fastapi"
224
+ version = "0.139.2"
225
+ source = { registry = "https://pypi.org/simple" }
226
+ dependencies = [
227
+ { name = "annotated-doc" },
228
+ { name = "pydantic" },
229
+ { name = "starlette" },
230
+ { name = "typing-extensions" },
231
+ { name = "typing-inspection" },
232
+ ]
233
+ sdist = { url = "https://files.pythonhosted.org/packages/cd/95/d3f0ae10836324a2eab98a52b61210ac609f08200bf4bb0dc8132d32f78a/fastapi-0.139.2.tar.gz", hash = "sha256:333145a6891e9b5b3cfceb69baf817e8240cde4d4588ae5a10bf56ffacb6255e", size = 423428, upload-time = "2026-07-16T15:06:17.912Z" }
234
+ wheels = [
235
+ { url = "https://files.pythonhosted.org/packages/5f/c7/cb03251d9dfb177246a9809a76f189d21df32dbd4a845951881d11323b7f/fastapi-0.139.2-py3-none-any.whl", hash = "sha256:b9ad015a835173d59865e2f5d8296fbc2b317bf56a2ba1a5bfbdd03de2fd4b1c", size = 130234, upload-time = "2026-07-16T15:06:19.557Z" },
236
+ ]
237
+
238
+ [[package]]
239
+ name = "h11"
240
+ version = "0.16.0"
241
+ source = { registry = "https://pypi.org/simple" }
242
+ sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
243
+ wheels = [
244
+ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
245
+ ]
246
+
247
+ [[package]]
248
+ name = "httpcore"
249
+ version = "1.0.9"
250
+ source = { registry = "https://pypi.org/simple" }
251
+ dependencies = [
252
+ { name = "certifi" },
253
+ { name = "h11" },
254
+ ]
255
+ sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
256
+ wheels = [
257
+ { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
258
+ ]
259
+
260
+ [[package]]
261
+ name = "httpx"
262
+ version = "0.28.1"
263
+ source = { registry = "https://pypi.org/simple" }
264
+ dependencies = [
265
+ { name = "anyio" },
266
+ { name = "certifi" },
267
+ { name = "httpcore" },
268
+ { name = "idna" },
269
+ ]
270
+ sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
271
+ wheels = [
272
+ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
273
+ ]
274
+
275
  [[package]]
276
  name = "idna"
277
  version = "3.18"
 
371
  version = "0.1.0"
372
  source = { editable = "." }
373
  dependencies = [
374
+ { name = "fastapi" },
375
+ { name = "httpx" },
376
  { name = "lxml" },
377
  { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
378
  { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" },
379
  { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
380
  { name = "pandas", version = "2.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
381
  { name = "pandas", version = "3.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
382
+ { name = "pydantic" },
383
  { name = "pyyaml" },
384
  { name = "requests" },
385
+ { name = "uvicorn" },
386
  { name = "yfinance" },
387
  ]
388
 
 
393
 
394
  [package.metadata]
395
  requires-dist = [
396
+ { name = "fastapi" },
397
+ { name = "httpx" },
398
  { name = "lxml" },
399
  { name = "numpy" },
400
  { name = "pandas" },
401
+ { name = "pydantic" },
402
  { name = "pyyaml" },
403
  { name = "requests" },
404
+ { name = "uvicorn" },
405
  { name = "yfinance" },
406
  ]
407
 
 
673
  { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" },
674
  ]
675
 
676
+ [[package]]
677
+ name = "pydantic"
678
+ version = "2.13.4"
679
+ source = { registry = "https://pypi.org/simple" }
680
+ dependencies = [
681
+ { name = "annotated-types" },
682
+ { name = "pydantic-core" },
683
+ { name = "typing-extensions" },
684
+ { name = "typing-inspection" },
685
+ ]
686
+ sdist = { url = "https://files.pythonhosted.org/packages/18/a5/b60d21ac674192f8ab0ba4e9fd860690f9b4a6e51ca5df118733b487d8d6/pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6", size = 844775, upload-time = "2026-05-06T13:43:05.343Z" }
687
+ wheels = [
688
+ { url = "https://files.pythonhosted.org/packages/fd/7b/122376b1fd3c62c1ed9dc80c931ace4844b3c55407b6fb2d199377c9736f/pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba", size = 472262, upload-time = "2026-05-06T13:43:02.641Z" },
689
+ ]
690
+
691
+ [[package]]
692
+ name = "pydantic-core"
693
+ version = "2.46.4"
694
+ source = { registry = "https://pypi.org/simple" }
695
+ dependencies = [
696
+ { name = "typing-extensions" },
697
+ ]
698
+ sdist = { url = "https://files.pythonhosted.org/packages/9d/56/921726b776ace8d8f5db44c4ef961006580d91dc52b803c489fafd1aa249/pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1", size = 471464, upload-time = "2026-05-06T13:37:06.98Z" }
699
+ wheels = [
700
+ { url = "https://files.pythonhosted.org/packages/e7/08/f1ba952f1c8ae5581c70fa9c6da89f247b83e3dd8c09c035d5d7931fc23d/pydantic_core-2.46.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a396dcc17e5a0b164dbe026896245a4fa9ff402edca1dff0be3d53a517f74de4", size = 2113146, upload-time = "2026-05-06T13:37:36.537Z" },
701
+ { url = "https://files.pythonhosted.org/packages/56/c6/65f646c7ff09bd257f660434adb45c4dfcbbcebcc030562fecf6f5bf887d/pydantic_core-2.46.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:da4b951fe36dc7c3a1ccb4e3cd1747c3542b8c9ceede8fc86cae054e764485f5", size = 1949769, upload-time = "2026-05-06T13:37:46.365Z" },
702
+ { url = "https://files.pythonhosted.org/packages/64/ba/bfb1d928fd5b49e1258935ff104ae356e9fd89384a55bf9f847e9193ad40/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb63e0198ca18aad131c089b9204c23079c3afa95487e561f4c522d519e55aba", size = 1974958, upload-time = "2026-05-06T13:37:28.611Z" },
703
+ { url = "https://files.pythonhosted.org/packages/4e/74/76223bfb117b64af743c9b6670d1364516f5c0604f96b48f3272f6af6cc6/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f47286a97f0bc9b8859519809077b91b2cefe4ae47fcbf5e466a009c1c5d742b", size = 2042118, upload-time = "2026-05-06T13:36:55.216Z" },
704
+ { url = "https://files.pythonhosted.org/packages/cb/7b/848732968bc8f48f3187542f08358b9d842db564147b256669426ebb1652/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:905a0ed8ea6f2d61c1738835f99b699348d7857379083e5fc497fa0c967a407c", size = 2222876, upload-time = "2026-05-06T13:38:25.455Z" },
705
+ { url = "https://files.pythonhosted.org/packages/b5/2f/e90b63ee2e14bd8d3db8f705a6d75d64e6ee1b7c2c8833747ce706e1e0ce/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea793e075b70290d89d8142074262885d3f7da19634845135751bd6344f73b50", size = 2286703, upload-time = "2026-05-06T13:37:53.304Z" },
706
+ { url = "https://files.pythonhosted.org/packages/ba/1e/acc4d70f88a0a277e4a1fa77ebb985ceabaf900430f875bf9338e11c9420/pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:395aebd9183f9d112f569aeb5b2214d1a10a33bec8456447f7fbdfa51d38d4cd", size = 2092042, upload-time = "2026-05-06T13:38:46.981Z" },
707
+ { url = "https://files.pythonhosted.org/packages/a9/da/0a422b57bf8504102bf3c4ccea9c41bab5a5cee6a54650acf8faf67f5a24/pydantic_core-2.46.4-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:b078afbc25f3a1436c7a1d2cd3e322497ee99615ba97c563566fdf46aff1ee01", size = 2117231, upload-time = "2026-05-06T13:39:23.146Z" },
708
+ { url = "https://files.pythonhosted.org/packages/bd/2a/2ac13c3af305843e23c5078c53d135656b3f05a2fd78cb7bbbb12e97b473/pydantic_core-2.46.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f747929cf940cddb5b3668a390056ddd5ba2e5010615ea2dcf4f9c4f3ab8791d", size = 2168388, upload-time = "2026-05-06T13:40:08.06Z" },
709
+ { url = "https://files.pythonhosted.org/packages/72/04/2beacf7e1607e93eefe4aed1b4709f079b905fb77530179d4f7c71745f22/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:daa27d92c36f24388fe3ad306b174781c747627f134452e4f128ea00ce1fe8c4", size = 2184769, upload-time = "2026-05-06T13:38:13.901Z" },
710
+ { url = "https://files.pythonhosted.org/packages/9e/29/d2b9fd9f539133548eaf622c06a4ce176cb46ac59f32d0359c4abc0de047/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:19e51f073cd3df251856a8a4189fbdf1de4012c3ebacfb1884f94f1eb406079f", size = 2319312, upload-time = "2026-05-06T13:39:08.24Z" },
711
+ { url = "https://files.pythonhosted.org/packages/7c/af/0f7a5b85fec6075bea96e3ef9187de38fccced0de92c1e7feda8d5cc7bb9/pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c1747f85cee84c26985853c6f3d9bd3e75da5212912443fa111c113b9c246f39", size = 2361817, upload-time = "2026-05-06T13:38:43.2Z" },
712
+ { url = "https://files.pythonhosted.org/packages/25/a4/73363fec545fd3ec025490bdda2743c56d0dd5b6266b1a53bbe9e4265375/pydantic_core-2.46.4-cp310-cp310-win32.whl", hash = "sha256:2f84c03c8607173d16b5a854ec68a2f9079ae03237a54fb506d13af47e1d018d", size = 1987085, upload-time = "2026-05-06T13:39:25.497Z" },
713
+ { url = "https://files.pythonhosted.org/packages/01/aa/62f082da2c91fac1c234bc9ee0066257ce83f0604abd72e4c9d5991f2d84/pydantic_core-2.46.4-cp310-cp310-win_amd64.whl", hash = "sha256:8358a950c8909158e3df31538a7e4edc2d7265a7c54b47f0864d9e5bae9dcebf", size = 2074311, upload-time = "2026-05-06T13:39:59.922Z" },
714
+ { url = "https://files.pythonhosted.org/packages/5c/fa/6d7708d2cfc1a832acb6aeb0cd16e801902df8a0f583bb3b4b527fde022e/pydantic_core-2.46.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:0e96592440881c74a213e5ad528e2b24d3d4f940de2766bed9010ab1d9e51594", size = 2111872, upload-time = "2026-05-06T13:40:27.596Z" },
715
+ { url = "https://files.pythonhosted.org/packages/ae/6f/aa064a3e74b5745afbdf250594f38e7ead05e2d651bcb35994b9417a0d4d/pydantic_core-2.46.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0d65b8c354be7fb5f720c3caa8bc940bc2d20ce749c8e06135f07f8ed95dd7c", size = 1948255, upload-time = "2026-05-06T13:39:12.574Z" },
716
+ { url = "https://files.pythonhosted.org/packages/43/3a/41114a9f7569b84b4d84e7a018c57c56347dac30c0d4a872946ec4e36c46/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bfb192b3f4b9e8a89b6277b6ce787564f62cfd272055f6e685726b111dc7826", size = 1972827, upload-time = "2026-05-06T13:38:19.841Z" },
717
+ { url = "https://files.pythonhosted.org/packages/ef/25/1ab42e8048fe551934d9884e8d64daa7e990ad386f310a15981aeb6a5b08/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9037063db01f09b09e237c282b6792bd4da634b5402c4e7f0c61effed7701a04", size = 2041051, upload-time = "2026-05-06T13:38:10.447Z" },
718
+ { url = "https://files.pythonhosted.org/packages/94/c2/1a934597ddf08da410385b3b7aae91956a5a76c635effef456074fad7e88/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fc010ab034c8c7452522748bf937df58020d256ccae0874463d1f4d01758af8e", size = 2221314, upload-time = "2026-05-06T13:40:13.089Z" },
719
+ { url = "https://files.pythonhosted.org/packages/02/6d/9e8ad178c9c4df27ad3c8f25d1fe2a7ab0d2ba0559fad4aee5d3d1f16771/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c5dac79fa1614d1e06ca695109c6105923bd9c7d1d6c918d4e637b7e6b32fd3", size = 2285146, upload-time = "2026-05-06T13:38:59.224Z" },
720
+ { url = "https://files.pythonhosted.org/packages/80/50/540cd3aeefc041beb111125c4bff779831a2111fc6b15a9138cda277d32c/pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9fa868638bf362d3d138ea55829cefb3d5f4b0d7f142234382a15e2485dbec4", size = 2089685, upload-time = "2026-05-06T13:38:17.762Z" },
721
+ { url = "https://files.pythonhosted.org/packages/6b/a4/b440ad35f05f6a38f89fa0f149accb3f0e02be94ca5e15f3c449a61b4bc9/pydantic_core-2.46.4-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:17299feefe090f2caa5b8e37222bb5f663e4935a8bfa6931d4102e5df1a9f398", size = 2115420, upload-time = "2026-05-06T13:37:58.195Z" },
722
+ { url = "https://files.pythonhosted.org/packages/99/61/de4f55db8dfd57bfdfa9a12ec90fe1b57c4f41062f7ca86f08586b3e0ac0/pydantic_core-2.46.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4c63ebc82684aa89d9a3bcbd13d515b3be44250dc68dd3bd81526c1cb31286c3", size = 2165122, upload-time = "2026-05-06T13:37:01.167Z" },
723
+ { url = "https://files.pythonhosted.org/packages/f7/52/7c529d7bdb2d1068bd52f51fe32572c8301f9a4febf1948f10639f1436f5/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:aaa2a54443eff1950ba5ddc6b6ccda0d9c84a364276a62f969bdf2a390650848", size = 2182573, upload-time = "2026-05-06T13:38:45.04Z" },
724
+ { url = "https://files.pythonhosted.org/packages/37/b3/7c40325848ba78247f2812dcf9c7274e38cd801820ca6dd9fe63bcfb0eb4/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:18e5ceec2ab67e6d5f1a9085e5a24c9c4e2ac4545730bfe668680bca05e555f3", size = 2317139, upload-time = "2026-05-06T13:37:15.539Z" },
725
+ { url = "https://files.pythonhosted.org/packages/d9/37/f913f81a657c865b75da6c0dbed79876073c2a43b5bd9edbe8da785e4d49/pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a0f62d0a58f4e7da165457e995725421e0064f2255d8eccebc49f41bbc23b109", size = 2360433, upload-time = "2026-05-06T13:37:30.099Z" },
726
+ { url = "https://files.pythonhosted.org/packages/c4/67/6acaa1be2567f9256b056d8477158cac7240813956ce86e49deae8e173b4/pydantic_core-2.46.4-cp311-cp311-win32.whl", hash = "sha256:041bde0a48fd37cf71cab1c9d56d3e8625a3793fef1f7dd232b3ff37e978ecda", size = 1985513, upload-time = "2026-05-06T13:38:15.669Z" },
727
+ { url = "https://files.pythonhosted.org/packages/aa/e6/c505f83dfeda9a2e5c995cfd872949e4d05e12f7feb3dca72f633daefa94/pydantic_core-2.46.4-cp311-cp311-win_amd64.whl", hash = "sha256:6f2eeda33a839975441c86a4119e1383c50b47faf0cbb5176985565c6bb02c33", size = 2071114, upload-time = "2026-05-06T13:40:35.416Z" },
728
+ { url = "https://files.pythonhosted.org/packages/0f/da/7a263a96d965d9d0df5e8de8a475f33495451117035b09acb110288c381f/pydantic_core-2.46.4-cp311-cp311-win_arm64.whl", hash = "sha256:14f4c5d6db102bd796a627bbb3a17b4cf4574b9ae861d8b7c9a9661c6dd3362d", size = 2044298, upload-time = "2026-05-06T13:38:29.754Z" },
729
+ { url = "https://files.pythonhosted.org/packages/ce/8c/af022f0af448d7747c5154288d46b5f2bc5f17366eaa0e23e9aa04d59f3b/pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2", size = 2106158, upload-time = "2026-05-06T13:38:57.215Z" },
730
+ { url = "https://files.pythonhosted.org/packages/19/95/6195171e385007300f0f5574592e467c568becce2d937a0b6804f218bc49/pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f", size = 1951724, upload-time = "2026-05-06T13:37:02.697Z" },
731
+ { url = "https://files.pythonhosted.org/packages/8e/bc/f47d1ff9cbb1620e1b5b697eef06010035735f07820180e74178226b27b3/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7", size = 1975742, upload-time = "2026-05-06T13:37:09.448Z" },
732
+ { url = "https://files.pythonhosted.org/packages/5b/11/9b9a5b0306345664a2da6410877af6e8082481b5884b3ddd78d47c6013ce/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7", size = 2052418, upload-time = "2026-05-06T13:37:38.234Z" },
733
+ { url = "https://files.pythonhosted.org/packages/f1/b7/a65fec226f5d78fc39f4a13c4cc0c768c22b113438f60c14adc9d2865038/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712", size = 2232274, upload-time = "2026-05-06T13:38:27.753Z" },
734
+ { url = "https://files.pythonhosted.org/packages/68/f0/92039db98b907ef49269a8271f67db9cb78ae2fc68062ef7e4e77adb5f61/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4", size = 2309940, upload-time = "2026-05-06T13:38:05.353Z" },
735
+ { url = "https://files.pythonhosted.org/packages/5f/97/2aab507d3d00ca626e8e57c1eac6a79e4e5fbcc63eb99733ff55d1717f65/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce", size = 2094516, upload-time = "2026-05-06T13:39:10.577Z" },
736
+ { url = "https://files.pythonhosted.org/packages/22/37/a8aca44d40d737dde2bc05b3c6c07dff0de07ce6f82e9f3167aeaf4d5dea/pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987", size = 2136854, upload-time = "2026-05-06T13:40:22.59Z" },
737
+ { url = "https://files.pythonhosted.org/packages/24/99/fcef1b79238c06a8cbec70819ac722ba76e02bc8ada9b0fd66eba40da01b/pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b", size = 2180306, upload-time = "2026-05-06T13:40:10.666Z" },
738
+ { url = "https://files.pythonhosted.org/packages/ae/6c/fc44000918855b42779d007ae63b0532794739027b2f417321cddbc44f6a/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458", size = 2190044, upload-time = "2026-05-06T13:40:43.231Z" },
739
+ { url = "https://files.pythonhosted.org/packages/6b/65/d9cadc9f1920d7a127ad2edba16c1db7916e59719285cd6c94600b0080ba/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b", size = 2329133, upload-time = "2026-05-06T13:39:57.365Z" },
740
+ { url = "https://files.pythonhosted.org/packages/d0/cf/c873d91679f3a30bcf5e7ac280ce5573483e72295307685120d0d5ad3416/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c", size = 2374464, upload-time = "2026-05-06T13:38:06.976Z" },
741
+ { url = "https://files.pythonhosted.org/packages/47/bd/6f2fc8188f31bf10590f1e98e7b306336161fac930a8c514cd7bd828c7dc/pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894", size = 1974823, upload-time = "2026-05-06T13:40:47.985Z" },
742
+ { url = "https://files.pythonhosted.org/packages/40/8c/985c1d41ea1107c2534abd9870e4ed5c8e7669b5c308297835c001e7a1c4/pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89", size = 2072919, upload-time = "2026-05-06T13:39:21.153Z" },
743
+ { url = "https://files.pythonhosted.org/packages/c4/ba/f463d006e0c47373ca7ec5e1a261c59dc01ef4d62b2657af925fb0deee3a/pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a", size = 2027604, upload-time = "2026-05-06T13:39:03.753Z" },
744
+ { url = "https://files.pythonhosted.org/packages/ee/a4/73995fd4ebbb46ba0ee51e6fa049b8f02c40daebb762208feda8a6b7894d/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:14d4edf427bdcf950a8a02d7cb44a08614388dd6e1bdcbf4f67504fa7887da9c", size = 2111589, upload-time = "2026-05-06T13:37:10.817Z" },
745
+ { url = "https://files.pythonhosted.org/packages/fb/7f/f37d3a5e8bfcc2e403f5c57a730f2d815693fb42119e8ea48b3789335af1/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:0ce40cd7b21210e99342afafbd4d0f76d784eb5b1d60f3bdc566be4983c6c73b", size = 1944552, upload-time = "2026-05-06T13:36:56.717Z" },
746
+ { url = "https://files.pythonhosted.org/packages/15/3c/d7eb777b3ff43e8433a4efb39a17aa8fd98a4ee8561a24a67ef5db07b2d6/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:90884113d8b48f760e9587002789ddd741e76ab9f89518cd1e43b1f1a52ec44b", size = 1982984, upload-time = "2026-05-06T13:39:06.207Z" },
747
+ { url = "https://files.pythonhosted.org/packages/63/87/70b9f40170a81afd55ca26c9b2acb25c20d64bcfbf888fafecb3ba077d4c/pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66ce7632c22d837c95301830e111ad0128a32b8207533b60896a96c4915192ea", size = 2138417, upload-time = "2026-05-06T13:39:45.476Z" },
748
+ { url = "https://files.pythonhosted.org/packages/9d/1d/8987ad40f65ae1432753072f214fb5c74fe47ffbd0698bb9cbbb585664f8/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7", size = 2095527, upload-time = "2026-05-06T13:39:52.283Z" },
749
+ { url = "https://files.pythonhosted.org/packages/64/d3/84c282a7eee1d3ac4c0377546ef5a1ea436ce26840d9ac3b7ed54a377507/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df", size = 1936024, upload-time = "2026-05-06T13:40:15.671Z" },
750
+ { url = "https://files.pythonhosted.org/packages/d7/ca/eac61596cdeb4d7e174d3dc0bd8a6238f14f75f97a24e7b7db4c7e7340a0/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526", size = 1990696, upload-time = "2026-05-06T13:38:34.717Z" },
751
+ { url = "https://files.pythonhosted.org/packages/fa/c3/7c8b240552251faf6b3a957db200fcfbbcec36763c050428b601e0c9b83b/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0", size = 2147590, upload-time = "2026-05-06T13:39:29.883Z" },
752
+ { url = "https://files.pythonhosted.org/packages/11/cb/428de0385b6c8d44b716feba566abfacfbd23ee3c4439faa789a1456242f/pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:0c563b08bca408dc7f65f700633d8442fffb2421fc47b8101377e9fd65051ff0", size = 2112782, upload-time = "2026-05-06T13:37:04.016Z" },
753
+ { url = "https://files.pythonhosted.org/packages/0b/b5/6a17bdadd0fc1f170adfd05a20d37c832f52b117b4d9131da1f41bb097ce/pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:db06ffe51636ffe9ca531fe9023dd64bdd794be8754cb5df57c5498ae5b518a7", size = 1952146, upload-time = "2026-05-06T13:39:43.092Z" },
754
+ { url = "https://files.pythonhosted.org/packages/2a/dc/03734d80e362cd43ef65428e9de77c730ce7f2f11c60d2b1e1b39f0fbf99/pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:133878133d271ade3d41d1bfb2a45ec38dbdbda40bc065921c6b04e4630127e2", size = 2134492, upload-time = "2026-05-06T13:36:58.124Z" },
755
+ { url = "https://files.pythonhosted.org/packages/de/df/5e5ffc085ed07cc22d298134d3d911c63e91f6a0eb91fe646750a3209910/pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9bc519fbf2b7578398853d815009ae5e4d4603d12f4e3f91da8c06852d3da3e9", size = 2156604, upload-time = "2026-05-06T13:37:49.88Z" },
756
+ { url = "https://files.pythonhosted.org/packages/81/44/6e112a4253e56f5705467cbab7ab5e91ee7398ba3d56d358635958893d3e/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c7a7bd4e39e8e4c12c39cd480356842b6a8a06e41b23a55a5e3e191718838ddf", size = 2183828, upload-time = "2026-05-06T13:37:43.053Z" },
757
+ { url = "https://files.pythonhosted.org/packages/ac/ad/5565071e937d8e752842ac241463944c9eb14c87e2d269f2658a5bd05e98/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:d396ec2b979760aaf3218e76c24e65bd0aca24983298653b3a9d7a45f9e47b30", size = 2310000, upload-time = "2026-05-06T13:37:56.694Z" },
758
+ { url = "https://files.pythonhosted.org/packages/4f/c3/66883a5cec183e7fba4d024b4cbbe61851a63750ef606b0afecc46d1f2bf/pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:86e1a4418c6cd97d60c95c71164158eaf7324fae7b0923264016baa993eba6fc", size = 2361286, upload-time = "2026-05-06T13:40:05.667Z" },
759
+ { url = "https://files.pythonhosted.org/packages/4b/2d/69abac8f838090bbecd5df894befb2c2619e7996a98ddb949db9f3b93225/pydantic_core-2.46.4-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:d51026d73fcfd93610abc7b27789c26b313920fcfb20e27462d74a7f8b06e983", size = 2193071, upload-time = "2026-05-06T13:38:08.682Z" },
760
+ ]
761
+
762
  [[package]]
763
  name = "pygments"
764
  version = "2.20.0"
 
889
  { url = "https://files.pythonhosted.org/packages/5e/f5/0c41cb68dcae6b7de4fac4188a3a9589e21fb31df21ea3a2e888db95e6c9/soupsieve-2.8.4-py3-none-any.whl", hash = "sha256:e7e6b0769c8f51ed59acab6e994b00621096cfb1c640a7509295987388fbaf65", size = 37304, upload-time = "2026-05-24T13:55:55.406Z" },
890
  ]
891
 
892
+ [[package]]
893
+ name = "starlette"
894
+ version = "1.3.1"
895
+ source = { registry = "https://pypi.org/simple" }
896
+ dependencies = [
897
+ { name = "anyio" },
898
+ { name = "typing-extensions" },
899
+ ]
900
+ sdist = { url = "https://files.pythonhosted.org/packages/eb/e3/7c1dc7381d9f8ab7d854328ebfa884e62cb3f3d8549ddfd37c7814f42afa/starlette-1.3.1.tar.gz", hash = "sha256:05d0213193f2fbaae60e2ecb593b4add4262ad4e46536b54abe36f11a71724e0", size = 2703240, upload-time = "2026-06-12T09:23:11.602Z" }
901
+ wheels = [
902
+ { url = "https://files.pythonhosted.org/packages/ec/bb/2799cc2ede3ed41131f8975621e7213dfc7ef4acbbaadfa440f32500c370/starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6", size = 73632, upload-time = "2026-06-12T09:23:10.017Z" },
903
+ ]
904
+
905
  [[package]]
906
  name = "tomli"
907
  version = "2.4.1"
 
938
  { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
939
  ]
940
 
941
+ [[package]]
942
+ name = "typing-inspection"
943
+ version = "0.4.2"
944
+ source = { registry = "https://pypi.org/simple" }
945
+ dependencies = [
946
+ { name = "typing-extensions" },
947
+ ]
948
+ sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" }
949
+ wheels = [
950
+ { url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" },
951
+ ]
952
+
953
  [[package]]
954
  name = "tzdata"
955
  version = "2026.3"
 
968
  { url = "https://files.pythonhosted.org/packages/7f/3e/5db95bcf282c52709639744ca2a8b149baccf648e39c8cc87553df9eae0c/urllib3-2.7.0-py3-none-any.whl", hash = "sha256:9fb4c81ebbb1ce9531cce37674bbc6f1360472bc18ca9a553ede278ef7276897", size = 131087, upload-time = "2026-05-07T16:13:17.151Z" },
969
  ]
970
 
971
+ [[package]]
972
+ name = "uvicorn"
973
+ version = "0.51.0"
974
+ source = { registry = "https://pypi.org/simple" }
975
+ dependencies = [
976
+ { name = "click" },
977
+ { name = "h11" },
978
+ { name = "typing-extensions", marker = "python_full_version < '3.11'" },
979
+ ]
980
+ sdist = { url = "https://files.pythonhosted.org/packages/a2/65/b7c6c443ccc58678c91e1e973bbe2a878591538655d6e1d47f24ba1c51f3/uvicorn-0.51.0.tar.gz", hash = "sha256:f6f4b69b657c312f516dd2d268ab9ae6f254b11e4bac504f37b2ab58b24dd0b0", size = 94412, upload-time = "2026-07-08T10:59:05.962Z" }
981
+ wheels = [
982
+ { url = "https://files.pythonhosted.org/packages/45/ec/dbb7e5a6b91f86bfb9eb7d2988a2730907b6a729875b949c7f022e8b88fa/uvicorn-0.51.0-py3-none-any.whl", hash = "sha256:5d38af6cd620f2ae3849fb44fd4879e0890aa1febe8d47eb355fb45d93fe6a5b", size = 73219, upload-time = "2026-07-08T10:59:04.44Z" },
983
+ ]
984
+
985
  [[package]]
986
  name = "websockets"
987
  version = "16.1"