Skip to main content

Terminal higher-or-lower NBA game scaffold

Project description

Hoop Higher 🏀

Python 3.13+ Textual

A modern terminal-based game inspired by "Higher or Lower", utilizing real NBA player point totals. Built natively with Python and Textual to provide a sleek, fast, and responsive TUI experience.

Features ✨

  • Multiple Game Modes:
    • Endless: Keep playing and building your score multiplier. Wrong answers deduct points, but don't end the game!
    • Arcade: Strive for perfection. One wrong answer and your run is over.
    • Historical: Journey back in time! Play rounds using real NBA game data sampled from random historical dates across defined eras.
  • Live & Cached NBA Data: Seamlessly interfaces with the real NBA stats API, falling back on an intelligent SQLite-backed caching layer for speed and resilience.
  • Fast & Tactile UI: A beautiful TUI architecture built with Textual, featuring keyboard shortcuts, fluid layouts, and immediate visual feedback.
  • Local Leaderboards: Track your high scores, best streaks, and overall stats locally via SQLModel and SQLite.

Tech Stack 🛠️

  • Language: Python 3.13+
  • TUI Framework: Textual
  • Database: SQLite
  • ORM: SQLModel
  • HTTP Client: httpx and nba_api
  • Configuration: pydantic-settings
  • Package Manager: uv
  • Testing: pytest

Installation and Setup 🚀

  1. Clone the repository:

    git clone https://github.com/Davi-Gurgel/hoop-higher.git
    cd hoop-higher
    
  2. Set up the virtual environment using uv:

    uv venv
    source .venv/bin/activate
    
  3. Install dependencies:

    uv sync --all-groups
    
  4. Run the game:

    uv run hoophigher
    

Install from PyPI 📦

Once published, you can run Hoop Higher without cloning the repo.

  • Run with uvx (ephemeral):
    uvx hoop-higher
    
  • Install with pipx (persistent):
    pipx install hoop-higher
    hoop-higher
    

Configuration ⚙️

Customize the app's behavior by overriding these environment variables (all prefixed with HOOPHIGHER_):

  • HOOPHIGHER_STATS_PROVIDER
    • nba_api (default): Uses real NBA data with a SQLite caching layer.
    • mock: Uses pre-populated mock data for incredibly fast local development and testing.
  • HOOPHIGHER_HISTORICAL_START_YEAR (default: 2010)
  • HOOPHIGHER_HISTORICAL_END_YEAR (default: 2020)
  • HOOPHIGHER_HISTORICAL_ROUNDS (default: 5)
  • HOOPHIGHER_NBA_API_TIMEOUT_SECONDS (default: 20)

Note: Historical mode intelligently probes and samples available games on the fly, avoiding massive initial database syncs and ensuring a fast start.

Local Development & Testing 🧪

Code quality, formatting, and tests are heavily utilized in this repository.

  • Run all tests:
    uv run pytest
    
  • Linting & Formatting: (via ruff)
    uv run ruff check src tests
    

Publishing to PyPI 🛰️

This repository includes automated publishing via GitHub Actions in .github/workflows/publish.yml.

  1. Create your package on PyPI (first time only) and configure a Trusted Publisher pointing to this repository and workflow.
  2. Bump version in pyproject.toml.
  3. Create and push a version tag (must match v*):
    git tag v0.1.0
    git push origin v0.1.0
    

After the workflow succeeds, users can run uvx hoop-higher or pipx install hoop-higher.


For more architectural guidelines and decisions, view ARCHITECTURE.md and AGENTS.md.

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

hoop_higher-0.1.0.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

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

hoop_higher-0.1.0-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hoop_higher-0.1.0.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hoop_higher-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5e8d724170e785ddf80df4630efa03eac94decd9d092e325e3a6b25e350bbd3
MD5 837219b53c97943702ec48632de724d0
BLAKE2b-256 c81f48f74b210b1eaa460657a0b8db7299f04a75e85100cca4be5449bcada262

See more details on using hashes here.

Provenance

The following attestation bundles were made for hoop_higher-0.1.0.tar.gz:

Publisher: publish.yml on Davi-Gurgel/hoop-higher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: hoop_higher-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hoop_higher-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 520e98ba9e7451e107cddd74b78671fd5302be76352dc7ed9250379eb500adcb
MD5 4d6a538431eb11201a92b9f16e991f9d
BLAKE2b-256 eba4ad6daf8b719d16eca544e16f31cc89087258d89ee76b45523307909893c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hoop_higher-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Davi-Gurgel/hoop-higher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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