[](https://pypi.org/project/powerline-owmweather/)
[](http://pepy.tech/count/powerline-owmweather)
# powerline-owmweather 🌦

A light-hearted [Powerline](https://github.com/powerline/powerline) segment for fetching and showing the weather in the current location (either by IP geolocation or by setting a location, see [Configuration](#configuration) below).
- [Motivation](#motivation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Activation](#activiation)
- [Configuration and Customization](#configuration-and-customization)
- [Changelog](#changelog)
- [TODO](#todo)
## Motivation
The built-in weather segment is using Yahoo Weather API which is no longer available so I decided to create an almost drop-in replacement using [OpenWeather](https://openweathermap.org/).
## Requirements
- [Powerline](https://github.com/powerline/powerline)
- A (free) [OpenWeather](https://openweathermap.org/) account and API key with the "Current Weather Data" plan enabled.
## Installation
```
pip install powerline-owmweather
```
## Activation
The very minimum required to activate the segment is to add the following to your theme JSON:
```
{
"function": "powerline_owmweather.weather",
"args": {
"openweathermap_api_key": API_KEY
}
}
```
Alternatively, the API key can also be provided by setting it as an environment variable,
see [Configuration and Customization](#configuration-and-customization) for details.
and the following to your colorscheme JSON (the colors can be customized):
```
"groups": {
...,
"owmweather": {
"fg": "gray9",
"bg": "gray2",
"attrs": []
}
}
```
## Configuration and Customization
The following optional `args` are available:
| Argument | Type | Description | Default |
|--------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| `openweathermap_api_key` | string | If not provided in the theme JSON, the segment will try to use the `POWERLINE_OPENWEATHERMAP_API_KEY` environment variable | `POWERLINE_OPENWEATHERMAP_API_KEY` <br/>environment variable |
| `condition_as_icon` | boolean | If `true`, condition will be displayed as an icon (if one of known conditions).<br>If `false` condition will be displayed as a string | `true` |
| `humidity_format` | string | A Python format string that accepts `humidity` as an argument | `"{humidity:.0f}"` |
| `location_query` | string | Location in format CITY, 2-LETTERS-COUNTRY-CODE | Retrived using IP geolocation |
| `post_condition` | string | String to append after `condition` | "" |
| `post_humidity` | string | String to append after `humidity` | "" |
| `post_location` | string | String to append after `location` | "" |
| `post_temp` | string | String to append after `temp` | "" |
| `pre_condition` | string | String to prepend before `condition` | " " |
| `pre_humidity` | string | String to prepend before `humidity` | " " |
| `pre_location` | string | String to prepend before `location` | " " |
| `pre_temp` | string | String to prepend before `temp` | " " |
| `show ` | string | Comma-separated string specifies what data to show.<br>Can include `"condition"`, `"humidity"`, `"location"`, `"temp"`.<br>See [Highlight Groups](#highlight-groups) | `"temp"` |
| `temp_format` | string | A Python format string that accepts `temp` as an argument | `"{temp:.0f}"` |
| `ttl_in_minutes` | integer | Time in minutes for which location and weather are cached.<br>**Warning: The lower the value the slower your terminal will be** | 60 |
| `units` | string | Temperature units.<br>Should be one of `"C"`, `"F"`, `"K"` | `"C"` |
### Highlight Groups
Every data in `"show"` is displayed in its own segment with its own highlight group, meaning it can be styled independently in your colorscheme JSON. Each highlight group is composed of `owmweather_{data_name}`, for example:
```
"owmweather_condition": {
"fg": "gray6",
"bg": "gray3",
"attrs": []
},
"owmweather_temp": {
"fg": "gray9",
"bg": "gray2",
"attrs": []
}
```
`"pre_{data_name}"` and `"post_{data_name}"` can also be customized using `"owmweather_pre_{data_name}"` and `"owmweather_post_{data_name}"` highlight groups.
If a specific highlight group is not defined then the style of `"owmweather"` group will be used.
## Changelog
### 0.5 - Dec. 27 2024
* Allowing to set openweathermap API key as an environment variable
### 0.4 - Nov. 3 2020
* `'%'` is no longer in the default `humidity_format`
* Added `pre_data` and `post_data` arguments and highlight groups
* Added ability to show location
### 0.3 - Nov. 1 2020
* Added ability to display humidity
### 0.2 - Nov. 1 2020
* Added ability to display temperature, condition
* Added ability to display condition as either icons or strings
### 0.1.1 - Oct. 31 2020
* Fixed a bug that prevented setting a custom `ttl_in_minutes`
* Added debug logs
### 0.1.0 - Oct. 31 2020
Initial release
## TODO
- [x] Support icons
- [x] Support weather description ("cloudy", "windy", etc)
- [ ] Support configurable information to display:
- [x] Temperature
- [x] Condition
- [ ] Wind speed/direction
- [x] Humidity
- [ ] Pressure
Raw data
{
"_id": null,
"home_page": "https://github.com/DeepSpace2/powerline-owmweather",
"name": "powerline-owmweather",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "powerline weather segment terminal cli",
"author": "DeepSpace2",
"author_email": "deepspace2@gmail.com",
"download_url": null,
"platform": null,
"description": "[](https://pypi.org/project/powerline-owmweather/)\r\n[](http://pepy.tech/count/powerline-owmweather)\r\n\r\n# powerline-owmweather \u00f0\u0178\u0152\u00a6\r\n\r\n\r\n\r\nA light-hearted [Powerline](https://github.com/powerline/powerline) segment for fetching and showing the weather in the current location (either by IP geolocation or by setting a location, see [Configuration](#configuration) below).\r\n\r\n\r\n- [Motivation](#motivation)\r\n- [Requirements](#requirements)\r\n- [Installation](#installation)\r\n- [Activation](#activiation)\r\n- [Configuration and Customization](#configuration-and-customization)\r\n- [Changelog](#changelog)\r\n- [TODO](#todo)\r\n\r\n## Motivation\r\n\r\nThe built-in weather segment is using Yahoo Weather API which is no longer available so I decided to create an almost drop-in replacement using [OpenWeather](https://openweathermap.org/).\r\n\r\n## Requirements\r\n\r\n - [Powerline](https://github.com/powerline/powerline)\r\n - A (free) [OpenWeather](https://openweathermap.org/) account and API key with the \"Current Weather Data\" plan enabled.\r\n \r\n## Installation\r\n \r\n```\r\npip install powerline-owmweather\r\n```\r\n\r\n## Activation\r\n \r\nThe very minimum required to activate the segment is to add the following to your theme JSON:\r\n \r\n```\r\n{\r\n \"function\": \"powerline_owmweather.weather\",\r\n \"args\": {\r\n \"openweathermap_api_key\": API_KEY\r\n }\r\n}\r\n```\r\n\r\nAlternatively, the API key can also be provided by setting it as an environment variable,\r\nsee [Configuration and Customization](#configuration-and-customization) for details. \r\n\r\nand the following to your colorscheme JSON (the colors can be customized):\r\n \r\n```\r\n\"groups\": {\r\n ...,\r\n \"owmweather\": {\r\n \"fg\": \"gray9\",\r\n \"bg\": \"gray2\",\r\n \"attrs\": []\r\n }\r\n}\r\n```\r\n \r\n## Configuration and Customization\r\n \r\nThe following optional `args` are available:\r\n \r\n| Argument | Type | Description | Default |\r\n|--------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|\r\n| `openweathermap_api_key` | string | If not provided in the theme JSON, the segment will try to use the `POWERLINE_OPENWEATHERMAP_API_KEY` environment variable | `POWERLINE_OPENWEATHERMAP_API_KEY` <br/>environment variable |\r\n| `condition_as_icon` | boolean | If `true`, condition will be displayed as an icon (if one of known conditions).<br>If `false` condition will be displayed as a string | `true` |\r\n| `humidity_format` | string | A Python format string that accepts `humidity` as an argument | `\"{humidity:.0f}\"` |\r\n| `location_query` | string | Location in format CITY, 2-LETTERS-COUNTRY-CODE | Retrived using IP geolocation | \r\n| `post_condition` | string | String to append after `condition` | \"\" |\r\n| `post_humidity` | string | String to append after `humidity` | \"\" |\r\n| `post_location` | string | String to append after `location` | \"\" |\r\n| `post_temp` | string | String to append after `temp` | \"\" |\r\n| `pre_condition` | string | String to prepend before `condition` | \" \" |\r\n| `pre_humidity` | string | String to prepend before `humidity` | \" \" |\r\n| `pre_location` | string | String to prepend before `location` | \" \" |\r\n| `pre_temp` | string | String to prepend before `temp` | \" \" |\r\n| `show ` | string | Comma-separated string specifies what data to show.<br>Can include `\"condition\"`, `\"humidity\"`, `\"location\"`, `\"temp\"`.<br>See [Highlight Groups](#highlight-groups) | `\"temp\"` |\r\n| `temp_format` | string | A Python format string that accepts `temp` as an argument | `\"{temp:.0f}\"` |\r\n| `ttl_in_minutes` | integer | Time in minutes for which location and weather are cached.<br>**Warning: The lower the value the slower your terminal will be** | 60 |\r\n| `units` | string | Temperature units.<br>Should be one of `\"C\"`, `\"F\"`, `\"K\"` | `\"C\"` |\r\n\r\n### Highlight Groups\r\n\r\nEvery data in `\"show\"` is displayed in its own segment with its own highlight group, meaning it can be styled independently in your colorscheme JSON. Each highlight group is composed of `owmweather_{data_name}`, for example:\r\n\r\n```\r\n\"owmweather_condition\": {\r\n \"fg\": \"gray6\",\r\n \"bg\": \"gray3\",\r\n \"attrs\": []\r\n},\r\n\"owmweather_temp\": {\r\n \"fg\": \"gray9\",\r\n \"bg\": \"gray2\",\r\n \"attrs\": []\r\n}\r\n```\r\n\r\n`\"pre_{data_name}\"` and `\"post_{data_name}\"` can also be customized using `\"owmweather_pre_{data_name}\"` and `\"owmweather_post_{data_name}\"` highlight groups.\r\n\r\nIf a specific highlight group is not defined then the style of `\"owmweather\"` group will be used.\r\n\r\n## Changelog\r\n\r\n### 0.5 - Dec. 27 2024\r\n* Allowing to set openweathermap API key as an environment variable\r\n\r\n### 0.4 - Nov. 3 2020\r\n* `'%'` is no longer in the default `humidity_format`\r\n* Added `pre_data` and `post_data` arguments and highlight groups\r\n* Added ability to show location\r\n\r\n### 0.3 - Nov. 1 2020\r\n* Added ability to display humidity\r\n\r\n### 0.2 - Nov. 1 2020\r\n* Added ability to display temperature, condition\r\n* Added ability to display condition as either icons or strings\r\n\r\n### 0.1.1 - Oct. 31 2020\r\n* Fixed a bug that prevented setting a custom `ttl_in_minutes`\r\n* Added debug logs\r\n\r\n### 0.1.0 - Oct. 31 2020\r\nInitial release\r\n\r\n## TODO\r\n\r\n - [x] Support icons\r\n - [x] Support weather description (\"cloudy\", \"windy\", etc)\r\n - [ ] Support configurable information to display:\r\n - [x] Temperature\r\n - [x] Condition\r\n - [ ] Wind speed/direction\r\n - [x] Humidity\r\n - [ ] Pressure\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Powerline segment for fetching and showing the weather in the current location",
"version": "0.5",
"project_urls": {
"Homepage": "https://github.com/DeepSpace2/powerline-owmweather"
},
"split_keywords": [
"powerline",
"weather",
"segment",
"terminal",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7c254f3276c7cff13002d042028a4a5edd57fb9740baca58f94be1c46358ebf6",
"md5": "ce47f974c1bd71ce656cb59f3d04d0b1",
"sha256": "873c58f5d0deb40852be571c25bded83b09c27590d4a67d491b1325ec580cc32"
},
"downloads": -1,
"filename": "powerline_owmweather-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ce47f974c1bd71ce656cb59f3d04d0b1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6473,
"upload_time": "2024-12-27T23:13:18",
"upload_time_iso_8601": "2024-12-27T23:13:18.233183Z",
"url": "https://files.pythonhosted.org/packages/7c/25/4f3276c7cff13002d042028a4a5edd57fb9740baca58f94be1c46358ebf6/powerline_owmweather-0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-27 23:13:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DeepSpace2",
"github_project": "powerline-owmweather",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "powerline-owmweather"
}