Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/template-pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
continue-on-error: true
- name: Run snakemake linting
id: linting
run: pixi run snakemake --lint
run: |
pixi run snakemake --lint --snakefile workflow/Snakefile
pixi run snakemake --lint --snakefile tests/integration/Snakefile
continue-on-error: true
- name: Save integration logs
if: ${{ always() }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ We recommend using [`pixi`](https://pixi.sh/) as your package manager. Once inst

## Features

- Standardised layout compliant with the [snakemake workflow catalogue's](https://snakemake.github.io/snakemake-workflow-catalog/#) listing requirements.
- Standardised layout compliant with the [snakemake workflow catalogue's](https://snakemake.github.io/snakemake-workflow-catalog/#) listing requirements, enabling them to be automatically included in their listings once published. Read more about those requirements [here](https://snakemake.github.io/snakemake-workflow-catalog/docs/catalog.html#standardized-usage-workflows).
- Standardised input/output structure across modules:
- `resources/`: files needed for the module's processes.
- `user/`: files that should be provided by users. Document them well!
- `automatic/`: files that the module downloads or prepares in intermediate steps.
Expand All @@ -56,7 +57,6 @@ We recommend using [`pixi`](https://pixi.sh/) as your package manager. Once inst
- Continuous Integration (CI) settings, ready for [pre-commit.ci](https://pre-commit.ci/).
- GitHub actions to automate chores during pull requests and releases.
- Premade `pytest` setup.
- Documentation setup, ready for [Read the Docs](https://about.readthedocs.com/) or [Github Pages](https://pages.github.com/).

> [!IMPORTANT]
>
Expand Down
3 changes: 1 addition & 2 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ _skip_if_exists:
- AUTHORS
- CITATION.cff
- INTERFACE.yaml
- mkdocs.yaml
- pixi.toml
# Special cases: these files should not be user-modified, even though they are in user-modifiable directories
- "!config/README.md"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should README.md state explicitly that it is auto-generated and should not be modified?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure...
I did modify the README a bit in the geoboundaries and hydropower modules (an example image of the module results and a brief summary of steps). I guess these should go in the documentation instead... perhaps specify that these should have minimal changes to enable some flexibility?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - I suggest to park this for now, revisit when finalising documentation

- "!tests/clio_test.py"
_templates_suffix: .jinja
Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[mypy]
disable_error_code = import-untyped
exclude = (^|/)\.(snakemake|pixi)(/|$)
3 changes: 3 additions & 0 deletions template/.gitignore.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
__pycache__
*.pyc

### Environments
.pixi/

### Snakemake
.snakemake/
gurobi.log
Expand Down
19 changes: 0 additions & 19 deletions template/.readthedocs.yaml

This file was deleted.

67 changes: 0 additions & 67 deletions template/mkdocs.yaml.jinja

This file was deleted.

1 change: 1 addition & 0 deletions template/mypy.ini.jinja
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[mypy]
disable_error_code = import-untyped
exclude = (^|/)\.(snakemake|pixi)(/|$)
14 changes: 1 addition & 13 deletions template/pixi.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ clio-tools = ">=2025.03.03"
conda = ">=25.0.0"
ipdb = ">=0.13.13"
ipykernel = ">=6.29.5"
jsonschema = ">=4.0.0"
mypy = ">=1.15.0"
pytest = ">=8.3.5"
python = ">=3.12"
Expand All @@ -22,16 +23,3 @@ snakemake-minimal = ">=8.29.0"

[tasks]
test-integration = {cmd = "pytest tests/clio_test.py"}

[feature.docs.dependencies]
mkdocs-material = ">=9.6.7"

[feature.docs.pypi-dependencies]
mkdocs-mermaid2-plugin = ">=1.2.1"

[feature.docs.tasks]
serve-docs = {cmd = "mkdocs serve"}
build-docs = {cmd = "mkdocs build"}

[environments]
docs = ["docs"]
4 changes: 2 additions & 2 deletions template/tests/clio_test.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def test_standard_file_existance(module_path, file):
def test_snakemake_all_failure(module_path):
"""The snakemake 'all' rule should return an error by default."""
process = subprocess.run(
"snakemake --cores 4", shell=True, cwd=module_path, capture_output=True
"snakemake --cores 1", shell=True, cwd=module_path, capture_output=True
)
assert "INVALID (missing locally)" in str(process.stderr)


def test_snakemake_integration_testing(module_path):
"""Run a light-weight test simulating someone using this module."""
assert subprocess.run(
"snakemake --use-conda --cores 4",
"snakemake --use-conda --cores 1",
shell=True,
check=True,
cwd=module_path / "tests/integration",
Expand Down
4 changes: 4 additions & 0 deletions template/workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ with open(workflow.source_path("internal/settings.yaml"), "r") as f:
include: "rules/automatic.smk"
include: "rules/dummy.smk"

# Add additional files to be delivered alongside the workflow here.
Comment thread
irm-codebase marked this conversation as resolved.
# This is needed e.g. for python code files that are never
# explicitly used as a script or input in a snakemake rule.
# e.g.: workflow.source_path("scripts/_utils.py")

rule all:
message:
Expand Down
5 changes: 0 additions & 5 deletions tests/template_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ def pixi_built(template_project):
return template_project


def test_mkdocs_build(pixi_built):
"""The template's mkdocs should build without issues."""
assert subprocess.run("pixi run build-docs", shell=True, check=True, cwd=pixi_built)


def test_pytest(pixi_built):
"""The template's tests should pass by default."""
assert subprocess.run(
Expand Down
Loading