Skip to content

feat: add station contributor commands - #35

Merged
clampr merged 3 commits into
mainfrom
feat/station-contrib-commands
Oct 2, 2026
Merged

clampr merged 3 commits into
mainfrom
feat/station-contrib-commands

Conversation

@clampr

@clampr clampr commented Oct 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds contributor commands under meteo station for maintaining the weather-stations directory: add, edit, delete, validate, duplicates, build. meteo station [ID] still does station lookups.
  • The station schema is loaded only from 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.
  • New contrib extra (jsonschema, pycountry), a providers extra (metar, lxml), and a stations_repo config key.
  • parse_datetime now makes date-only end values run to 23:59:59.
  • Bumps the version to 0.4.0 and meteostat to >=2.1.5.

Notes

  • validate, edit, add and build need 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

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>
@clampr
clampr requested a balanced review from Copilot October 1, 2026 16:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

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_repo config key added (with coerce_value handling None defaults as str).
  • Version bump to 0.4.0, meteostat>=2.1.5, and new contrib/providers optional 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.

Comment thread meteo/commands/contrib/add.py
Update output format to include distance conditionally.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@clampr
clampr merged commit c4a24eb into main Oct 2, 2026
4 checks passed
@clampr
clampr deleted the feat/station-contrib-commands branch October 2, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants