Skip to main content

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 (r key)
  • 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

MIT

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

resultadosonpe-0.3.0.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

resultadosonpe-0.3.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file resultadosonpe-0.3.0.tar.gz.

File metadata

  • Download URL: resultadosonpe-0.3.0.tar.gz
  • Upload date:
  • Size: 50.8 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

Hashes for resultadosonpe-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3c696aa34163e5bbd4d2fd04cd1874480d5ba7e41de7043a623ab03cd2844e18
MD5 ab1a7837c8b5bfda479f33884b894b5c
BLAKE2b-256 db3edfbe638f583784b3d8f7b9ff772f0d87614ff012cc9a54aa539dbabdaa21

See more details on using hashes here.

File details

Details for the file resultadosonpe-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: resultadosonpe-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 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

Hashes for resultadosonpe-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1422d088fb95823b96b61de204359df1db7469e0eadebff1583d3d2f51dfb9b8
MD5 fbdecf962e9150351575d9ebbf8ba9d3
BLAKE2b-256 87a9e790b119928060fa71b10d96c49870670919e1be88d0c6e753e83df2b1c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page