Skip to main content

yahtzee-li (yaht-CLI)

PyPI version Python 3.12+ License: MIT Actions status

A professional-grade, colorful CLI Yahtzee game for 1–4 players, built in Python with rich.

Features

  • Full Yahtzee rule set: upper-section bonus (35 pts at ≥63), Yahtzee bonus (+100 per extra Yahtzee), and the official joker rule
  • Vivid terminal UI: ASCII-art dice panels, live multi-player scorecards, and a victory screen
  • 1–4 human players per game
  • "Play again" prompt after each game — keep the same players or start fresh

Requirements

  • Python 3.12+
  • uv (recommended) or any virtual-environment manager

Installation

From PyPI

pip install yahtzee-li

Or with uv:

uv tool install yahtzee-li

From source (development)

git clone https://github.com/carlmatt/yahtzee-li.git
cd yahtzee-li
uv sync

Running the game

# With uv / the project virtual environment
uv run yahtzee-li

# Or activate the venv first
source venv/bin/activate
yahtzee-li

Development

# Install dev dependencies
make install

# Run the game
make run

# Run the full test suite (unit + integration)
make test

# Run only one tier
make test-unit
make test-integration

# Run tests with coverage report
make test-cov

# Lint and format (combined)
make fix

# Lint only
make lint

# Format only
make format

# Type check (Astral's ty)
make typecheck

# Lint + typecheck + test
make check

# Remove cache and build artifacts
make clean

Tests

Tests are organised into two folders:

  • tests/unit/ — fast unit tests that mock collaborators and cover individual modules.
  • tests/integration/ — end-to-end tests that drive a real Game through full flows using a scripted Display double and a deterministic dice RNG. Tests in this folder are auto-marked with @pytest.mark.integration, so you can also run them via pytest -m integration.

Pre-commit hooks

This project uses pre-commit to enforce code quality on every commit. The hooks run ruff (lint) and ruff-format automatically.

# Install the git hooks (once, after cloning)
pre-commit install

# Run all hooks manually against every file
pre-commit run --all-files

How to Play

  1. Enter the number of players (1–4) and each player's name.
  2. On each turn, all five dice are rolled automatically.
  3. After each roll you may hold any dice by entering their numbers (e.g. 1,3,5), press Enter to hold none, or enter d to skip straight to scoring.
  4. After up to three rolls, choose a scoring category from the numbered list.
  5. The game runs for 13 rounds; the player with the highest grand total wins.
  6. Press Ctrl-C at any time to quit.

Scoring Reference

Category Score
Ones – Sixes Sum of matching dice
Three of a Kind Sum of all dice (if ≥3 match)
Four of a Kind Sum of all dice (if ≥4 match)
Full House 25 pts
Small Straight 30 pts
Large Straight 40 pts
Yahtzee 50 pts
Chance Sum of all dice
Upper Bonus +35 if upper subtotal ≥ 63
Yahtzee Bonus +100 per extra Yahtzee

Metadata

Release files for yahtzee-li 0.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yahtzee-li 0.6.3
File Size Uploaded Provenance
yahtzee_li-0.6.3.tar.gz 58.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yahtzee-li 0.6.3
File Interpreter ABI Platform
yahtzee_li-0.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 73.7 kB

Release files / yahtzee_li-0.6.3.tar.gz

Download URL yahtzee_li-0.6.3.tar.gz
Size 58.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f60e20f73003684c3a987a26bdb25d1e0fc968eaa2b942fe1e587d0d3f2770a9
BLAKE2b-256 checksum
How to use checksums
f47f3e250fe3f79351c967eb449052fdaf21a0d904c11660e2a48c61faf042d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

Release files / yahtzee_li-0.6.3-py3-none-any.whl

Download URL yahtzee_li-0.6.3-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d957a8988b30ee131f4099b90b218c18169b36d973b10c09305f7354ff1846c
BLAKE2b-256 checksum
How to use checksums
45735d7e2e4e6f1759a1319c92d1527f4585a2e288e4bf996fdb245ede7e0a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

Security for yahtzee-li 0.6.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yahtzee_li-0.6.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page