A rich CLI for location-based weather forecasts
Project description
Yr Weather CLI
yr.no has a great weather service but poor search functionality, especially for South African place names. yr
is a simple CLI that combines OpenStreetMaps search engine with yr's location forecast to provide precise weather forecasts from place names in the command line.
Table of contents
Features
- Provides detailed forecasts for the next 24 hours, summary forecasts for the next
n
days, and forecasts for the next weekend - Enables location search by name and optionally displays a map of the selected location
- Displays forecasts with images and icons in terminal with iTerm2 with automatic fallback to Rich output for other terminals
- Forecasts provide the following information:
- Forecast interval
- Forecast summary icon
- Air temperature (°C)
- Precipitation amount (mm)
- Wind speed (m/s) and direction
- Cloud cover (%)
- Displays forecasts at the highest time resolution available from yr's API (hourly short term, six-hour medium term)
- Allows searches in different countries and handles timezone conversion automatically
Snags
Installation
pip install yr-cli
Usage
You can use the
--help
option to get more details about the commands and their options
yr <command> [options]
Now
Detailed forecast for the next 24 hours
yr now <location>
Options
--limit INTEGER Maximum number of location results [default: 10]
--country-code TEXT Country code for location search [default: za]
--no-cache Bypass cache and fetch fresh data
--map -m Show a map of the selected location
Examples
yr now silvermine Give a detailed forecast for Silvermine, South Africa
yr now silvermine -m --country-code ca Give a detailed forecast for Silvermine, Canada, showing a map
Summary
Summary forecast for the next (default 5) days
yr summary <location>
Options
--days INTEGER Number of days for summary forecast [default: 5]
--limit INTEGER Maximum number of location results [default: 10]
--country-code TEXT Country code for location search [default: za]
--no-cache Bypass cache and fetch fresh data
--map -m Show a map of the selected location
Examples
yr summary 'de pakhuys' --limit 5 Give a summary forecast for De Pakhuys, South Africa with at most 5 results
yr summary 'de pakhuys' --days 7 Give a summary forecast for De Pakhuys, South Africa for the next 7 days
Weekend
Forecast for the next weekend
yr weekend <location>
Options
--limit INTEGER Maximum number of location results [default: 10]
--country-code TEXT Country code for location search [default: za]
--no-cache Bypass cache and fetch fresh data
--map -m Show a map of the selected location
Examples
yr weekend 'sassies bouldering' Give a weekend forecast for Sassies Bouldering, Rocklands, South Africa
Clear cache
Clear the cache of saved locations
yr clear-cache
Display fallback
If you are not using iTerm2, yr
will fallback to using Rich to display the weather table.
Development
To install yr-cli
for development, run:
pip install -e '.[dev]'
Code for this repository is checked using pre-commit. After cloning this repository please run the following steps to initialise pre-commit:
pre-commit install --install-hooks
The following hooks are automatically run when new commits are made:
- From pre-commit hooks:
- end-of-file-fixer
- trailing-whitespace
- check-yaml
- check-added-large-files (max. 500kb)
- black Python code format checking
- flake8 Python code linting
- isort Python code import ordering
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
Built Distribution
File details
Details for the file yr_cli-0.0.4.tar.gz
.
File metadata
- Download URL: yr_cli-0.0.4.tar.gz
- Upload date:
- Size: 724.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d286c4139db10d3a5e40fa085f0593d361a5c33776f97e174890181130e52ed6 |
|
MD5 | 655e81d7bffdd2c5b575ce9216c10f46 |
|
BLAKE2b-256 | d24aa49dc0f413c95deca09e287a94db2b1158e07e6f7d128eada09f3b07d397 |
File details
Details for the file yr_cli-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: yr_cli-0.0.4-py3-none-any.whl
- Upload date:
- Size: 741.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c834c311d3e4e131ae200cc732347edb3c78667f246f4379a33d629e1618ab70 |
|
MD5 | 1410eb170ecc12c20e716d8e55f3cb27 |
|
BLAKE2b-256 | 18d1927ddf06153aa3dfa5843d07ebe0ad7f4bd7545149b3ce6dfc9acf98aa71 |