feat: add station contributor commands - #35
Conversation
Add `meteo station add/edit/delete/validate/duplicates/build` for maintaining the meteostat/weather-stations directory. The station schema is loaded from the upstream repository rather than bundled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It introduces custom Click group routing relying on framework internals and changes parse_datetime behavior for all time-series commands, so human review is warranted despite comprehensive tests.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
This PR adds a suite of contributor commands under meteo station (add, edit, delete, validate, duplicates, build) for maintaining the upstream weather-stations directory, while preserving the existing meteo station [ID] lookup. Routing is achieved with a custom Typer/Click group (StationGroup/LookupCommand) that dispatches to a hidden lookup command unless the first argument names a subcommand. Supporting logic lives in a new meteo/contrib/ package (repo access, schema validation, duplicate detection, SQLite build), and the schema is fetched once per run from the upstream repo. The PR also bumps the version to 0.4.0, adds contrib/providers extras and a stations_repo config key, and makes date-only end values span the full day in parse_datetime.
Changes:
- New contributor command group +
meteo/contrib/helpers (validation, duplicates, SQLite build, repo access) with extensive tests. parse_datetime(..., is_end=True)now returns end-of-day (time.max) for date-only inputs;stations_repoconfig key added (withcoerce_valuehandlingNonedefaults asstr).- Version bump to 0.4.0,
meteostat>=2.1.5, and newcontrib/providersoptional extras (plus lockfile updates).
| File | Description |
|---|---|
| meteo/cli.py | Registers the station subcommands and aliases station/s to the new group. |
| meteo/commands/station.py | Adds StationGroup/LookupCommand routing and extracts print_metadata. |
| meteo/commands/contrib/*.py | New add/edit/delete/validate/duplicates/build commands and shared helpers. |
| meteo/contrib/*.py | Repo access, schema validation/fixing, duplicate detection, SQLite database build. |
| meteo/config.py | Adds stations_repo key; coerces None-default keys as strings. |
| meteo/utils.py | parse_datetime end dates now run to end-of-day. |
| meteo/__init__.py / pyproject.toml / uv.lock | Version bump to 0.4.0 and new contrib/providers extras. |
| README.md | Documents the new extras and local development setup. |
| tests/* | Adds test_contrib.py, extends test_utils.py, and threads input through the invoke fixture. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Update output format to include distance conditionally. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Summary
meteo stationfor maintaining the weather-stations directory:add,edit,delete,validate,duplicates,build.meteo station [ID]still does station lookups.https://raw.githubusercontent.com/meteostat/weather-stations/refs/heads/main/schema.json(fetched once per run). This repo has no local copy, and the CLI doesn't read one from the stations checkout.contribextra (jsonschema,pycountry), aprovidersextra (metar,lxml), and astations_repoconfig key.parse_datetimenow makes date-only end values run to 23:59:59.meteostatto>=2.1.5.Notes
validate,edit,addandbuildneed network access to fetch the schema, and so do the contrib tests.Test plan
uv run pytest tests/test_contrib.py(56 passed)uv run ruff check meteo tests🤖 Generated with Claude Code