From b7c0962d6ce9cec73b36ab79d85f6ed8cfe66bb1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:44:25 +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/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.16.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.6...v0.16.1) - [github.com/snakemake/snakefmt: v0.10.2 → v2.0.3](https://github.com/snakemake/snakefmt/compare/v0.10.2...v2.0.3) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.3) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c29fc99..3742e4b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_language_version: repos: # Generic 'file quality' testing - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: # Machine-friendliness - id: trailing-whitespace @@ -24,7 +24,7 @@ repos: # Python file formatting - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.6 + rev: v0.16.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -32,13 +32,13 @@ repos: # Snakemake file formatting - repo: https://github.com/snakemake/snakefmt - rev: v0.10.2 + rev: v2.0.3 hooks: - id: snakefmt # Spelling - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell files: .*\.(py|smk|md)$|^Snakefile$ From f9daf54abf2d2e08dd94850452053f677ebe6dfd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:44:49 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- README.md | 2 +- mkdocs.yaml | 2 +- tests/integration/Snakefile | 27 +++++++++++++++++++-------- workflow/Snakefile | 5 +++-- workflow/internal/config.schema.yaml | 2 +- workflow/rules/automatic.smk | 8 ++++---- workflow/rules/dummy.smk | 8 ++++---- workflow/scripts/download_cutout.py | 1 - 8 files changed, 33 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8545c1c..d63c4d0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# PV and wind area potentials and capacity factors +# PV and wind area potentials and capacity factors This data module produces area potentials and capacity factors for PV and wind at arbitrary spatial resolution. diff --git a/mkdocs.yaml b/mkdocs.yaml index 61fa02a..6eaf66d 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -1,6 +1,6 @@ # yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json -site_name: PV and wind area potentials and capacity factors +site_name: PV and wind area potentials and capacity factors site_url: https://module_pv_wind.readthedocs.io/ repo_name: module_pv_wind repo_url: https://github.com/calliope-project/module_pv_wind/ diff --git a/tests/integration/Snakefile b/tests/integration/Snakefile index b1c1869..23b3fa2 100644 --- a/tests/integration/Snakefile +++ b/tests/integration/Snakefile @@ -1,15 +1,19 @@ # Emulate a user configuring the module. configfile: workflow.source_path("./test_config.yaml") + # Emulate how another workflow might create inputs for this module. rule create_external_input: - message: "Example of a rule external to your module." output: - text_file = "results/module_pv_wind/resources/user/user_message.md" + text_file="results/module_pv_wind/resources/user/user_message.md", + message: + "Example of a rule external to your module." run: from pathlib import Path from textwrap import dedent - text = dedent("""Modular workflows can be used by more than one project! + + text = dedent( + """Modular workflows can be used by more than one project! For example, this text comes from a file external to the module. Try your best to make this workflow reusable so that others may benefit from your methods.""" ) @@ -17,20 +21,27 @@ rule create_external_input: with file_path.open("w") as f: f.write(text) + # Import the module and configure it. # `snakefile:` specifies the module. It can use file paths and special github(...) / gitlab(...) markers # `prefix:` re-routes all input/output paths of the module, helping to avoid file conflicts. module module_pv_wind: - snakefile: "../../workflow/Snakefile" - config: config["module_pv_wind"] - prefix: "results/module_pv_wind/" + snakefile: + "../../workflow/Snakefile" + config: + config["module_pv_wind"] + prefix: + "results/module_pv_wind/" + # rename all module rules with a prefix, to avoid naming conflicts. use rule * from module_pv_wind as module_pv_wind_* + # Request something from the module rule all: - message: "A generic test case for your module." default_target: True input: - "results/module_pv_wind/results/combined_text.md" + "results/module_pv_wind/results/combined_text.md", + message: + "A generic test case for your module." diff --git a/workflow/Snakefile b/workflow/Snakefile index fe03d49..207e628 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -21,9 +21,8 @@ with open(workflow.source_path("internal/settings.yaml"), "r") as f: include: "rules/automatic.smk" include: "rules/dummy.smk" + rule all: - message: - "ERROR: Invalid `rule all:` call" default_target: True output: "INVALID", @@ -31,5 +30,7 @@ rule all: stderr="logs/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/internal/config.schema.yaml b/workflow/internal/config.schema.yaml index 2bf094d..2dfb1ec 100644 --- a/workflow/internal/config.schema.yaml +++ b/workflow/internal/config.schema.yaml @@ -38,4 +38,4 @@ properties: type: string enum: - left - - right \ No newline at end of file + - right diff --git a/workflow/rules/automatic.smk b/workflow/rules/automatic.smk index 0ebb236..6274bb3 100644 --- a/workflow/rules/automatic.smk +++ b/workflow/rules/automatic.smk @@ -2,15 +2,15 @@ rule dummy_download: - message: - "Download the clio README file." - params: - url=internal["resources"]["automatic"]["dummy_readme"], output: readme="resources/automatic/dummy_readme.md", log: "logs/dummy_download.log", conda: "../envs/shell.yaml" + params: + url=internal["resources"]["automatic"]["dummy_readme"], + message: + "Download the clio README file." shell: 'curl -sSLo {output.readme} "{params.url}"' diff --git a/workflow/rules/dummy.smk b/workflow/rules/dummy.smk index af09f22..730cd2c 100644 --- a/workflow/rules/dummy.smk +++ b/workflow/rules/dummy.smk @@ -1,8 +1,4 @@ rule dummy_add_text: - message: - "Dummy rule combining user inputs and automatic downloads." - params: - config_text=config["dummy_text"], input: user_file="resources/user/user_message.md", readme="resources/automatic/dummy_readme.md", @@ -12,5 +8,9 @@ rule dummy_add_text: "logs/dummy_add_text.log", conda: "../envs/shell.yaml" + params: + config_text=config["dummy_text"], + message: + "Dummy rule combining user inputs and automatic downloads." script: "../scripts/dummy_script.py" diff --git a/workflow/scripts/download_cutout.py b/workflow/scripts/download_cutout.py index 6d3ebcd..32cb784 100644 --- a/workflow/scripts/download_cutout.py +++ b/workflow/scripts/download_cutout.py @@ -1,7 +1,6 @@ import atlite import pandas as pd - if __name__ == "__main__": cutout_params = snakemake.config["build_cutout"]["cutout_params"]