wevva 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wevva-0.1.0/.gitignore +178 -0
- wevva-0.1.0/LICENSE +21 -0
- wevva-0.1.0/PKG-INFO +194 -0
- wevva-0.1.0/README.md +149 -0
- wevva-0.1.0/pyproject.toml +40 -0
- wevva-0.1.0/wevva/__init__.py +50 -0
- wevva-0.1.0/wevva/__main__.py +11 -0
- wevva-0.1.0/wevva/api.py +281 -0
- wevva-0.1.0/wevva/app.py +186 -0
- wevva-0.1.0/wevva/cli.py +654 -0
- wevva-0.1.0/wevva/conditions.py +54 -0
- wevva-0.1.0/wevva/config.py +330 -0
- wevva-0.1.0/wevva/constants.py +34 -0
- wevva-0.1.0/wevva/controller.py +113 -0
- wevva-0.1.0/wevva/location_metadata.py +36 -0
- wevva-0.1.0/wevva/messages.py +70 -0
- wevva-0.1.0/wevva/models.py +24 -0
- wevva-0.1.0/wevva/openmeteo.py +696 -0
- wevva-0.1.0/wevva/screens/air_quality_help.py +117 -0
- wevva-0.1.0/wevva/screens/author_screen.py +83 -0
- wevva-0.1.0/wevva/screens/help.py +89 -0
- wevva-0.1.0/wevva/screens/search_screen.py +54 -0
- wevva-0.1.0/wevva/screens/settings_screen.py +143 -0
- wevva-0.1.0/wevva/screens/weather_screen.py +280 -0
- wevva-0.1.0/wevva/services/air_quality.py +39 -0
- wevva-0.1.0/wevva/services/geocoding.py +89 -0
- wevva-0.1.0/wevva/services/weather.py +42 -0
- wevva-0.1.0/wevva/utils/__init__.py +37 -0
- wevva-0.1.0/wevva/utils/colors.py +259 -0
- wevva-0.1.0/wevva/utils/formatting.py +90 -0
- wevva-0.1.0/wevva/utils/geo.py +49 -0
- wevva-0.1.0/wevva/utils/visualization.py +61 -0
- wevva-0.1.0/wevva/wevva.tcss +19 -0
- wevva-0.1.0/wevva/widgets/air_quality.py +212 -0
- wevva-0.1.0/wevva/widgets/astronomy_info.py +240 -0
- wevva-0.1.0/wevva/widgets/context_bar.py +121 -0
- wevva-0.1.0/wevva/widgets/current_conditions.py +147 -0
- wevva-0.1.0/wevva/widgets/current_detail.py +137 -0
- wevva-0.1.0/wevva/widgets/daily_forecast.py +82 -0
- wevva-0.1.0/wevva/widgets/daily_summary.py +192 -0
- wevva-0.1.0/wevva/widgets/hourly_forecast.py +421 -0
- wevva-0.1.0/wevva/widgets/location_info.py +234 -0
- wevva-0.1.0/wevva/widgets/precip_info.py +96 -0
- wevva-0.1.0/wevva/widgets/search_dialog.py +173 -0
- wevva-0.1.0/wevva/widgets/search_results.py +122 -0
- wevva-0.1.0/wevva/widgets/weather_summary.py +168 -0
- wevva-0.1.0/wevva/widgets/weather_widget.py +142 -0
wevva-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
dist
|
|
2
|
+
.venv
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
__pycache__
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# UV
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
#uv.lock
|
|
106
|
+
|
|
107
|
+
# poetry
|
|
108
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
109
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
110
|
+
# commonly ignored for libraries.
|
|
111
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
112
|
+
#poetry.lock
|
|
113
|
+
|
|
114
|
+
# pdm
|
|
115
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
116
|
+
#pdm.lock
|
|
117
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
118
|
+
# in version control.
|
|
119
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
120
|
+
.pdm.toml
|
|
121
|
+
.pdm-python
|
|
122
|
+
.pdm-build/
|
|
123
|
+
|
|
124
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
125
|
+
__pypackages__/
|
|
126
|
+
|
|
127
|
+
# Celery stuff
|
|
128
|
+
celerybeat-schedule
|
|
129
|
+
celerybeat.pid
|
|
130
|
+
|
|
131
|
+
# SageMath parsed files
|
|
132
|
+
*.sage.py
|
|
133
|
+
|
|
134
|
+
# Environments
|
|
135
|
+
.env
|
|
136
|
+
.venv
|
|
137
|
+
env/
|
|
138
|
+
venv/
|
|
139
|
+
ENV/
|
|
140
|
+
env.bak/
|
|
141
|
+
venv.bak/
|
|
142
|
+
|
|
143
|
+
# Spyder project settings
|
|
144
|
+
.spyderproject
|
|
145
|
+
.spyproject
|
|
146
|
+
|
|
147
|
+
# Rope project settings
|
|
148
|
+
.ropeproject
|
|
149
|
+
|
|
150
|
+
# mkdocs documentation
|
|
151
|
+
/site
|
|
152
|
+
|
|
153
|
+
# mypy
|
|
154
|
+
.mypy_cache/
|
|
155
|
+
.dmypy.json
|
|
156
|
+
dmypy.json
|
|
157
|
+
|
|
158
|
+
# Pyre type checker
|
|
159
|
+
.pyre/
|
|
160
|
+
|
|
161
|
+
# pytype static type analyzer
|
|
162
|
+
.pytype/
|
|
163
|
+
|
|
164
|
+
# Cython debug symbols
|
|
165
|
+
cython_debug/
|
|
166
|
+
|
|
167
|
+
# PyCharm
|
|
168
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
169
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
170
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
171
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
172
|
+
#.idea/
|
|
173
|
+
|
|
174
|
+
# Ruff stuff:
|
|
175
|
+
.ruff_cache/
|
|
176
|
+
|
|
177
|
+
# PyPI configuration file
|
|
178
|
+
.pypirc
|
wevva-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nick Ferguson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
wevva-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wevva
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Textual TUI for viewing weather via Open-Meteo
|
|
5
|
+
Author-email: Nick Ferguson <nick.ferguson@ed.ac.uk>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Nick Ferguson
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Keywords: open-meteo,terminal,textual,tui,weather
|
|
29
|
+
Classifier: Environment :: Console
|
|
30
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Classifier: Topic :: Terminals
|
|
36
|
+
Classifier: Topic :: Utilities
|
|
37
|
+
Requires-Python: >=3.12
|
|
38
|
+
Requires-Dist: httpx>=0.28.1
|
|
39
|
+
Requires-Dist: pycountry>=24.6.1
|
|
40
|
+
Requires-Dist: questionary>=2.1.1
|
|
41
|
+
Requires-Dist: textual>=3.1.0
|
|
42
|
+
Requires-Dist: typer>=0.21.1
|
|
43
|
+
Requires-Dist: wcwidth>=0.2.13
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# wevva
|
|
47
|
+
|
|
48
|
+
`wevva` is a weather TUI built with [Textual](https://textual.textualize.io/) and powered by [Open-Meteo](https://open-meteo.com/).
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<img src="docs/assets/wevva-main.png" alt="wevva weather TUI screenshot" width="900">
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
## Highlights
|
|
55
|
+
|
|
56
|
+
- Place search using Open-Meteo geocoding
|
|
57
|
+
- Current, hourly, and daily forecasts with detailed weather parameters and keyboard navigation
|
|
58
|
+
- Unit preferences (temperature, wind, precipitation)
|
|
59
|
+
- Theme and emoji toggles
|
|
60
|
+
- Interactive setup wizard for defaults
|
|
61
|
+
- Reusable Python API (async + sync helpers)
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
First, install [uv](https://docs.astral.sh/uv/):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
curl -Ls https://astral.sh/uv/install.sh | sh
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then, using `uvx`, run `wevva`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uvx wevva
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
to launch the app without cloning the repo. This will install `wevva` as a package in a temporary environment and run it from there.
|
|
78
|
+
|
|
79
|
+
Alternatively, you can clone the repo and run from the local source:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
uvx --from . wevva
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Requires Python `>=3.12`.
|
|
86
|
+
|
|
87
|
+
## First-Time Setup
|
|
88
|
+
|
|
89
|
+
Run the setup wizard to save defaults:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uvx wevva setup
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Save settings without launching:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uvx wevva setup --no-launch
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Useful Commands
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Start normally (uses saved defaults)
|
|
105
|
+
uvx wevva
|
|
106
|
+
|
|
107
|
+
# Start directly at a location
|
|
108
|
+
uvx wevva --location "Edinburgh"
|
|
109
|
+
|
|
110
|
+
# One-run overrides
|
|
111
|
+
uvx wevva --theme dracula --no-emoji
|
|
112
|
+
uvx wevva --temperature-unit fahrenheit --wind-speed-unit mph
|
|
113
|
+
|
|
114
|
+
# Manage saved default location
|
|
115
|
+
uvx wevva --set-default-location "New York"
|
|
116
|
+
uvx wevva --clear-default-location
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Library Usage
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
Install as a package:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
uv add wevva
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Simple sync usage (nice for scripts):
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from wevva import forecast_by_place_sync
|
|
133
|
+
|
|
134
|
+
bundle = forecast_by_place_sync("Edinburgh")
|
|
135
|
+
print(bundle.metadata.name, bundle.metadata.country)
|
|
136
|
+
print(bundle.current.get_temperature(), bundle.current.forecast_units.get("temperature_2m"))
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Async usage (best for apps/services):
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
import asyncio
|
|
143
|
+
from wevva import forecast_by_coordinates
|
|
144
|
+
|
|
145
|
+
async def main() -> None:
|
|
146
|
+
bundle = await forecast_by_coordinates(lat=55.9533, lon=-3.1883)
|
|
147
|
+
print(bundle.daily.get_temperature_max(0))
|
|
148
|
+
print(bundle.hourly.get_condition_abbreviation(0))
|
|
149
|
+
|
|
150
|
+
asyncio.run(main())
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
You can also geocode from Python:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from wevva import geocode_sync
|
|
157
|
+
|
|
158
|
+
matches = geocode_sync("Glasgow", count=3)
|
|
159
|
+
for match in matches:
|
|
160
|
+
print(match.name, match.country, match.latitude, match.longitude)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## In-App Keys
|
|
164
|
+
|
|
165
|
+
- `s` search for place
|
|
166
|
+
- `r` refresh weather
|
|
167
|
+
- `u` open unit settings
|
|
168
|
+
- `h` or `?` open help
|
|
169
|
+
- `c` credits
|
|
170
|
+
- `q` quit
|
|
171
|
+
|
|
172
|
+
## Config
|
|
173
|
+
|
|
174
|
+
Preferences are stored at:
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
~/.config/wevva/config.json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Saved settings include:
|
|
181
|
+
- units
|
|
182
|
+
- theme
|
|
183
|
+
- emoji preference
|
|
184
|
+
- default location (and cached resolved location metadata)
|
|
185
|
+
|
|
186
|
+
## Notes
|
|
187
|
+
|
|
188
|
+
- Emoji rendering support varies by terminal/font/locale.
|
|
189
|
+
- TUI is the primary focus, but a lightweight Python API is now exported too.
|
|
190
|
+
|
|
191
|
+
## Known Issues
|
|
192
|
+
|
|
193
|
+
- Layout not super flexible, requires a terminal size of at least 100x43 for all elements to show fully.
|
|
194
|
+
- Temperature colour scaling is using the Met Office scale, the colours of which may not play nicely with all themes as they get towards the more extreme ends of the scale.
|
wevva-0.1.0/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# wevva
|
|
2
|
+
|
|
3
|
+
`wevva` is a weather TUI built with [Textual](https://textual.textualize.io/) and powered by [Open-Meteo](https://open-meteo.com/).
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="docs/assets/wevva-main.png" alt="wevva weather TUI screenshot" width="900">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
## Highlights
|
|
10
|
+
|
|
11
|
+
- Place search using Open-Meteo geocoding
|
|
12
|
+
- Current, hourly, and daily forecasts with detailed weather parameters and keyboard navigation
|
|
13
|
+
- Unit preferences (temperature, wind, precipitation)
|
|
14
|
+
- Theme and emoji toggles
|
|
15
|
+
- Interactive setup wizard for defaults
|
|
16
|
+
- Reusable Python API (async + sync helpers)
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
First, install [uv](https://docs.astral.sh/uv/):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
curl -Ls https://astral.sh/uv/install.sh | sh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then, using `uvx`, run `wevva`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uvx wevva
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
to launch the app without cloning the repo. This will install `wevva` as a package in a temporary environment and run it from there.
|
|
33
|
+
|
|
34
|
+
Alternatively, you can clone the repo and run from the local source:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uvx --from . wevva
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Requires Python `>=3.12`.
|
|
41
|
+
|
|
42
|
+
## First-Time Setup
|
|
43
|
+
|
|
44
|
+
Run the setup wizard to save defaults:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uvx wevva setup
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Save settings without launching:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uvx wevva setup --no-launch
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Useful Commands
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Start normally (uses saved defaults)
|
|
60
|
+
uvx wevva
|
|
61
|
+
|
|
62
|
+
# Start directly at a location
|
|
63
|
+
uvx wevva --location "Edinburgh"
|
|
64
|
+
|
|
65
|
+
# One-run overrides
|
|
66
|
+
uvx wevva --theme dracula --no-emoji
|
|
67
|
+
uvx wevva --temperature-unit fahrenheit --wind-speed-unit mph
|
|
68
|
+
|
|
69
|
+
# Manage saved default location
|
|
70
|
+
uvx wevva --set-default-location "New York"
|
|
71
|
+
uvx wevva --clear-default-location
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Library Usage
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
Install as a package:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv add wevva
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Simple sync usage (nice for scripts):
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from wevva import forecast_by_place_sync
|
|
88
|
+
|
|
89
|
+
bundle = forecast_by_place_sync("Edinburgh")
|
|
90
|
+
print(bundle.metadata.name, bundle.metadata.country)
|
|
91
|
+
print(bundle.current.get_temperature(), bundle.current.forecast_units.get("temperature_2m"))
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Async usage (best for apps/services):
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import asyncio
|
|
98
|
+
from wevva import forecast_by_coordinates
|
|
99
|
+
|
|
100
|
+
async def main() -> None:
|
|
101
|
+
bundle = await forecast_by_coordinates(lat=55.9533, lon=-3.1883)
|
|
102
|
+
print(bundle.daily.get_temperature_max(0))
|
|
103
|
+
print(bundle.hourly.get_condition_abbreviation(0))
|
|
104
|
+
|
|
105
|
+
asyncio.run(main())
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
You can also geocode from Python:
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from wevva import geocode_sync
|
|
112
|
+
|
|
113
|
+
matches = geocode_sync("Glasgow", count=3)
|
|
114
|
+
for match in matches:
|
|
115
|
+
print(match.name, match.country, match.latitude, match.longitude)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## In-App Keys
|
|
119
|
+
|
|
120
|
+
- `s` search for place
|
|
121
|
+
- `r` refresh weather
|
|
122
|
+
- `u` open unit settings
|
|
123
|
+
- `h` or `?` open help
|
|
124
|
+
- `c` credits
|
|
125
|
+
- `q` quit
|
|
126
|
+
|
|
127
|
+
## Config
|
|
128
|
+
|
|
129
|
+
Preferences are stored at:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
~/.config/wevva/config.json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Saved settings include:
|
|
136
|
+
- units
|
|
137
|
+
- theme
|
|
138
|
+
- emoji preference
|
|
139
|
+
- default location (and cached resolved location metadata)
|
|
140
|
+
|
|
141
|
+
## Notes
|
|
142
|
+
|
|
143
|
+
- Emoji rendering support varies by terminal/font/locale.
|
|
144
|
+
- TUI is the primary focus, but a lightweight Python API is now exported too.
|
|
145
|
+
|
|
146
|
+
## Known Issues
|
|
147
|
+
|
|
148
|
+
- Layout not super flexible, requires a terminal size of at least 100x43 for all elements to show fully.
|
|
149
|
+
- Temperature colour scaling is using the Met Office scale, the colours of which may not play nicely with all themes as they get towards the more extreme ends of the scale.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wevva"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Textual TUI for viewing weather via Open-Meteo"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = { file = "LICENSE" }
|
|
8
|
+
authors = [ { name = "Nick Ferguson", email = "nick.ferguson@ed.ac.uk" } ]
|
|
9
|
+
keywords = ["textual", "tui", "weather", "open-meteo", "terminal"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: End Users/Desktop",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Topic :: Utilities",
|
|
18
|
+
"Topic :: Terminals",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"httpx>=0.28.1",
|
|
22
|
+
"pycountry>=24.6.1",
|
|
23
|
+
"questionary>=2.1.1",
|
|
24
|
+
"textual>=3.1.0",
|
|
25
|
+
"typer>=0.21.1",
|
|
26
|
+
"wcwidth>=0.2.13",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
wevva = "wevva.cli:app"
|
|
31
|
+
|
|
32
|
+
[build-system]
|
|
33
|
+
requires = ["hatchling"]
|
|
34
|
+
build-backend = "hatchling.build"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.wheel]
|
|
37
|
+
packages = ["wevva"]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
include = ["wevva/**", "README.md", "LICENSE", "pyproject.toml"]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Wevva package."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from wevva.api import (
|
|
6
|
+
LocationNotFoundError,
|
|
7
|
+
WevvaAPIError,
|
|
8
|
+
forecast_by_coordinates,
|
|
9
|
+
forecast_by_coordinates_sync,
|
|
10
|
+
forecast_by_place,
|
|
11
|
+
forecast_by_place_sync,
|
|
12
|
+
geocode,
|
|
13
|
+
geocode_sync,
|
|
14
|
+
)
|
|
15
|
+
from wevva.location_metadata import LocationMetadata
|
|
16
|
+
from wevva.models import ForecastBundle
|
|
17
|
+
from wevva.openmeteo import (
|
|
18
|
+
CurrentOpenMeteoForecast,
|
|
19
|
+
DailyOpenMeteoForecast,
|
|
20
|
+
HourlyOpenMeteoForecast,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
CurrentForecast = CurrentOpenMeteoForecast
|
|
24
|
+
HourlyForecast = HourlyOpenMeteoForecast
|
|
25
|
+
DailyForecast = DailyOpenMeteoForecast
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"CurrentForecast",
|
|
29
|
+
"CurrentOpenMeteoForecast",
|
|
30
|
+
"DailyForecast",
|
|
31
|
+
"DailyOpenMeteoForecast",
|
|
32
|
+
"ForecastBundle",
|
|
33
|
+
"HourlyForecast",
|
|
34
|
+
"HourlyOpenMeteoForecast",
|
|
35
|
+
"LocationMetadata",
|
|
36
|
+
"LocationNotFoundError",
|
|
37
|
+
"WevvaAPIError",
|
|
38
|
+
"__version__",
|
|
39
|
+
"forecast_by_coordinates",
|
|
40
|
+
"forecast_by_coordinates_sync",
|
|
41
|
+
"forecast_by_place",
|
|
42
|
+
"forecast_by_place_sync",
|
|
43
|
+
"geocode",
|
|
44
|
+
"geocode_sync",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
__version__ = version("wevva")
|
|
49
|
+
except PackageNotFoundError:
|
|
50
|
+
__version__ = "0.0.0"
|