Skip to main content

Python port of WeatherSpect, an ASCII weather animation

Project description

py-weatherspect

py-weatherspect is a Python port of WeatherSpect, the ASCII weather animation originally written by Kirk Baucom.

WeatherSpect provides a reasonably accurate simulation of what the weather looks like outside, in ASCII art. It includes rain, snow, lightning, sleet, and hail. The windspeed and cloudiness are reflected in the velocity and quantity of clouds. There are trees that age, reproduce and die over the course of an hour, and a sun and moon that follow the actual sunrise and moonrise. There's also a dancing turtle.

     .---.             ___     *    .  *  .   *
    /  O  \          /\___\  *   .       .
   | o     |  .---.  \_____\         *        .
    \  o O/  /  * .\  _____ .  *        .
     '---'   | *  . |/  . * \     *  .      *
   ~~~~~~~~~~'-----'~~~~~~~~~~~~~~~~~~~~~~~~~~

Features

  • Live weather data via OpenWeatherMap or Open-Meteo
  • Rain, snow, sleet, hail, fog, thunder and lightning
  • Wind-speed-dependent cloud movement and density
  • Sun and moon following actual rise/set times with moon phases
  • Seasonal entities: 🎃 Ghost (Halloween), 🦃 Turkey (Thanksgiving), 🎅 Santa (Christmas)
  • 20+ animated critters: Mario, Pac-Man, rocket, helicopter, ducks, elephant, turtle, …
  • Day/night sky colour (cyan by day, dark blue by night)
  • Interactive override menu (o) to change weather, time-of-day, and moon phase live
  • Color terminal support via blessed

Installation

pip install py-weatherspect

Requires Python 3.10+ and a color-capable terminal (xterm-256color recommended).

Quick Start

1. Create a config file

py-weatherspect --create-config

You will be prompted for your location (city, ZIP code, "City, Country", etc.). The config is saved to ~/.weatherspect.

2. Run the animation

py-weatherspect

Press q or Esc to quit.

All options

py-weatherspect [OPTIONS]

  -f, --config-file TEXT   Path to config file (default: ~/.weatherspect)
  -c, --create-config      Create a new config file interactively, then exit
  --width INTEGER          Terminal width  [default: 80]
  --height INTEGER         Terminal height [default: 24]
  --no-color               Disable color output
  --frames INTEGER         Stop after N frames (useful for scripting/tests)
  --help                   Show this message and exit

Static renderer (no animation, single frame to stdout)

py-weatherspect-static-render [OPTIONS]

Runtime Keys

Key Action
q / Esc Quit
h Toggle help overlay
w Toggle weather info overlay
d Toggle debug overlay
u Force weather data update
r Redraw — remove all entities and recreate them
p Pause / unpause animation
o Toggle override menu (change weather, time, moon phase, spawn entities)

Override menu (o)

While the override menu is open:

Key Action
19 Switch to a weather scenario (clear, rain, snow, thunder, …)
0 Return to live weather data
+ / - Advance / rewind simulated time by 1 hour
z Reset time to real clock
M Cycle moon phase
az Spawn a random entity (shown in the menu)

Configuration

The config file (~/.weatherspect) is a simple key=value format:

location      = Berlin, Germany
retr_interval = 30          # weather update interval in minutes
tree_lifespan = 60          # minutes a tree lives before dying
frame_delay   = 0.08        # seconds between animation frames
display_units = metric      # metric or imperial
color         = 1           # 1 = color, 0 = monochrome
entities      = 5           # number of random entities on screen

Weather Providers

By default OpenWeatherMap is used. A free API key is not required for the current location-based lookup, but rate limits apply. Alternatively the Open-Meteo provider (no API key needed) is available; switching providers is a configuration option in future releases.

Development

git clone ...
cd py-weatherspect
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'

# Run tests
python -m unittest discover

# Run parity snapshots against the Perl baseline
poe parity-snapshots

# Build distribution
poe build

Credits

  • Kirk Baucom <kbaucom@schizoid.com> — original WeatherSpect and Term::Animation (Perl)
  • Kevin Ferree — ASCII art (marked kf in source)
  • Hayley Wakenshaw — ASCII art (marked hjw in source)
  • Joan Stark — ASCII art (marked jgs in source)
  • Ulrich Schwenk <ulrich.schwenk@gmail.com> — Python port

Full provenance and license notes: doc/credits.md

License

GNU General Public License v2 or later (GPL-2.0-or-later). See LICENSE for the full text.

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

py_weatherspect-0.0.2.tar.gz (183.0 kB view details)

Uploaded Source

Built Distribution

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

py_weatherspect-0.0.2-py3-none-any.whl (130.0 kB view details)

Uploaded Python 3

File details

Details for the file py_weatherspect-0.0.2.tar.gz.

File metadata

  • Download URL: py_weatherspect-0.0.2.tar.gz
  • Upload date:
  • Size: 183.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_weatherspect-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2f105dbaa34bfba757c67a76d5a06ab97062a5ff61e533fa8a8de2838531af01
MD5 72cd259d1feb36899bb7ccbfb39e34ba
BLAKE2b-256 f869ec3bee1a8275426d4035c6b85f3528f58584d10695fd2d8155483633c501

See more details on using hashes here.

File details

Details for the file py_weatherspect-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for py_weatherspect-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e616a4b66a98ad50fc63d100038f6c221e769d3247b4a3b09e9b271d4c8394a7
MD5 00809ce9628112e9e98c79f4b66ca070
BLAKE2b-256 1f52f4196d9b5d4f8328874e594b0bafd21b664854c39d03da9e12524116bbbc

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