6933406ae3
Skeleton of the host-side vision service per the packaging decision: a Python/FastAPI app at apps/vision/, uv-managed, wired into the Turbo graph via a thin package.json shim (dev/lint/test/build → uv/uvicorn/ruff/pytest). A per-package turbo.json sets build outputs [] so the no-op build is warning-free. Endpoints: GET /health (readiness + model version) and POST /analyze (raw octet-stream body, so Node POSTs Snapshot.bytes directly; empty→400, oversize→413, recognizer-not-ready→503). The recognizer is a Protocol with a StubRecognizer (no models, boots/tests offline — the dev/CI default) and a FastAlprRecognizer (the real MIT YOLOv9+CCT/ONNX stack, lazily imported; missing models ⇒ ready=False, not a crash) — the device-adapter pattern applied to the model. fast-alpr + onnxruntime are an optional `alpr` extra, so `uv sync` needs no model download. Verified: turbo run lint|test|build includes @parking/vision and stays green; uv run mypy strict-clean; uvicorn boots and serves /health + /analyze live; pnpm workspace 6→7. Not built yet: the Node VisionClient adapter, a Dockerfile + model fetch, and Job 2 (vehicle verification). Updates the packaging decision (As-scaffolded) + log. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
60 lines
1.9 KiB
TOML
60 lines
1.9 KiB
TOML
[project]
|
|
name = "parking-vision"
|
|
version = "0.0.0"
|
|
description = "Host-side ANPR / vehicle-verification microservice for the parking system (separate process; localhost HTTP)."
|
|
requires-python = ">=3.10,<4.0"
|
|
# Core deps are LIGHT on purpose: the service boots, serves /health, and answers
|
|
# /analyze in stub mode with ONLY these. The heavy recognizer stack (fast-alpr +
|
|
# onnxruntime + model weights) is the optional `alpr` extra, so `uv sync` and the test
|
|
# suite work offline without downloading models. See
|
|
# wiki/decisions/vision-service-packaging.md + wiki/entities/opencv-anpr-service.md.
|
|
dependencies = [
|
|
"fastapi>=0.115",
|
|
"uvicorn[standard]>=0.32",
|
|
"pydantic>=2.9",
|
|
"pydantic-settings>=2.6",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
# The real recognizer. Install with: uv sync --extra alpr
|
|
# fast-alpr is MIT (YOLOv9 detector + CCT OCR, both MIT) on ONNX Runtime — see the
|
|
# recognizer evaluation in wiki/entities/opencv-anpr-service.md. onnxruntime is the
|
|
# CPU backend; swap for onnxruntime-gpu / -openvino / -directml on capable hardware.
|
|
alpr = [
|
|
"fast-alpr>=0.4.0",
|
|
"onnxruntime>=1.19",
|
|
]
|
|
|
|
[dependency-groups]
|
|
# Dev tooling (uv installs these by default for local work; excluded from the runtime image).
|
|
dev = [
|
|
"ruff>=0.8",
|
|
"pytest>=8.3",
|
|
"httpx>=0.27", # FastAPI TestClient transport
|
|
"mypy>=1.13",
|
|
]
|
|
|
|
[tool.ruff]
|
|
line-length = 110
|
|
target-version = "py310"
|
|
|
|
[tool.ruff.lint]
|
|
# A pragmatic default set: pyflakes, pycodestyle, isort, bugbear, pyupgrade.
|
|
select = ["E", "F", "I", "B", "UP"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
|
|
[tool.mypy]
|
|
python_version = "3.10"
|
|
strict = true
|
|
# fast-alpr / onnxruntime ship without type stubs; don't fail typecheck on the optional stack.
|
|
ignore_missing_imports = true
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["vision_service"]
|