From bb85835aecd78445ea0c30bfb39cd98756fe8684 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:42:06 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.4 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.4...v0.15.9) - [github.com/snakemake/snakefmt: v0.11.4 → v1.0.0](https://github.com/snakemake/snakefmt/compare/v0.11.4...v1.0.0) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.2](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.2) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d42af35..de68f35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: # Python file formatting - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.4 + rev: v0.15.9 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -33,13 +33,13 @@ repos: # Snakemake file formatting - repo: https://github.com/snakemake/snakefmt - rev: v0.11.4 + rev: v1.0.0 hooks: - id: snakefmt # Spelling - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.2 hooks: - id: codespell files: .*\.(py|smk|md)$|^Snakefile$ From 96534f1d517ad9a2112cd47e7fd6e722f936e3c0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:43:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/integration/Snakefile | 12 +++++------ workflow/Snakefile | 4 ++-- workflow/rules/automatic.smk | 42 ++++++++++++++++++------------------ workflow/rules/build.smk | 8 +++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/integration/Snakefile b/tests/integration/Snakefile index 429ec92..408c8b0 100644 --- a/tests/integration/Snakefile +++ b/tests/integration/Snakefile @@ -7,10 +7,6 @@ configfile: workflow.source_path("./test_config.yaml") # `config`: specifies the module configuration. # `pathvars:` helps you re-wire where the module places files. module module_geo_boundaries: - snakefile: - "../../workflow/Snakefile" - config: - config["module_geo_boundaries"] pathvars: # Redirect specific module results (outputs) shapes="results/outputs/shapes.parquet", @@ -18,6 +14,10 @@ module module_geo_boundaries: logs="resources/geo_boundaries/logs", resources="resources/geo_boundaries/resources", results="resources/geo_boundaries/results", + snakefile: + "../../workflow/Snakefile" + config: + config["module_geo_boundaries"] # Add a prefix to all module rules, to avoid naming conflicts. @@ -26,8 +26,8 @@ use rule * from module_geo_boundaries as geo_boundaries_module_* # Request something from the module rule all: - message: - "A generic test case for this module." default_target: True input: "results/outputs/shapes.parquet", + message: + "A generic test case for this module." diff --git a/workflow/Snakefile b/workflow/Snakefile index e890fba..dfb4785 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -35,8 +35,6 @@ workflow.source_path("scripts/_schemas.py") rule all: - message: - "ERROR: Invalid `rule all:` call" default_target: True output: "INVALID", @@ -44,5 +42,7 @@ rule all: stderr="/all.stderr", conda: "envs/shell.yaml" + message: + "ERROR: Invalid `rule all:` call" shell: 'echo "This workflow must be called as a snakemake module." > {log.stderr}' diff --git a/workflow/rules/automatic.smk b/workflow/rules/automatic.smk index 4e744b9..c4045df 100644 --- a/workflow/rules/automatic.smk +++ b/workflow/rules/automatic.smk @@ -5,23 +5,21 @@ Small transformations might be performed to make the data easier to work with. rule download_country_overture: - message: - "Download '{wildcards.country}_{wildcards.subtype}' dataset from Overture Maps." - params: - version=config["overture_release"], output: path="/automatic/countries/overture_{country}_{subtype}.parquet", log: "/{country}/download_country_overture_{subtype}.log", conda: "../envs/shape.yaml" + params: + version=config["overture_release"], + message: + "Download '{wildcards.country}_{wildcards.subtype}' dataset from Overture Maps." script: "../scripts/download_country_overture.py" rule download_country_gadm: - message: - "Download '{wildcards.country}_{wildcards.subtype}' dataset from GADM." output: path=temp( "/automatic/countries/raw_gadm_{country}_{subtype}.parquet" @@ -30,16 +28,13 @@ rule download_country_gadm: "/{country}/download_country_gadm_{subtype}.log", conda: "../envs/shape.yaml" + message: + "Download '{wildcards.country}_{wildcards.subtype}' dataset from GADM." script: "../scripts/download_country_gadm.py" rule standardise_country_gadm: - message: - "Standardise '{wildcards.country}_{wildcards.subtype}' GADM dataset." - params: - country_id=lambda wc: str(wc.country), - subtype=lambda wc: str(wc.subtype), input: raw="/automatic/countries/raw_gadm_{country}_{subtype}.parquet", output: @@ -48,30 +43,31 @@ rule standardise_country_gadm: "/{country}/standardise_country_gadm_{subtype}.log", conda: "../envs/shape.yaml" + params: + country_id=lambda wc: str(wc.country), + subtype=lambda wc: str(wc.subtype), + message: + "Standardise '{wildcards.country}_{wildcards.subtype}' GADM dataset." script: "../scripts/standardise_country_gadm.py" rule download_nuts: - message: - "Download '{wildcards.resolution}_{wildcards.year}_{wildcards.level}' from NUTS." - params: - epsg=internal["nuts"]["epsg"], output: path="/automatic/nuts/nuts_{resolution}_{year}_{level}.parquet", log: "/download_nuts_{resolution}_{year}_{level}.log", conda: "../envs/shape.yaml" + params: + epsg=internal["nuts"]["epsg"], + message: + "Download '{wildcards.resolution}_{wildcards.year}_{wildcards.level}' from NUTS." script: "../scripts/download_nuts.py" rule standardise_country_nuts: - message: - "Standardise '{wildcards.country}_{wildcards.subtype}' NUTS dataset." - params: - year=lambda wc: config["countries"][wc.country]["year"], input: raw=lambda wc: f"/automatic/nuts/nuts_{config["countries"][wc.country]["resolution"]}_{config["countries"][wc.country]["year"]}_{wc.subtype}.parquet", output: @@ -80,13 +76,15 @@ rule standardise_country_nuts: "/{country}/standardise_country_nuts_{subtype}.log", conda: "../envs/shape.yaml" + params: + year=lambda wc: config["countries"][wc.country]["year"], + message: + "Standardise '{wildcards.country}_{wildcards.subtype}' NUTS dataset." script: "../scripts/standardise_country_nuts.py" rule download_marine_eez_area: - message: - "Download and standardise '{wildcards.country}' EEZ dataset." output: path="/automatic/eez/{country}.parquet", plot="/automatic/eez/{country}.png", @@ -94,5 +92,7 @@ rule download_marine_eez_area: "/{country}/download_marine_eez_area.log", conda: "../envs/shape.yaml" + message: + "Download and standardise '{wildcards.country}' EEZ dataset." script: "../scripts/download_marine_eez_area.py" diff --git a/workflow/rules/build.smk b/workflow/rules/build.smk index a545d38..c5dac70 100644 --- a/workflow/rules/build.smk +++ b/workflow/rules/build.smk @@ -2,10 +2,6 @@ rule build_combined_area: - message: - "Combine land and marine polygons." - params: - crs=config["crs"], input: countries=[ f"/automatic/countries/{data['source']}_{country}_{data['subtype']}.parquet" @@ -26,5 +22,9 @@ rule build_combined_area: "/build_combined_area.log", conda: "../envs/shape.yaml" + params: + crs=config["crs"], + message: + "Combine land and marine polygons." script: "../scripts/build_combined_area.py"