Skip to content

Use snakemake message: attribute to document rules #1844

@willu47

Description

@willu47

Describe the feature you'd like to see

Snakemake provides a message attribute which can be used in rules to provide a user-friendly read-out to the console, including wildcards

rule NAME:
    input: "path/to/inputfile", "path/to/other/inputfile"
    output: "path/to/outputfile", "path/to/another/outputfile"
    threads: 8
    message: "Executing somecommand with {threads} threads on the following files {input}."
    shell: "somecommand --threads {threads} {input} {output}"

PyPSA-Eur has around 60 rules, and only three or four of them use messages.

Messages provide a useful way of documenting the purpose of rules, and explaining at run-time what is going on. I think adding messages to each rule would help new users of PyPSA-Eur, and also aid with debugging the snakemake workflow.

Pull request open-energy-transition#55 already includes many of the rule messages needed, so implementing this is just a matter of copy-pasting the relevant lines into the snakemake rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions