Metadata-Version: 2.5
Name: wevva
Version: 1.1.0
Summary: Textual TUI for viewing weather via Open-Meteo
Author-email: Nick Ferguson <nick.ferguson@ed.ac.uk>
License: MIT License
        
        Copyright (c) 2026 Nick Ferguson
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: open-meteo,terminal,textual,tui,weather
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: httpx>=0.28.1
Requires-Dist: questionary>=2.1.1
Requires-Dist: textual>=3.1.0
Requires-Dist: typer>=0.21.1
Requires-Dist: wcwidth>=0.2.13
Requires-Dist: wevva-warnings==0.6.1
Description-Content-Type: text/markdown

# wevva

`wevva` is a weather TUI built with [Textual](https://textual.textualize.io/) and powered by [Open-Meteo](https://open-meteo.com/).

<p align="center">
  <img src="docs/assets/wevva-dashboard.png" alt="wevva Dashboard showing forecasts, global weather, tropical systems, and active alerts" width="900">
</p>

The Dashboard is the navigation hub for forecasts, saved locations, active
tropical systems, and weather alerts. See the [Wevva 1.1 release
notes](docs/releases/1.1.0.md) for the latest changes and the [1.0 release
notes](docs/releases/1.0.0.md) for the lifecycle milestone and its deliberate
post-1.0 deferrals.
Upcoming changes are tracked in the [Unreleased changelog](CHANGELOG.md#unreleased).

## Highlights

- Place-name search using Open-Meteo geocoding, plus latitude/longitude search
- Current, hourly, and daily forecasts with detailed weather parameters and keyboard navigation
- Current and upcoming weather alerts (normalized provider data)
- Global active tropical-system investigation with source-specific tracks and official products
- Interactive Braille world map for spatial navigation between saved locations
- Clickable temperature-labelled cities on country and regional weather maps
- Unit preferences (temperature, wind, precipitation)
- Theme toggle and optional emoji rendering
- Interactive setup wizard for defaults
- Reusable Python API (async + sync helpers)

> [!NOTE]
> - The Weather Forecast and Tropical Systems workspaces both have compact,
>   non-scrolling 80x24 modes. Larger terminals progressively restore complete
>   context regions, maps, centre weather, and richer information panes without
>   rebuilding the selected screen or losing its navigation state.

## Quick Start

First, install [uv](https://docs.astral.sh/uv/):

```bash
curl -Ls https://astral.sh/uv/install.sh | sh
```

Then, using `uvx`, run `wevva`:

```bash
uvx wevva
```

to launch the app without cloning the repo. This will install `wevva` as a package in a temporary environment and run it from there.

Alternatively, you can clone the repo and run from the local source:

```bash
uvx --from . wevva
```

Requires Python `>=3.12`.

## First-Time Setup

On a fresh installation, Wevva saves six starter locations: Yellowknife,
Hilo, Georgetown (Guyana), Accra, Baguio City, and Westport (New Zealand).
Their bundled place metadata lets the Dashboard open immediately; loading
weather still needs an internet connection. Existing configurations or Wevva
cache directories prevent automatic seeding, so your locations are preserved.

Run `setup` before your first normal launch to accept or decline these starter
locations. Declining or deleting them later keeps your list as you chose it.

> [!TIP]
> Run the setup wizard to save defaults:
>
> ```bash
> uvx wevva setup
> ```

Save settings without launching:

```bash
uvx wevva setup --no-launch
```

## Useful Commands

```bash
# Start normally (uses saved defaults)
uvx wevva

# Start directly at a location (picks first geocoding match, might not be what you expect!)
uvx wevva --location "Edinburgh"

# Coordinates are latitude first; quote negative longitudes
uvx wevva --location "55.9533, -3.1883"

# One-run overrides
uvx wevva --theme dracula --emoji
uvx wevva --temperature-unit fahrenheit --wind-speed-unit mph

# Manage saved default location
uvx wevva --set-default-location "New York"
uvx wevva --clear-default-location
```

When a startup location is available from saved defaults or saved locations,
wevva opens on the Dashboard; press `w` for the full Weather Forecast screen.
Without one it opens place search first.

> [!WARNING]
> - Emoji rendering support varies depending on terminal support and is disabled by default. Enable it with `--emoji` (or via `wevva setup`).
> - Colour support also varies. Try `export COLORTERM=truecolor` if colours display strangely.

## Weather Alerts

- Weather alerts use my [`wevva-warnings`](https://github.com/njf0/wevva-warnings) library.
  - Because we fetch all alerts for the searched location's country, then filter them by the forecast location coordinates, this may take a minute or two if there are many alerts in the country.
- A bordered alert summary upgrades to the classic tabbed preview when height permits. Activating either form opens a modal where those tabs directly select the full, independently scrolling provider document; wide layouts retain the automatic detail/map sidebar.
- During a background warning check, the header subtitle briefly reads `Checking warnings…` and then returns to `View the forecast for your selected location`; warning status does not create toast notifications.
- Where a provider includes an official alert URL, `wevva` shows it directly on the alert panel so you can jump out to the source document.
- We use the latitude and longitude coordinates of the forecast location in combination with the warning provider-issued polygon data. Some countries/providers don't issue polygon data, so we are unable to show alerts for those locations.
- Warning maps use Unicode Braille, with full Braille cells for filled interiors and partial cells along geographic edges.

Press `g` from the Dashboard to open the Global Weather Alerts Center. It keeps
country discovery separate from alerts applicable to the current forecast
point, and combines a searchable active-alert list, complete provider
documents, issued warning polygons, and locally selectable settlement labels.
Hovering or keyboard-highlighting a warning row previews its polygon at full
severity without selecting or zooming it. Activate a selected warning again to
return to the full-country overview.
Hovering a settlement shows compact current conditions; clicking it opens that
place's complete forecast on the Weather Forecast screen. Returning through the
Dashboard restores the previous Global Weather Alerts Center context. Use `r`
to refresh its independent alert data and `b` to return to the Dashboard.

<p align="center">
  <img src="docs/assets/global-weather-alerts.png" alt="Global Weather Alerts Center showing active warning areas across Australia" width="900">
</p>

## Tropical Systems Warnings Center

Press `t` from the Dashboard to open the Tropical Systems Warnings Center.
Canonical storm names are shown once, while each issuing centre's
meteorology, track, and lazily retrieved official products remain separate.
The main weather screen retains only nearby-storm awareness and
location-specific alert detail.

The track uses a fitted global Natural Earth backdrop, centred position dots,
and a provider cone when available. On this screen, `r` refreshes the tropical
data and `b` returns to the Dashboard.

<p align="center">
  <img src="docs/assets/tropical-systems.png" alt="Tropical Systems Warnings Center showing a storm track and official advisory" width="900">
</p>

## Library Usage

This library is designed to be used as a TUI, but I have also exposed a minimal set of functions for fetching weather data and geocoding that can be used in other Python contexts. These are available as both async and sync versions, depending on your needs.

Install as a package:

```bash
uv add wevva
```

Simple sync usage (nice for scripts):

```python
from wevva import forecast_by_place_sync

bundle = forecast_by_place_sync("Edinburgh")
print(bundle.metadata.name, bundle.metadata.country)
print(bundle.current.get_temperature(), bundle.current.forecast_units.get("temperature_2m"))
```

Async usage (best for apps/services):

```python
import asyncio
from wevva import forecast_by_coordinates

async def main() -> None:
    bundle = await forecast_by_coordinates(lat=55.9533, lon=-3.1883)
    print(bundle.daily.get_temperature_max(0))
    print(bundle.hourly.get_condition_abbreviation(0))

asyncio.run(main())
```

You can also geocode from Python:

```python
from wevva import geocode_sync

matches = geocode_sync("Glasgow", count=3)
for match in matches:
    print(match.name, match.country, match.latitude, match.longitude)
```

Fetch alerts by coordinates:

```python
from wevva import alerts_by_coordinates_sync

alerts = alerts_by_coordinates_sync(lat=39.7456, lon=-97.0892, country_code="US")
for alert in alerts:
    print(alert.event, alert.severity, alert.expires)
```

## Keys

Dashboard is the navigation hub:

- `w` open the full Weather Forecast screen
- `m` open the interactive saved-locations world map
- `t` investigate active tropical systems
- `g` open the Global Weather Alerts Center
- `r` refresh the selected forecast, its point alerts, and tropical systems

On the Weather Forecast screen:

- `s` search for place
- `r` refresh weather
- `a` save current location
- `d` delete highlighted saved location
- `l` focus saved locations when its automatic rail is visible; otherwise open it
- `i` focus warning details when its automatic rail is visible; otherwise open them
- `b` return to the Dashboard

Shared throughout the application:

- `u` open settings
- `h` or `?` open help
- `c` credits
- `q` quit

The Map View, Tropical Systems Warnings Center, and Global Weather Alerts
Center screens use `b` to return to the Dashboard. Press `h` in the application
for the complete shortcut guide.
On the saved-locations world map, use left/right to move between city labels,
then Enter or Space to open the focused forecast; mouse selection works too.
Location-map city labels can likewise be clicked or focused and activated to
open their ordinary weather forecast. Activating a Global Weather Alerts Center
settlement also opens its ordinary full forecast; hovering first shows a compact
current-weather tooltip without leaving the warning map.

## Config

Preferences are stored at:

```text
~/.config/wevva/config.json
```

Saved settings include:
- units
- theme
- emoji preference
- default location (and cached resolved location metadata)
