feat: Add Pirate Weather with full integration (#477, #481, #482, #483)#479
Merged
feat: Add Pirate Weather with full integration (#477, #481, #482, #483)#479
Conversation
Integrates Pirate Weather (Dark Sky-compatible API) as a selectable data source alongside NWS, Open-Meteo, and Visual Crossing. - New `PirateWeatherClient` with full unit support (us/si/ca/uk2), alert parsing, and 8-day daily/hourly forecasts - Adds `pirate_weather_api_key` to `AppSettings` with lazy keyring storage via `LazySecureStorage`; key survives portable-mode bundles - `WeatherClient` routes `data_source="pirateweather"` to the new client, falls back to "auto" when no key is configured - `ParallelFetchCoordinator` includes Pirate Weather in smart auto- source parallel gather; PW alerts preferred over VC for non-US - Settings dialog: new "Pirate Weather" choice + API key field with "Get Free API Key" button - `refresh_runtime_settings()` resets PW client on key change so new credentials take effect without app restart - 45 new unit/async/integration tests; all 2785 tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add pirateweather to all default source priority lists used by the auto/ fusion weather mode: - US priority: nws > openmeteo > visualcrossing > pirateweather - International priority: openmeteo > pirateweather > visualcrossing (PW ranked above VC internationally for WMO global alert coverage) Files changed: - config/source_priority.py: update SourcePriorityConfig defaults and from_dict fallbacks - models/config.py: update AppSettings field defaults, from_dict fallbacks, and _validate_setting fallbacks; valid_sources already included PW - weather_client_fusion.py: update merge_forecasts and merge_hourly_forecasts preferred_order lists - weather_client_base.py: update _fetch_smart_auto_source getattr fallbacks - ui/dialogs/settings_dialog.py: update priority selection maps to handle new 4-element US lists and 3-element intl lists; retain backward-compat with legacy 3/2-element configs from existing user installs PW alerts were already being merged in _fetch_smart_auto_source (preferred over VC for international, skipped for US alongside NWS). No alert aggregation changes needed. Tests: add tests/test_source_priority_pirateweather.py (23 tests covering SourcePriorityConfig defaults, AppSettings defaults, and fusion engine preferred_order for forecast/hourly/current). Update existing test_settings_dialog_source_priority.py to match new 4-element US lists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 18, 2026
- Add summary field to Forecast model - Parse daily.summary from Pirate Weather response - Display overall summary in forecast presentation - Add pragma: no cover for UI-only app.py lines - Add 46 tests for PW error paths, unit conversions, config validation, fusion integration, and forecast summary display
- Label VC field as 'Visual Crossing API Key:' instead of generic 'API Key:' - Label PW field as 'Pirate Weather API Key:' instead of generic 'API Key:' - Update PW signup link to direct registration page
- Auto mode: show both VC and PW key fields - Visual Crossing selected: show only VC key field - Pirate Weather selected: show only PW key field - NWS/Open-Meteo selected: hide both key fields - Dynamic update on source dropdown change
- Forecast order: overall summary → daily periods → hourly forecast - Add hourly_forecast_hours setting (1-68, default 6) - SpinCtrl in settings for user-configurable hourly count - Hourly data was already fetched (168h with extend=hourly), just display-capped
- Fallback text header: 'Next N Hours:' instead of hardcoded 'Next 6 Hours:' - HTML section: aria-label and heading reflect actual hour count - Reads hourly_forecast_hours setting in build_forecast scope
…tching (#481) - When forecast_days > 7 and source is NWS or PW, use Open-Meteo for full range - Remove NWS 7-day + Open-Meteo tail stitching logic from fusion engine - Open-Meteo supports up to 16 days, no API key needed - Update tests to reflect cleaner extended forecast behavior
…tup (#482) - Add PW API key step in onboarding wizard alongside VC - Update readiness summary with PW key status - Update portable setup hint to mention both VC and PW - Add pirate_weather_api_key to PORTABLE_API_SECRET_KEYS - Add/update tests for onboarding and portable flows
) - Parse PW minutely block for per-minute precip intensity/probability - Detect precipitation transitions (dry→wet, wet→dry) - Generate notifications: 'Rain starting in X minutes', 'Precipitation ending in X minutes' - Add settings: minutely_precip_alerts (on/off), minutely_precip_threshold_minutes - Wire into notification event manager with cooldown support - Screen reader friendly notification text - Add comprehensive tests
This was referenced Mar 18, 2026
- Remove second 'Pirate Weather API Configuration' block (from merge) - Consolidate to single pw_key control with proper label - Remove duplicate handler and duplicate load code
AVWX key is only relevant when fetching aviation weather, so it belongs in the aviation dialog where users actually need it — not buried in general settings.
Tests key against PW API with a known location (NYC). Reports success, invalid key, or rate limit status.
Raw PW API floats like 22.51 mph now display as whole numbers (23 mph) in daily and hourly forecast periods.
- 10 integration tests: current conditions, forecast, hourly, alerts, minutely precipitation, daily summary, error handling - Cassettes recorded for NYC, London, Tromsø (with active WMO alerts) - API key scrubbed from cassettes and auto-filtered on future recordings - PW API key added to GitHub secrets (PIRATE_WEATHER_API_KEY) - conftest: added pirate_weather_api_key fixture, norway_location fixture, and URI-based key scrubbing for PW path-based auth
- NWS: clarify 'forecast + alerts' - Open-Meteo: 'Global forecast, no alerts, no API key' - Visual Crossing: 'US/Canada/Europe alerts' not 'International' - Pirate Weather: 'worldwide alerts' to distinguish from VC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Pirate Weather as a fourth weather data source alongside NWS, Open-Meteo, and Visual Crossing, with comprehensive integration across the entire app.
Core Features
Pirate Weather Provider (#477)
Global WMO Alerts
Minutely Precipitation Notifications (#483)
Extended Forecast Cleanup (#481)
Onboarding and Portable Setup (#482)
UI Changes
Auto/Fusion Source Priority
Testing
Config Changes
Closes #477, closes #481, closes #482, closes #483