TUI application to display Peru (ONPE) election results
Project description
resultadosonpe
A terminal user interface (TUI) application that displays live election results from Peru's ONPE (Oficina Nacional de Procesos Electorales).
Built with Textual and plotext for rich, interactive charts right in your terminal.
Features
- Live election results for Presidential, Senators, and Andean Parliament races
- Horizontal bar charts showing candidate/party vote percentages
- Progress header with tallied records count and percentage
- Auto-refresh every 60 seconds with manual refresh button (
rkey) - Internationalization support (English and Spanish)
- Connects directly to the official ONPE results API
Installation
Via uvx (recommended)
uvx resultadosonpe
Via uv
uv tool install resultadosonpe
resultadosonpe
From source
git clone https://github.com/jpchauvel/resultadosonpe.git
cd resultadosonpe
uv sync
uv run resultadosonpe
Usage
Launch the application:
resultadosonpe
Keyboard shortcuts
| Key | Action |
|---|---|
r |
Refresh |
q |
Quit |
Language
The UI language follows your system locale. To force Spanish:
LANGUAGE=es resultadosonpe
To force English:
LANGUAGE=en resultadosonpe
Development
Prerequisites
- Python 3.14+
- uv
Setup
git clone https://github.com/jpchauvel/resultadosonpe.git
cd resultadosonpe
uv sync --group dev
uv run pre-commit install
uv run pre-commit install --hook-type pre-push
Running tests
uv run pytest
Linting and type checking
uv run ruff check src/ tests/ features/
uv run ruff format --check src/ tests/ features/
uv run mypy src/resultadosonpe/
uv run bandit -r src/resultadosonpe/ -s B101
Architecture
src/resultadosonpe/
__main__.py Entry point, locale setup
app.py Textual app with auto-refresh and chart layout
api_client.py HTTP client for the ONPE results API
models.py Data models (ElectoralProcess, Election, etc.)
transforms.py Data transformation for chart display
widgets.py Custom Textual widgets (ElectionChart, ProgressHeader)
i18n.py Gettext-based internationalization
locales/ Translation files (.po/.mo)
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file resultadosonpe-0.4.0.tar.gz.
File metadata
- Download URL: resultadosonpe-0.4.0.tar.gz
- Upload date:
- Size: 51.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
968f49d61355bdf740979d2c29ec18d995528e088c196248f9376a14b526d88e
|
|
| MD5 |
ad25013404544aedca819d9a1b7522c5
|
|
| BLAKE2b-256 |
a79cf77d010a26a92d04be3b32971a1f4dc1d32039ff853faf6c8c66eb943614
|
File details
Details for the file resultadosonpe-0.4.0-py3-none-any.whl.
File metadata
- Download URL: resultadosonpe-0.4.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b23798a379c4e276f462f2116957454bce316f35f6d46cf4251f0121c5c5e3d
|
|
| MD5 |
83870bc0d7aa6a2738d10383dfd5167c
|
|
| BLAKE2b-256 |
b4f4a80b7cebe27fbb0c461fb38f74c70e502c983a43e6bf24f29fd1600ae853
|