yr-cli


Nameyr-cli JSON
Version 0.0.4 PyPI version JSON
download
home_pageNone
SummaryA rich CLI for location-based weather forecasts
upload_time2024-10-13 15:25:08
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords yr weather cli command line
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Yr Weather CLI

[![Supported Python Versions](https://img.shields.io/pypi/pyversions/yr-cli/0.0.4)](https://pypi.org/project/yr-cli/) [![PyPI version](https://badge.fury.io/py/yr-cli.svg)](https://badge.fury.io/py/yr-cli)

[yr.no](https://www.yr.no/nb) 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](https://nominatim.openstreetmap.org/ui/search.html) with [yr's location forecast](https://api.met.no/weatherapi/locationforecast/2.0/documentation) to provide precise weather forecasts from place names in the command line.

<p align="center">
  <img src="https://github.com/twolffpiggott/yr-cli/raw/main/imgs/intro.gif" width="600">
</p>

# Table of contents

- [Yr weather CLI](#yr-weather-cli)
- [Table of contents](#table-of-contents)
- [Features](#features)
- [Snags](#snags)
- [Installation](#installation)
- [Usage](#usage)
    - [Now](#now)
    - [Summary](#summary)
    - [Weekend](#weekend)
    - [Clear cache](#clear-cache)
- [Display fallback](#display-fallback)
- [Development](#development)

# 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](https://iterm2.com) with automatic fallback to [Rich](https://github.com/Textualize/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

- [iTerm2](https://iterm2.com) is the only first-class citizen for image output
- [tmux](https://github.com/tmux/tmux) is not yet supported

# Installation

```bash
pip install yr-cli
```

# Usage

> You can use the `--help` option to get more details about the commands and their options

```bash
yr <command> [options]
```

## Now

<p align="center">
  <img src="https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_now.gif" width="600">
</p>

> Detailed forecast for the next 24 hours

```bash
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

<p align="center">
  <img src="https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_summary.gif" width="600">
</p>

> Summary forecast for the next <days> (default 5) days

```bash
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

<p align="center">
  <img src="https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_weekend.gif" width="600">
</p>

> Forecast for the next weekend

```bash
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

```bash
yr clear-cache
```

# Display fallback

If you are not using iTerm2, `yr` will fallback to using Rich to display the weather table.

<p align="center">
  <img src="https://github.com/twolffpiggott/yr-cli/raw/main/imgs/rich_fallback.gif" width="600">
</p>

# Development

To install `yr-cli` for development, run:

```bash
pip install -e '.[dev]'
```

Code for this repository is checked using [pre-commit](https://pre-commit.com/). After cloning this repository please run the following steps to initialise pre-commit:

```bash
pre-commit install --install-hooks
```

The following hooks are automatically run when new commits are made:

- From [pre-commit hooks](https://github.com/pre-commit/pre-commit-hooks):
    - end-of-file-fixer
    - trailing-whitespace
    - check-yaml
    - check-added-large-files (max. 500kb)
- [black](https://github.com/psf/black) Python code format checking
- [flake8](https://gitlab.com/pycqa/flake8) Python code linting
- [isort](https://github.com/PyCQA/isort) Python code import ordering

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yr-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "yr, weather, cli, command line",
    "author": null,
    "author_email": "Tim Wolff-Piggott <twolffpiggott@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d2/4a/a49dc0f413c95deca09e287a94db2b1158e07e6f7d128eada09f3b07d397/yr_cli-0.0.4.tar.gz",
    "platform": null,
    "description": "# Yr Weather CLI\n\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/yr-cli/0.0.4)](https://pypi.org/project/yr-cli/) [![PyPI version](https://badge.fury.io/py/yr-cli.svg)](https://badge.fury.io/py/yr-cli)\n\n[yr.no](https://www.yr.no/nb) 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](https://nominatim.openstreetmap.org/ui/search.html) with [yr's location forecast](https://api.met.no/weatherapi/locationforecast/2.0/documentation) to provide precise weather forecasts from place names in the command line.\n\n<p align=\"center\">\n  <img src=\"https://github.com/twolffpiggott/yr-cli/raw/main/imgs/intro.gif\" width=\"600\">\n</p>\n\n# Table of contents\n\n- [Yr weather CLI](#yr-weather-cli)\n- [Table of contents](#table-of-contents)\n- [Features](#features)\n- [Snags](#snags)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Now](#now)\n    - [Summary](#summary)\n    - [Weekend](#weekend)\n    - [Clear cache](#clear-cache)\n- [Display fallback](#display-fallback)\n- [Development](#development)\n\n# Features\n\n- Provides detailed forecasts for the next 24 hours, summary forecasts for the next `n` days, and forecasts for the next weekend\n- Enables location search by name and optionally displays a map of the selected location\n- Displays forecasts with images and icons in terminal with [iTerm2](https://iterm2.com) with automatic fallback to [Rich](https://github.com/Textualize/rich) output for other terminals\n- Forecasts provide the following information:\n   - Forecast interval\n   - Forecast summary icon\n   - Air temperature (\u00b0C)\n   - Precipitation amount (mm)\n   - Wind speed (m/s) and direction\n   - Cloud cover (%)\n- Displays forecasts at the highest time resolution available from yr's API (hourly short term, six-hour medium term)\n- Allows searches in different countries and handles timezone conversion automatically\n\n# Snags\n\n- [iTerm2](https://iterm2.com) is the only first-class citizen for image output\n- [tmux](https://github.com/tmux/tmux) is not yet supported\n\n# Installation\n\n```bash\npip install yr-cli\n```\n\n# Usage\n\n> You can use the `--help` option to get more details about the commands and their options\n\n```bash\nyr <command> [options]\n```\n\n## Now\n\n<p align=\"center\">\n  <img src=\"https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_now.gif\" width=\"600\">\n</p>\n\n> Detailed forecast for the next 24 hours\n\n```bash\nyr now <location>\n```\n\nOptions\n\n```\n--limit                 INTEGER  Maximum number of location results [default: 10]\n--country-code          TEXT     Country code for location search [default: za]\n--no-cache                       Bypass cache and fetch fresh data\n--map           -m               Show a map of the selected location\n```\n\nExamples\n\n```\nyr now silvermine                            Give a detailed forecast for Silvermine, South Africa\nyr now silvermine -m --country-code ca       Give a detailed forecast for Silvermine, Canada, showing a map\n```\n\n## Summary\n\n<p align=\"center\">\n  <img src=\"https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_summary.gif\" width=\"600\">\n</p>\n\n> Summary forecast for the next <days> (default 5) days\n\n```bash\nyr summary <location>\n```\n\nOptions\n\n```\n--days                  INTEGER  Number of days for summary forecast [default: 5]\n--limit                 INTEGER  Maximum number of location results [default: 10]\n--country-code          TEXT     Country code for location search [default: za]\n--no-cache                       Bypass cache and fetch fresh data\n--map           -m               Show a map of the selected location\n```\n\nExamples\n\n```\nyr summary 'de pakhuys' --limit 5      Give a summary forecast for De Pakhuys, South Africa with at most 5 results\nyr summary 'de pakhuys' --days 7       Give a summary forecast for De Pakhuys, South Africa for the next 7 days\n```\n\n## Weekend\n\n<p align=\"center\">\n  <img src=\"https://github.com/twolffpiggott/yr-cli/raw/main/imgs/yr_weekend.gif\" width=\"600\">\n</p>\n\n> Forecast for the next weekend\n\n```bash\nyr weekend <location>\n```\n\nOptions\n\n```\n--limit                 INTEGER  Maximum number of location results [default: 10]\n--country-code          TEXT     Country code for location search [default: za]\n--no-cache                       Bypass cache and fetch fresh data\n--map           -m               Show a map of the selected location\n```\n\nExamples\n\n```\nyr weekend 'sassies bouldering'       Give a weekend forecast for Sassies Bouldering, Rocklands, South Africa\n```\n\n## Clear cache\n\n> Clear the cache of saved locations\n\n```bash\nyr clear-cache\n```\n\n# Display fallback\n\nIf you are not using iTerm2, `yr` will fallback to using Rich to display the weather table.\n\n<p align=\"center\">\n  <img src=\"https://github.com/twolffpiggott/yr-cli/raw/main/imgs/rich_fallback.gif\" width=\"600\">\n</p>\n\n# Development\n\nTo install `yr-cli` for development, run:\n\n```bash\npip install -e '.[dev]'\n```\n\nCode for this repository is checked using [pre-commit](https://pre-commit.com/). After cloning this repository please run the following steps to initialise pre-commit:\n\n```bash\npre-commit install --install-hooks\n```\n\nThe following hooks are automatically run when new commits are made:\n\n- From [pre-commit hooks](https://github.com/pre-commit/pre-commit-hooks):\n    - end-of-file-fixer\n    - trailing-whitespace\n    - check-yaml\n    - check-added-large-files (max. 500kb)\n- [black](https://github.com/psf/black) Python code format checking\n- [flake8](https://gitlab.com/pycqa/flake8) Python code linting\n- [isort](https://github.com/PyCQA/isort) Python code import ordering\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A rich CLI for location-based weather forecasts",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/twolffpiggott/yr-cli"
    },
    "split_keywords": [
        "yr",
        " weather",
        " cli",
        " command line"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18d1927ddf06153aa3dfa5843d07ebe0ad7f4bd7545149b3ce6dfc9acf98aa71",
                "md5": "1410eb170ecc12c20e716d8e55f3cb27",
                "sha256": "c834c311d3e4e131ae200cc732347edb3c78667f246f4379a33d629e1618ab70"
            },
            "downloads": -1,
            "filename": "yr_cli-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1410eb170ecc12c20e716d8e55f3cb27",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 741849,
            "upload_time": "2024-10-13T15:25:06",
            "upload_time_iso_8601": "2024-10-13T15:25:06.442476Z",
            "url": "https://files.pythonhosted.org/packages/18/d1/927ddf06153aa3dfa5843d07ebe0ad7f4bd7545149b3ce6dfc9acf98aa71/yr_cli-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d24aa49dc0f413c95deca09e287a94db2b1158e07e6f7d128eada09f3b07d397",
                "md5": "655e81d7bffdd2c5b575ce9216c10f46",
                "sha256": "d286c4139db10d3a5e40fa085f0593d361a5c33776f97e174890181130e52ed6"
            },
            "downloads": -1,
            "filename": "yr_cli-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "655e81d7bffdd2c5b575ce9216c10f46",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 724533,
            "upload_time": "2024-10-13T15:25:08",
            "upload_time_iso_8601": "2024-10-13T15:25:08.298807Z",
            "url": "https://files.pythonhosted.org/packages/d2/4a/a49dc0f413c95deca09e287a94db2b1158e07e6f7d128eada09f3b07d397/yr_cli-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 15:25:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "twolffpiggott",
    "github_project": "yr-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "yr-cli"
}
        
Elapsed time: 0.33947s