A lightweight Python library for ingesting, validating, and summarising weather station data.
- Models –
WeatherReadingandWeatherSummarydataclasses with built-in validation - Statistics – mean, variance, std-dev, percentiles, anomaly detection
- Processor – load from JSON or CSV, filter by time range, produce aggregated summaries
- Zero dependencies – pure Python standard library
from datetime import datetime
from pyweather import WeatherReading, WeatherProcessor
proc = WeatherProcessor(station_id="NYC01")
proc.load_from_json(open("data.json").read())
summary = proc.summarise()
print(summary.avg_temperature_c) # 21.4
print(summary.total_precipitation_mm)The pipeline is defined in .github/workflows/ci.yml and consists of five jobs:
| Job | Trigger | Purpose |
|---|---|---|
| lint | every push/PR | Ruff linter + formatter + mypy type-check |
| test | after lint | pytest on Python 3.10/3.11/3.12 × ubuntu/windows/macos |
| security | after lint | pip-audit CVE scan + trufflehog secret scan |
| build | after test + security | Build wheel + sdist, validate metadata |
| publish | on GitHub Release | Publish to PyPI via trusted publishing |
A separate nightly workflow runs performance benchmarks at 02:00 UTC.
git clone https://github.com/your-org/pyweather.git
cd pyweather
pip install -e ".[dev]"
pytest
ruff check src/ tests/
mypy src/pyweather/MIT