From d67b5a1c248b0c70ac7cd565472a9bf25757e4fc Mon Sep 17 00:00:00 2001 From: Brewster Malevich Date: Thu, 14 May 2026 15:01:44 -0700 Subject: [PATCH] Breaking change to signature Update `ProjectionTemplate` method signatures, renaming `d` to `ds` to make it consistent with the syle used in extraction. This is a breaking change. Best get it out of the way sooner rather than later. --- CHANGELOG.md | 1 + src/isku/project.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6132d6a..ba892b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - BREAKING: `isku.build_extraction_workflow` is now `isku.build_extraction_template`. - BREAKING: `isku.build_projection_workflow` is now `isku.build_projection_template`. - BREAKING: In `isku.extract_regions`, the `workflow` argument is now `template`. +- BREAKING: `isku.ProjectionTemplate` protocol methods `d` argument is now `ds` to make it consistent with extraction signatures. - Improved README. - Improved CONTRIBUTING. - Add project URLs to package metadata. diff --git a/src/isku/project.py b/src/isku/project.py index 624bb88..c2bbff3 100644 --- a/src/isku/project.py +++ b/src/isku/project.py @@ -20,19 +20,19 @@ class ProjectionTemplate(Protocol): build_projection_template: Build a projection template from simple functions. """ - def pre_project(self, d: xr.Dataset) -> xr.Dataset: + def pre_project(self, ds: xr.Dataset) -> xr.Dataset: """ Pre-process a dataset before projection """ ... - def project(self, d: xr.Dataset) -> xr.Dataset: + def project(self, ds: xr.Dataset) -> xr.Dataset: """ Create a projection from a dataset """ ... - def post_project(self, d: xr.Dataset) -> xr.Dataset: + def post_project(self, ds: xr.Dataset) -> xr.Dataset: """ Process a projected dataset """ @@ -70,7 +70,7 @@ def build_projection_template( ) -def project(d: xr.Dataset, *, model: ProjectionTemplate) -> xr.Dataset: +def project(ds: xr.Dataset, *, model: ProjectionTemplate) -> xr.Dataset: """ Project a dataset of predictors, 'd', with 'model' to return a projected dataset @@ -79,7 +79,7 @@ def project(d: xr.Dataset, *, model: ProjectionTemplate) -> xr.Dataset: build_projection_template: Build a projection template from simple functions. ProjectionTemplate: Technical ProjectionTemplate protocol. """ - preprocessed = model.pre_project(d) + preprocessed = model.pre_project(ds) projected = model.project(preprocessed) postprocessed = model.post_project(projected)