central/pyproject.toml

51 lines
1.3 KiB
TOML
Raw Permalink Normal View History

2026-05-15 19:16:24 +00:00
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "central"
version = "0.3.0"
2026-05-15 19:16:24 +00:00
requires-python = ">=3.12,<3.13"
description = "Data hub spine — adapters, bus, archive."
readme = "README.md"
license = {text = "MIT"}
authors = [{name = "Matt Johnson"}]
dependencies = [
"aiohttp>=3.13.5",
feat(tomtom_flow): TomTom Orbis vector flow-tile telemetry adapter + CENTRAL_TRAFFIC_FLOW (v0.9.3) Third CENTRAL_TRAFFIC-family member, first telemetry traffic source. Polls a configured tile coverage set (Idaho metros, z=10), fetches Orbis vector flow tiles, decodes per-segment relative_speed + road geometry, emits one telemetry Event per road segment per poll to the new CENTRAL_TRAFFIC_FLOW stream. Renders as colored polylines (green free-flow -> red jam) on the /telemetry map. Production code; supervisor + gui + ARCHIVE restart (NEW event-bearing stream central.traffic_flow.> -> archive must resubscribe). Ships disabled; needs a "tomtom" api key in config.api_keys before enable. - Subject central.traffic_flow.{z}.{x}.{y} (token traffic_flow, non-overlapping with central.traffic.>). category="flow.tomtom_flow" -> GUI event_type "flow". - Severity from relative_speed: >=0.75=1, 0.5-0.75=2, 0.25-0.5=3, <0.25=4. - Cadence 300s; 7-day retention (high-volume telemetry). Dedup minute-bucketed, inherited from the v0.9.1 SourceAdapter mixin. - Shared tomtom_flow_parse module (decode + slippy-tile georeference) reused by the v0.9.4 on-demand passthrough endpoint. - Generic framework change (Option A, ~3 lines, inert for the other 14 adapters): Geo.geometry optional field + archive _build_geom_sql prefers it, so segments persist their real LineString to the PostGIS geom column. - Idaho-only (Orbis tier confirmed live). Cameras + Navi passthrough are follow-ups. - deps: mapbox-vector-tile (vector PBF decode); itsdangerous promoted to an explicit dependency (gui/csrf.py + gui/wizard.py imported it as an undeclared transitive that uv re-lock would otherwise prune). Full suite: 780 passed, 1 skipped (central and unprivileged zvx, 3x each). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 23:25:44 +00:00
"mapbox-vector-tile>=2.0",
"itsdangerous>=2.2", # used by gui/csrf.py + gui/wizard.py (was an undeclared transitive)
"argon2-cffi>=25.1.0",
"asyncpg>=0.31.0",
"cloudevents>=2.0.0",
"cryptography>=44.0.0",
"fastapi>=0.115.0",
"jinja2>=3.1.6",
"nats-py>=2.14.0",
v0.10.0: ITD 511 official API adapter (events + advisories + cameras) (#85) First official-state-DOT-API pattern landing. Two adapters in one PR: - itd_511 (event-class): polls Events (60s) + Advisories (300s) from https://511.idaho.gov/api/v2/get/{event,alerts}. Decodes EncodedPolyline to LineString via the polyline lib (bookend LineString or Point fallback); ITD Severity string mapped None->1 / Minor->2 / Major->3 with IsFullClosure=true forcing 3 regardless; RecurrenceSchedules / Restrictions / DetourPolyline pass through unmodified. Advisories ship as structural pass-through under data.advisory since the upstream /alerts endpoint currently returns []; per-record try/except keeps a surprise shape from sinking the cycle when ITD posts its first one. - itd_511_cameras (telemetry-class): polls Cameras (600s). One event per camera per UTC day; image URL passes straight through to <img src>. Region uniform US-ID with data.source_jurisdiction preserving the raw upstream Source field for the ~1.2% cross-DOT border-region mirrors (UDOT / ODOT / WYDOT / WSDOT / NDot / MTD / DriveBC / Lemhi County). Subject convention (v0.9.20 forward): central.traffic.<event_type>.us.id and central.traffic_cameras.us.id.<camera_id>. Castle Rock state_511_atis keeps its bare-state subject; consumers stay on central.traffic.> wildcards during the A/B comparison window. Retry predicate tightened from the Castle Rock / TomTom precedent: 5xx + connection / timeout retry; 4xx other than 429 skip-with-warn (don't burn quota on permanent errors); 429 honors Retry-After once then retries. API key (alias 'idaho_511') travels in the ?key= query string, so every error log path runs through self._redact() to scrub the URL. Both adapters ship disabled; operator enables via GUI after registering the API key with 'python -m set_api_key idaho_511'. Reuses existing CENTRAL_TRAFFIC and CENTRAL_TRAFFIC_CAMERAS streams -- no archive restart needed. Scope-cap exception: this PR is ~1.5k lines vs. the standard 500-line cap, authorized as a one-time exception for the first official-state-DOT-API pattern landing. Two adapters + their tests + real-API fixtures naturally exceed the v0.9.x adapter-cap budget. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 22:36:26 -06:00
"polyline>=2.0,<3", # itd_511: Google polyline decode (EncodedPolyline → LineString)
"pydantic>=2,<3",
"pydantic-settings>=2.7.0",
"python-multipart>=0.0.20",
"shapely>=2.0",
"tenacity>=9.1.4",
"uvicorn[standard]>=0.34.0",
"sgp4>=2.25",
]
2026-05-15 19:16:24 +00:00
[project.scripts]
central-supervisor = "central.supervisor:main"
central-archive = "central.archive:main"
central-migrate = "central.migrate:main"
central-cli = "central.cli:main"
central-gui = "central.gui:main"
2026-05-15 19:16:24 +00:00
[tool.hatch.build.targets.wheel]
packages = ["src/central"]
[dependency-groups]
dev = [
"httpx>=0.28.0",
"mypy>=2.1.0",
"pytest>=9.0.3",
"pytest-asyncio>=1.3.0",
"ruff>=0.15.13",
]