Skip to main content

whirligig

PyPI Python versions License: MIT CI

whirligig spinning a wheel of lunch options and landing on Burgers

Recorded from the real thing: whirligig Pizza Sushi Tacos Thai "Chicken Wings" Poke Burgers.

Let the wheel decide. whirligig spins a colorful ASCII wheel of fortune in your terminal and lands on one of your choices: what's for lunch, who reviews the PR, heads or tails. It's a CLI and a one-function Python library.

  • A proper spin: the arm sweeps the wheel, slows down, and holds on the winner.
  • Scripting-safe: the animation plays on your terminal, but stdout is only the chosen label, so LUNCH=$(whirligig ...) just works.
  • Weight the odds by repeating a label; read labels from a file or a pipe; or spin a ready-made wheel (coin, dice, clock, alphabet).
  • Zero dependencies. Python 3.10+ on Linux, macOS and Windows 10+.

Try it

No install needed if you have uv or pipx:

uvx whirligig Pizza Sushi Tacos Thai "Chicken Wings" Poke Burgers

Install

pip install whirligig    # or: uv tool install whirligig

Requires Python 3.10 or newer, on Linux, macOS or Windows 10+.

CLI

Pass the choices as arguments, quoting any that contain spaces:

whirligig Pizza Sushi Tacos Thai "Chicken Wings" Poke Burgers

Labels can repeat, and each copy is its own slot on the wheel, so whirligig Pizza Pizza Sushi lands on Pizza twice as often. Copies of a label share one color, so they read as one choice spread across the wheel.

flag default meaning
-r, --radius 10 radius of the wheel, in characters (2–100)
-d, --delay 0.1 seconds each frame is held; lower spins faster
-f, --file — read labels from a file, one per line
-p, --preset — coin, dice, clock, alphabet or random
whirligig -d 0.3 Yes No Maybe               # milk the suspense
whirligig -r 6 -d 0.02 heads tails          # just flip the coin already
whirligig -p dice                           # a ready-made wheel
whirligig -p random                         # surprise me
whirligig -f lunch.txt                      # one label per line; blank lines are skipped
grep -v alice teammates.txt | whirligig     # piped input works too (alice is on vacation)
ls ~/Desktop | whirligig                    # a random file from your Desktop

Scripting

The wheel is drawn on your terminal, but stdout is just the choice, so you can watch the spin and capture the answer at the same time:

LUNCH=$(whirligig Pizza Sushi Tacos Thai "Chicken Wings" Poke Burgers)
echo "ordering $LUNCH"

The captured value is the bare label: no color codes, no animation frames. With no terminal at all (in CI, or under whirligig ... &> file) the animation is skipped and only the choice is printed.

Python

whirligig.spin draws the same wheel and returns the label it lands on:

import whirligig

result = whirligig.spin(["Pizza", "Sushi", "Tacos", "Thai", "Chicken Wings", "Poke", "Burgers"])

It takes the CLI's knobs as keyword arguments: radius (default 10) and delay (default 0.1). The call blocks while the wheel animates; pass delay=0 to skip straight to the result:

result = whirligig.spin(["heads", "tails"], radius=6, delay=0)

Bad input raises ValueError: blank or multi-line labels, more labels than the radius can hold (the error suggests one that fits), or a terminal too small for the wheel. Full details live in help(whirligig.spin).

Known quirk: wide characters (emoji, CJK) occupy two terminal columns where the wheel's geometry counts one, so a 🍕 label can bend the circle slightly. The spin works fine; the wheel just loses a little roundness.

Contributing

Issues and pull requests are welcome. The project is managed with uv:

uv sync                                  # create .venv from uv.lock
uv run pytest                            # the test suite
uv run whirligig -r 6 -d 0 heads tails   # the fastest way to eyeball a render change

CI runs the suite on Python 3.10 to 3.14 across Linux, macOS and Windows. CLAUDE.md explains how the code fits together, and CHANGELOG.md what changed in each release.

License

MIT, see LICENSE.

Metadata

Release files for whirligig 1.0.0

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

Source distribution (sdist)

Source distribution for whirligig 1.0.0
File Size Uploaded Provenance Actions
whirligig-1.0.0.tar.gz 10.4 kB With provenance Details for whirligig-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for whirligig 1.0.0
File Interpreter ABI Platform Actions
whirligig-1.0.0-py3-none-any.whl Python 3 none any Details for whirligig-1.0.0-py3-none-any.whl

Total release size: 22.5 kB

Release files / whirligig-1.0.0.tar.gz

Download URL whirligig-1.0.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
985c6e68a2f993cc21f50eedfb1de6d713f40fa6ed1cc22768dc83180a13b233
BLAKE2b-256 checksum
How to use checksums
01de2eff414e1d611991f578be2112bfa08e246655eabb2b40072375a8aab1c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 5, 2026.

Transparency log

Release files / whirligig-1.0.0-py3-none-any.whl

Download URL whirligig-1.0.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38d2203ca3a6fa448119055ab4849a59b484c42aec19e1c8ef4e1a73832279d4
BLAKE2b-256 checksum
How to use checksums
3606e5af0408edcdf0431a495c3ee303e796166c9cc7a95b5b348cdf3bbf2bce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 5, 2026.

Transparency log

Security for whirligig 1.0.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for whirligig-1.0.0.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 Nov 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