Metadata-Version: 2.5
Name: action0-open-meteo-api
Version: 0.1.0
Summary: Fully typed Open-Meteo API clients built on action0-client — sync, async or Twisted, decided by the backend you plug in; generated from the official OpenAPI schemas
Project-URL: Homepage, https://github.com/LaughInJar/action0-open-meteo-api
Project-URL: Documentation, https://laughinjar.github.io/action0-open-meteo-api/
Project-URL: Source, https://github.com/LaughInJar/action0-open-meteo-api
Project-URL: Issues, https://github.com/LaughInJar/action0-open-meteo-api/issues
Author: Simon Lachinger
License-Expression: MIT
License-File: LICENSE
Keywords: api,async,client,forecast,http,open-meteo,sync,twisted,typed,weather
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: action0-client>=0.1.0
Requires-Dist: action0-req>=0.1.1
Requires-Dist: action0-url>=0.1.0
Provides-Extra: aiohttp
Requires-Dist: action0-client[aiohttp]; extra == 'aiohttp'
Provides-Extra: all
Requires-Dist: action0-client[all]; extra == 'all'
Provides-Extra: httpx
Requires-Dist: action0-client[httpx]; extra == 'httpx'
Provides-Extra: requests
Requires-Dist: action0-client[requests]; extra == 'requests'
Provides-Extra: twisted
Requires-Dist: action0-client[twisted]; extra == 'twisted'
Provides-Extra: urllib3
Requires-Dist: action0-client[urllib3]; extra == 'urllib3'
Description-Content-Type: text/markdown

# action0-open-meteo-api

Fully typed Python clients for the [Open-Meteo](https://open-meteo.com/)
weather APIs, built on
[action0-client](https://laughinjar.github.io/action0-client/): every
endpoint is a typed operation dataclass that runs synchronously, on
asyncio or on Twisted — the backend you plug in decides, and the static
types follow along.

The code is **generated** from Open-Meteo's official OpenAPI schemas by
[action0-client-openapi](https://laughinjar.github.io/action0-client-openapi/)
and checked in — this project doubles as the worked real-world example
of that generator (see [How this library was
generated](https://laughinjar.github.io/action0-open-meteo-api/usage/generation.html)).

```shell
uv add "action0-open-meteo-api[httpx]"
```

```python
from action0.open_meteo.forecast import ForecastClient, GetV1Forecast, GetV1ForecastHourlyItem

from action0.client.backends.requests import RequestsBackend

client = ForecastClient(RequestsBackend())  # https://api.open-meteo.com
weather = client.send(
    GetV1Forecast(
        latitude="48.21",
        longitude="16.37",
        hourly=[GetV1ForecastHourlyItem.TEMPERATURE_2M, GetV1ForecastHourlyItem.RAIN],
        forecast_days=1,
    )
)
print(weather.hourly.temperature_2m)  # [17.2, 16.8, ...]

from action0.client.backends.httpx import AsyncHttpxBackend

client = ForecastClient(AsyncHttpxBackend())
weather = await client.send(GetV1Forecast(latitude="48.21", longitude="16.37"))
```

One subpackage per Open-Meteo service, each client preset to its base
URL:

| Subpackage (`action0.open_meteo.`...) | Client | API |
|---|---|---|
| `forecast` | `ForecastClient` | api.open-meteo.com — weather forecasts |
| `historical_weather` | `HistoricalWeatherClient` | archive-api.open-meteo.com — 1940 → today |
| `air_quality` | `AirQualityClient` | air-quality-api.open-meteo.com |
| `marine` | `MarineClient` | marine-api.open-meteo.com — waves & swell |
| `ensemble` | `EnsembleClient` | ensemble-api.open-meteo.com — ensemble members |
| `seasonal` | `SeasonalClient` | seasonal-api.open-meteo.com — up to 9 months |
| `climate` | `ClimateClient` | climate-api.open-meteo.com — climate change projections |
| `flood` | `FloodClient` | flood-api.open-meteo.com — river discharge |
| `elevation` | `ElevationClient` | api.open-meteo.com/v1/elevation |
| `geocoding` | `GeocodingClient` | geocoding-api.open-meteo.com — place name → coordinates |

Enumerable request parameters are generated enums (IDE completion knows
the legal weather variables), dates are `datetime.date`, and every JSON
answer parses into plain typed dataclasses — mypy strict, pyright and ty
pass on the generated code. Even the error path is typed: Open-Meteo's
documented 400 answer raises a generated `BadRequestError` carrying the
parsed `reason`. The Open-Meteo APIs are free for
non-commercial use without an API key ([terms](https://open-meteo.com/en/terms));
commercial subscriptions pass their key as the operations' `apikey`
field.

Requires Python 3.11 or newer.

Full documentation including the API reference:
<https://laughinjar.github.io/action0-open-meteo-api/>

## Development

Uses [uv](https://docs.astral.sh/uv/): `uv run pytest` runs the tests,
`uv run ruff format && uv run ruff check` formats and lints, `uv run
mypy`, `uv run pyright` and `uv run ty check` type-check (all strict —
on the generated code too). The generated subpackages under
`src/action0/open_meteo/` are regenerated from the schemas in
`schemas/` with `bash tools/regenerate.sh` — never edited by hand.

## AI disclosure

This library was developed with substantial help from Claude (Anthropic),
under human direction and review. The client code itself is generated by
[action0-client-openapi](https://github.com/LaughInJar/action0-client-openapi)
from Open-Meteo's OpenAPI schemas.

## License

MIT — see [LICENSE](LICENSE). Open-Meteo data and APIs are subject to
[Open-Meteo's terms](https://open-meteo.com/en/terms) (CC BY 4.0
attribution).
