Skip to main content

Command line weather app

Project description

Weather Command

Tests Status pre-commit.ci status Coverage PyPI version PyPI - Python Version

A command line weather app

Installation

Installation with pipx is recommended.

If you are running on a non-Windows OS you can install with uvloop for more speed.

pipx install "weather-command[uvloop]"

uvloop is currently not supported on Windows on this platform install without uvloop.

pipx install weather-command

Alternatively Weather Command can be installed with pip.

# Non Windows
pip install weather-command[uvloop]

# Windows
pip install weather-command

Usage

First an API key is needed from OpenWeather, A free account is all that is needed. Once you have your API key create an environment variable named OPEN_WEATHER_API_KEY that constains your API key.

export OPEN_WEATHER_API_KEY=your-api-key

Each time the shell is restarted this variable will be cleared. To avoid this it can be added to your profile. For example if your shell is zsh the API key can be added to the ~/.zshenv file. Doing this will prevent the need to re-add the key each time the shell is started.

To get the weather for a city:

weather-command city seattle

Once installed you can also add aliases to your shell to make it quick to get a forecast. For example if your shell is zsh you can add something like the following to your ~/.zshrc file:

alias we="weather-command cli zip 98109 -i --am-pm"
alias wed="weather-command cli zip 98109 -i --am-pm -f daily"
alias weh="weather-command cli zip 98109 -i --am-pm -f hourly"
alias wet="weather-command tui zip 98109 -i --am-pm"

After adding this to the ~/.zshrc you will need to restart your terminal. After that typing we will get the current forecast, wed will get the daily forecast and weh will get the hourly forecast.

Modes

Weather Command can be run in either CLI (command line interface) mode or TUI (text user interface) mode. CLI mode will print the weather to your terminal, while TUI mode will open the weather in an interactive terminal app.

To run in CLI mode use the cli command

weather-command cli zip 98109 -i --am-pm

To run in TUI mode use the tui command

weather-command tui zip 98109 -i --am-pm

Contributing

Contributions to this project are welcome. If you are interesting in contributing please see our contributing guide

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

weather-command-3.2.8.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distribution

weather_command-3.2.8-py3-none-any.whl (17.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page