Skip to content

Reorganize into a multi-domain toolkit (geo, storage, weather) - #1

Merged
gmermoud merged 4 commits into
mainfrom
feat/topical-toolkit
Jul 13, 2026
Merged

Reorganize into a multi-domain toolkit (geo, storage, weather)#1
gmermoud merged 4 commits into
mainfrom
feat/topical-toolkit

Conversation

@gmermoud

Copy link
Copy Markdown
Contributor

Turns simlab-tools into a proper shared tooling repo used across SIM lab projects, extracting reusable utilities from pIserables.

What changed

  • Topical subpackages, each with heavy deps behind an optional extra:
    • storage/ — S3 transfer helpers (moved from top-level s3.py).
    • geo/swisstopo API client, raster IO, terrain slope/mask, shared types.
    • weather/ — documented placeholder for observation + forecast loaders (no loaders yet).
    • logging, smoothing — generic context-aware logging and 1D curve smoothers.
  • get_s3_client reconciled: key_id/key_secret now optional, falling back to S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY. Fixes the drift where callers used the one-arg form. Top-level from simlab_tools import get_s3_client still works (resolved lazily).
  • terrain reimplements slope gradients on numpy.gradient, dropping the torch dependency.
  • Packaging: extras storage/geo/smoothing/weather/all/dev; moto/pytest moved out of runtime deps; ruff config added; uv.lock regenerated.
  • Tests + CI: suites for raster, terrain, swisstopo (mocked HTTP), smoothing, logging, and get_s3_client; new GitHub Actions workflow runs ruff + pytest on Python 3.11 and 3.12.

Verification

ruff check clean and 59 tests pass in a fresh 3.12 venv (uv pip install -e ".[dev]").

Note

The companion pIserables PR (which consumes this via the git dependency) should be merged after this one.

gmermoud added 3 commits July 13, 2026 10:19
Restructure the package into storage/, geo/, weather/, logging and
smoothing modules, each with heavy dependencies behind an optional
extra (storage, geo, smoothing). Extract geodata utilities (swisstopo
API client, raster handling, terrain analysis) and generic helpers
(context-aware logging, 1D smoothers) so they can be shared across
projects. Terrain slope computation is reimplemented on numpy.gradient
to drop the torch dependency.

Reconcile get_s3_client to accept optional credentials that fall back
to the S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY environment variables,
and keep the historical top-level exports resolvable lazily via PEP 562.
Cover raster IO, terrain slopes/masks, the swisstopo client (mocked
HTTP), 1D smoothers and context-aware logging, and add get_s3_client
credential and backwards-compatibility tests. Run ruff and pytest on
Python 3.11 and 3.12 via GitHub Actions.
@gmermoud
gmermoud merged commit fd8d72e into main Jul 13, 2026
2 checks passed
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.

1 participant