$ show mpolden/jarvis2
JARVIS2 is a real-time dashboard framework designed for Raspberry Pi, built with Flask (Python) and Mithril (JavaScript). It features live-updating widgets via server-sent events (SSE) and a plugin-based job system for data fetching. The backend schedules periodic jobs (e.g., weather, public transport, email, RSS) that push data to connected browsers. The frontend renders widgets using Mithril components and updates them reactively as events arrive. The architecture is a monolith: a single Flask application with background scheduling via APScheduler. Key entry points are the Flask routes for dashboards, individual widgets, and the SSE event stream. External dependencies include various APIs (Yr, Entur, Avinor, Google APIs, Sonos, etc.) and libraries (Flask, APScheduler, requests, BeautifulSoup, soco). The codebase is well-structured, with clear separation between job implementations, static assets, and templates. It includes a comprehensive test suite and CI pipeline. The project is actively maintained, targeting Python 3.14 and using modern tooling (uv, ruff). However, it retains some deprecated dependencies (oauth2client) and Python 2 compatibility shims, indicating moderate technical drift.
The LLM identified 4 files worth highlighting for reuse:
Defines the AbstractJob base class and a load_jobs() function that dynamically discovers all job implementations via pkgutil. This pattern allows adding new job types without modifying the core framework. The class provides a clean interface (get() method) and automatic registration of subclasses. It is reusable as a plugin loader for any project needing extensible job/task types.
Implements a weather job for the Norwegian Meteorological Institute's Yr API. It parses the JSON forecast, extracts temperature, wind (speed, direction, Beaufort description), and weather symbols. Includes a comprehensive Norwegian symbol-to-description mapping table. The parsing logic handles multiple time periods and fallback hours. This module is self-contained and could be extracted as a standalone Yr API client library.
Client-side JavaScript that subscribes to the SSE endpoint, parses incoming events, and renders Mithril components for each widget. It handles widget lookup by job name, pre-renders on page load, and updates widgets reactively. The code is concise and demonstrates a robust pattern for real-time UI updates with minimal dependencies.
A CLI tool that generates boilerplate files for a new widget: a Python job file, a JavaScript component, and a CSS file. It uses Jinja2 templates to produce consistent, ready-to-use code. Includes dry-run and removal options. This pattern is reusable for any project that needs to scaffold new plugin modules with associated frontend assets.