Files
dashboards/pyproject.toml
T
ducoterra c4bb374ccc Add homelab dashboards: system, LLM, and UPS on one domain
Three dashboards served by one FastAPI app with a SQLite history store
(raw / 1m / 1h) and hand-written SVG charts: no Prometheus, no Grafana,
no CDN, no build step. Nothing is fetched from the internet at runtime.

* system: a stdlib-only agent (agent/host_agent.py) reports /proc and
  /sys counters; the dashboard turns them into rates over a labelled
  window, so every number says how it was measured.
* llm: gufo/llama.cpp and vLLM /metrics are parsed by an in-house
  exposition parser. Measured delta/elapsed throughput beats a native
  per-request gauge, and each value carries its provenance.
* ups: a NUT wire-protocol client plus health checks that name what
  they looked at. Commands are gated by NUT_ALLOW_ACTIONS,
  DASH_READ_ONLY and a DANGER confirmation, re-checked server-side.

Missing values render as n/a rather than 0, and an unconfigured source
answers 404 {"configured": false} without dialling anything, so "not
deployed here" never looks like an outage.

253 tests at 94% coverage against captured real fixtures; ruff and
pyright clean.

LLM-Generated: true
2026-10-16 17:20:45 -04:00

72 lines
1.9 KiB
TOML

[project]
name = "dashboards"
version = "0.1.0"
description = "Homelab dashboards on one domain: system resources, LLM engines, and UPS battery health"
readme = "README.md"
requires-python = ">=3.13"
# Deliberately small. Everything we collect is either our own agent's JSON (stdlib only,
# see agent/host_agent.py) or an upstream Prometheus exposition parsed by our own parser
# (src/dashboards/prom.py). No prometheus_client, no Grafana, no CDN, no bundler.
dependencies = [
"fastapi>=0.143.3",
"httpx>=0.28.1",
"uvicorn[standard]>=0.54.0",
"pydantic>=2.14.1",
"python-dotenv>=1.2.4",
]
[dependency-groups]
dev = [
"pytest>=9.1.1",
"pytest-cov>=7.1.0",
"pytest-asyncio>=1.4.0",
"ruff>=0.17.1",
"pyright>=1.1.414",
"debugpy>=1.8.22",
]
# Installed editable by `uv sync` (src layout), so `uv run dashboards` and
# `uv run uvicorn dashboards.app:app` both work without PYTHONPATH gymnastics.
[build-system]
requires = ["hatchling>=1.27"]
build-backend = "hatchling.build"
[project.scripts]
dashboards = "dashboards.__main__:main"
[tool.hatch.build.targets.wheel]
packages = ["src/dashboards"]
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --strict-markers"
# auto: async tests run without a decorator on every single one
asyncio_mode = "auto"
filterwarnings = ["error::DeprecationWarning"]
[tool.coverage.run]
source = ["src/dashboards"]
omit = ["tests/*"]
[tool.coverage.report]
show_missing = true
skip_covered = false
[tool.ruff]
line-length = 110
target-version = "py313"
src = ["src", "tests", "agent"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM", "RUF", "BLE", "PLC"]
ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
# FastAPI's dependency injection is a call in a default argument; that is the API, not a bug.
"src/dashboards/api.py" = ["B008"]
[tool.pyright]
include = ["src", "tests"]
pythonVersion = "3.13"
typeCheckingMode = "standard"