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.2.0.tar.gz (50.2 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.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: resultadosonpe-0.2.0.tar.gz
  • Upload date:
  • Size: 50.2 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.2.0.tar.gz
Algorithm Hash digest
SHA256 3730d70f342cd03cecefb8dc05a1ab31e69c3bada8d6c51a369ae379a69553a2
MD5 3b4cd375d1b9ff05c1cd9682ec819732
BLAKE2b-256 017013edd96b7d4c6e01cc4692c27cfb9eeb6093641d450ea7be4d1d28de5831

See more details on using hashes here.

File details

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

File metadata

  • Download URL: resultadosonpe-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1df44be1b17b540a9b28511adbb3a19d9fcc930edc7fe2f3ca476f6e28d18e7c
MD5 30c1f7080af1b6c9e90dc2ad5b0aeb7b
BLAKE2b-256 68665242438833022b989cc461e9387dd38cf31b104c7e7037b1ebdf40cff369

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