Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,15 +24,15 @@ repos:

# Python file formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6
rev: v0.14.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

# Snakemake file formatting
- repo: https://github.com/snakemake/snakefmt
rev: v0.10.2
rev: v0.11.2
hooks:
- id: snakefmt

Expand Down
27 changes: 19 additions & 8 deletions tests/integration/Snakefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
# 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."
message:
"Example of a rule external to your module."
output:
text_file = "results/module_powerplants/resources/user/user_message.md"
text_file="results/module_powerplants/resources/user/user_message.md",
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."""
)
file_path = Path(output.text_file)
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_powerplants:
snakefile: "../../workflow/Snakefile"
config: config["module_powerplants"]
prefix: "results/module_powerplants/"
snakefile:
"../../workflow/Snakefile"
config:
config["module_powerplants"]
prefix:
"results/module_powerplants/"


# rename all module rules with a prefix, to avoid naming conflicts.
use rule * from module_powerplants as module_powerplants_*


# Request something from the module
rule all:
message: "A generic test case for your module."
message:
"A generic test case for your module."
default_target: True
input:
"results/module_powerplants/results/combined_text.md"
"results/module_powerplants/results/combined_text.md",
Loading