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.1.0.tar.gz (46.6 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.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: resultadosonpe-0.1.0.tar.gz
  • Upload date:
  • Size: 46.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 f7ea39ce0a29a53687574883c0a9f9aa6f583a410755558b7dd591e0c19f52dd
MD5 c86d94393fbce66b0cfcd89a88fceadc
BLAKE2b-256 13a1639a6be1cf746099b29e643252994849d771b7f675794b9d55ae8ace3c18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: resultadosonpe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f1b7e347ff511a9e0630f180518a147f8375733434b9ba343d607a963bbfd7
MD5 032fa5ad3c1286a19098fdc51d6b4ea3
BLAKE2b-256 9d6bbeccbc6b382956975da6976cef87c68a622f0f856e761b3ac03b71482319

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