From 1ef180bc79c6ec7b14313a3e00cd4273f48c425c Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 12:02:45 +0200 Subject: [PATCH 1/8] Add copier template for modules. --- .gitignore | 1 - modules/_copier_template/copier.yaml | 28 +++++++++++++++ .../{{module_name}}/AUTHORS.md | 10 ++++++ .../_copier_template/{{module_name}}/LICENSE | 21 +++++++++++ .../{{module_name}}/README.md | 34 ++++++++++++++++++ .../{{module_name}}/config/default.yaml | 5 +++ .../{{module_name}}/rulegraph.png | Bin 0 -> 7967 bytes .../{{module_name}}/workflow/Snakefile | 23 ++++++++++++ .../{{module_name}}/workflow/envs/shell.yaml | 7 ++++ .../workflow/internal/internal_config.yaml | 3 ++ .../workflow/profiles/default/config.yaml | 5 +++ .../workflow/report/report.rst | 1 + .../workflow/rules/downloads.smk | 1 + .../workflow/schemas/config.schema.yaml | 18 ++++++++++ .../{{module_name}}/workflow/scripts/.gitkeep | 0 modules/_template/README.md | 2 +- modules/_template/workflow/report/README.md | 3 ++ 17 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 modules/_copier_template/copier.yaml create mode 100644 modules/_copier_template/{{module_name}}/AUTHORS.md create mode 100644 modules/_copier_template/{{module_name}}/LICENSE create mode 100644 modules/_copier_template/{{module_name}}/README.md create mode 100644 modules/_copier_template/{{module_name}}/config/default.yaml create mode 100644 modules/_copier_template/{{module_name}}/rulegraph.png create mode 100644 modules/_copier_template/{{module_name}}/workflow/Snakefile create mode 100644 modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml create mode 100644 modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml create mode 100644 modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml create mode 100644 modules/_copier_template/{{module_name}}/workflow/report/report.rst create mode 100644 modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk create mode 100644 modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml create mode 100644 modules/_copier_template/{{module_name}}/workflow/scripts/.gitkeep create mode 100644 modules/_template/workflow/report/README.md diff --git a/.gitignore b/.gitignore index 4570d7f..0d8d9ff 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,5 @@ out/ output/ tmp/ results/ -report/ !modules/_example_module/** diff --git a/modules/_copier_template/copier.yaml b/modules/_copier_template/copier.yaml new file mode 100644 index 0000000..49d2daa --- /dev/null +++ b/modules/_copier_template/copier.yaml @@ -0,0 +1,28 @@ +module_name: + type: str + help: What is your module's name? + placeholder: transport_road + validator: >- + {% if not (module_name | regex_search('^[a-z][a-z0-9\-_]+$')) %} + "'module_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + {% endif %} +module_description: + type: str + help: Please give a brief sentence describing your module. + placeholder: A module to estimate energy demand of road vehicles at a subnational level. +author_name: + type: str + help: We auto-generate an MIT license for you. Please provide your full name. + placeholder: Laura Patricia Orellana +author_institution: + type: str + help: We auto-generate an MIT license for you. Please provide the name of your instutition." + placeholder: TU Delft +author_email: + type: str + help: We auto-generate an MIT license for you. Please provide an email address. + placeholder: yourname@university.edu + validator: >- + {% if not (email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} + "This email does not seem valid... did you forget to add a dot?" + {% endif %} diff --git a/modules/_copier_template/{{module_name}}/AUTHORS.md b/modules/_copier_template/{{module_name}}/AUTHORS.md new file mode 100644 index 0000000..db49f13 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/AUTHORS.md @@ -0,0 +1,10 @@ +# Authors + +This is the list of contributors to the '{{module_name}}' module for copyright purposes. + +- {{author_name}}, {{author_institution}} <{{author_email}}> + +This does not necessarily list everyone who has contributed to the '{{module_name}}' module code or documentation. +For a full contributor list, see: + + diff --git a/modules/_copier_template/{{module_name}}/LICENSE b/modules/_copier_template/{{module_name}}/LICENSE new file mode 100644 index 0000000..b1cb50c --- /dev/null +++ b/modules/_copier_template/{{module_name}}/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024, AUTHORS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/modules/_copier_template/{{module_name}}/README.md b/modules/_copier_template/{{module_name}}/README.md new file mode 100644 index 0000000..212fe51 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/README.md @@ -0,0 +1,34 @@ +# Easy Energy Modules - {{module_name}} + +{{module_description}} + +## Input-Ouput + +Here is a brief IO diagram of the module's operation. + +```mermaid +--- +title: {{module_name}} +--- +flowchart LR + D1[("`**Databases** + database1 + ... + `")] --> |Download| M + C1[/"`**User input** + shapefile.geojson + ... + `"/] --> |Resources| M(({{module_name}})) + M --> O1(" + output1.csv + ") + M --> O2(" + output2.nc + ") +``` + +## DAG + +Here is a brief example of the module's steps. + +![DAG](rulegraph.png) diff --git a/modules/_copier_template/{{module_name}}/config/default.yaml b/modules/_copier_template/{{module_name}}/config/default.yaml new file mode 100644 index 0000000..cd90385 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/config/default.yaml @@ -0,0 +1,5 @@ +# Module input files by users go here. +resources: + download: True + shapefile: "resources/shapefile.geojson" +# Any other user configuration goes below diff --git a/modules/_copier_template/{{module_name}}/rulegraph.png b/modules/_copier_template/{{module_name}}/rulegraph.png new file mode 100644 index 0000000000000000000000000000000000000000..88b3eb175fecd788eedf5546f23ba7ebabaf6a1c GIT binary patch literal 7967 zcmb{1cTiJbn+NdFs|W(piz0|LBSis`BB6s6=}meM1nIr~fY3VxlrBvK6r_Y2q$vp^ z(rZ8@^cq^I8{e|;?(FQmGdnxE$z;wy=bn3$=lPuPjnjFda)XkU5&!_)P*Vlz0RRLv z`0sDXN%5Zx{Okt34IzRiZc&C;q z36L=3h|_IVD{jN0@gJAE^zBA)BWF)))99Gc><=;77*jUWDDE|~5_oY{CGYQkU4^(U zv+q4YohQq|y9Ds`ajgm-@^XWZwo9qEv_A+~)cLOu43L+;-}&uWIzkTK+~iby>$hxU zc-|>jJ*g@!tx8EdhV>U2p$EZz*5Z`LIf7f`v={F;osx0Tu(6bh>eo1xT-lOp=a z+VhaD)^YkhnVzii!&LzwmZISGODgsV4>pn7H+fBDIZuImnMUA7z5sw!R^*A;nwC6T z*t>4r%XQA{41nZ?&LO(*B);ozUU2a6aCN^v7C$&An2LHmERl8l&ut;K(NF;auK&D> zIw~^oBNPx-6E6Tjgy+wjz`sn+7e7emt)`_!wnol$^8ufsi+U7(h{apU*jv#947PXo z1}MI^xAwNTEZ1M;5HR$o zI0dJ22~qOM91=Uvg&8*6p|4brrPRXrdR)J#)&F)oZ6uC*Wius%aI++zmbt&^wP>B1 zVa&r~O>&#anxdWCR%4WBT9OpYCd6h||A8f?b>}=P&AHK(^&6|2VoPDy*t4>YRs)OX zoel#F67opy|F7dWllTP5l(C-ZxWg40p?YorACxb`gnlFxxH|^&;LZ=NaydVyaTZZH zO&3fy_VgrIui;)4rDY*1v&Xp8f`54j28=Gf9=< z5ngfylAbBz)6AcZ_z%emn25qjvkgop9I6;~*-LB04e9q3fBZ<~u(51t|MW;$>v8La zEW0dcQwT4VQgj=r;G)FOypp!5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9 zF~30KqiF+Rdycu`YbBT?EIvz$#tFvslULCu$50!p9|l1Wp!JXe$Sre_1wYGOWSB#VFM zN@b2^dc*9`qmjDwUG?t%!H8XFQB~DTA}SVtoD&tZ);(4jTsEPtF$eb01~XAS@hreN z7!~Ygpn+tAXZPs{tQQZp9!Mo|$M*>CF{|P(8BrJfu+iG@r+ftHWaA0#SZv~d3&GYr z!fs-k#j!3uO_MDblK;xToc~MyC2^Uh=z4h%R_G-{;rH#0T~P#7B-wQ0lIISxxZ(TE zAOf3ww#zqJP>8>;smvj4fcJT@HU3F3IOrrBWMfqOc;B-gAO2E) zmNj@(_@hB@Wc6fMy57MC!1`s0!eae1MM;(Bm~1k9+!dV^QCawGw(jz3lm*tUp2Snr z)|xf5xw|p5bVcfL&ko- lLypJAzmdzop$*_742KX2`eeZ4gMV5IP*ZvVs(o%1`5!Q<7f%2H literal 0 HcmV?d00001 diff --git a/modules/_copier_template/{{module_name}}/workflow/Snakefile b/modules/_copier_template/{{module_name}}/workflow/Snakefile new file mode 100644 index 0000000..40d4dc8 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/Snakefile @@ -0,0 +1,23 @@ +import yaml + +from snakemake.utils import min_version, validate + +# Limit the snakemake version to a modern one. +min_version("8.10") + +# Load the default configuration. This will be overriden by users. +configfile: "config/default.yaml" +# Validate the configuration using the schema file. +validate(config, workflow.source_path("schemas/config.schema.yaml")) + +# Load internal settings separately so users cannot modify them. +with open(workflow.source_path("resources/internal_config.yaml"), "r") as f: + internal = yaml.safe_load(f) + +# Add all your includes here. +include: "rules/downloads.smk" + +rule all: + message: "Generate all outputs for '{{module_name}}'." + input: + diff --git a/modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml b/modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml new file mode 100644 index 0000000..8906f10 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml @@ -0,0 +1,7 @@ +name: shell +channels: + - conda-forge + - nodefaults +dependencies: + - curl=8.9.1 + - unzip=6.0 diff --git a/modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml b/modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml new file mode 100644 index 0000000..f00554e --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml @@ -0,0 +1,3 @@ +# This file contains configuration that users should not modify. +resources: + shapefile_url: diff --git a/modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml b/modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml new file mode 100644 index 0000000..e8e2be8 --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml @@ -0,0 +1,5 @@ +# DO NOT MODIFY THESE VALUES! +# They enable our wrappers to work. +software-deployment-method: conda +use-conda: True +wrapper-prefix: https://github.com/calliope-project/ec_modules/raw/ diff --git a/modules/_copier_template/{{module_name}}/workflow/report/report.rst b/modules/_copier_template/{{module_name}}/workflow/report/report.rst new file mode 100644 index 0000000..494373f --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/report/report.rst @@ -0,0 +1 @@ +Report of '{{module_name}}'. diff --git a/modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk b/modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk new file mode 100644 index 0000000..917f72c --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk @@ -0,0 +1 @@ +# We recommend adding rules that download necessary files here. diff --git a/modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml b/modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml new file mode 100644 index 0000000..657983b --- /dev/null +++ b/modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml @@ -0,0 +1,18 @@ +$schema: https://json-schema.org/draft/2020-12/schema +description: "Configuration schema for '{{module_name}}'." +type: object +additionalProperties: false +properties: + resources: + type: object + additionalProperties: false + description: Resources are paths to files that the module expects users to provide. + properties: + download: + type: boolean + description: If True, the module will attempt to download resource files instead of relying on user inputs. + shapefile: + type: string + description: | + A file with the shapes you wish to process. + Must have the following columns: 'country_id', 'subregion_id' and 'subregion_spec'. diff --git a/modules/_copier_template/{{module_name}}/workflow/scripts/.gitkeep b/modules/_copier_template/{{module_name}}/workflow/scripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/_template/README.md b/modules/_template/README.md index 9a7e441..ac5876b 100644 --- a/modules/_template/README.md +++ b/modules/_template/README.md @@ -1,4 +1,4 @@ -# Module template +# Easy Energy Modules - {{module_name}} diff --git a/modules/_template/workflow/report/README.md b/modules/_template/workflow/report/README.md new file mode 100644 index 0000000..886f330 --- /dev/null +++ b/modules/_template/workflow/report/README.md @@ -0,0 +1,3 @@ +# Reports + +Optionally, you can configure your workflow to [auto-generate reports](https://snakemake.readthedocs.io/en/stable/snakefiles/reporting.html) with statistics, plots and more! From df9628101d5955b2a9d1ba4f360f24efdc78f828 Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 12:37:09 +0200 Subject: [PATCH 2/8] Fix template email, replace static template. --- modules/_template/LICENSE | 21 ------- modules/_template/README.md | 55 ------------------ modules/_template/config/README.md | 14 ----- modules/_template/config/default.yaml | 7 --- .../copier.yaml | 2 +- modules/_template/rulegraph.png | Bin 9632 -> 0 bytes modules/_template/workflow/Snakefile | 23 -------- modules/_template/workflow/envs/README.md | 4 -- modules/_template/workflow/envs/shell.yaml | 8 --- modules/_template/workflow/profiles/README.md | 11 ---- .../workflow/profiles/default/config.yaml | 3 - modules/_template/workflow/report/README.md | 3 - .../_template/workflow/resources/README.md | 5 -- .../workflow/resources/internal.yaml | 9 --- modules/_template/workflow/rules/README.md | 3 - modules/_template/workflow/rules/example.smk | 16 ----- modules/_template/workflow/schemas/README.md | 5 -- .../workflow/schemas/config.schema.yaml | 26 --------- modules/_template/workflow/scripts/README.md | 5 -- modules/_template/workflow/scripts/example.py | 7 --- .../{{module_name}}/AUTHORS.md.jinja} | 0 .../{{module_name}}/LICENSE | 0 .../{{module_name}}/README.md.jinja} | 0 .../{{module_name}}/config/default.yaml | 0 .../{{module_name}}/rulegraph.png | Bin .../{{module_name}}/workflow/Snakefile | 0 .../{{module_name}}/workflow/envs/shell.yaml | 0 .../workflow/internal/internal_config.yaml | 0 .../workflow/profiles/default/config.yaml | 0 .../workflow/report/report.rst.jinja} | 0 .../workflow/rules/downloads.smk | 0 .../schemas/config.schema.yaml.jinja} | 0 .../{{module_name}}/workflow/scripts/.gitkeep | 0 33 files changed, 1 insertion(+), 226 deletions(-) delete mode 100644 modules/_template/LICENSE delete mode 100644 modules/_template/README.md delete mode 100644 modules/_template/config/README.md delete mode 100644 modules/_template/config/default.yaml rename modules/{_copier_template => _template}/copier.yaml (91%) delete mode 100644 modules/_template/rulegraph.png delete mode 100644 modules/_template/workflow/Snakefile delete mode 100644 modules/_template/workflow/envs/README.md delete mode 100644 modules/_template/workflow/envs/shell.yaml delete mode 100644 modules/_template/workflow/profiles/README.md delete mode 100644 modules/_template/workflow/profiles/default/config.yaml delete mode 100644 modules/_template/workflow/report/README.md delete mode 100644 modules/_template/workflow/resources/README.md delete mode 100644 modules/_template/workflow/resources/internal.yaml delete mode 100644 modules/_template/workflow/rules/README.md delete mode 100644 modules/_template/workflow/rules/example.smk delete mode 100644 modules/_template/workflow/schemas/README.md delete mode 100644 modules/_template/workflow/schemas/config.schema.yaml delete mode 100644 modules/_template/workflow/scripts/README.md delete mode 100644 modules/_template/workflow/scripts/example.py rename modules/{_copier_template/{{module_name}}/AUTHORS.md => _template/{{module_name}}/AUTHORS.md.jinja} (100%) rename modules/{_copier_template => _template}/{{module_name}}/LICENSE (100%) rename modules/{_copier_template/{{module_name}}/README.md => _template/{{module_name}}/README.md.jinja} (100%) rename modules/{_copier_template => _template}/{{module_name}}/config/default.yaml (100%) rename modules/{_copier_template => _template}/{{module_name}}/rulegraph.png (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/Snakefile (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/envs/shell.yaml (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/internal/internal_config.yaml (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/profiles/default/config.yaml (100%) rename modules/{_copier_template/{{module_name}}/workflow/report/report.rst => _template/{{module_name}}/workflow/report/report.rst.jinja} (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/rules/downloads.smk (100%) rename modules/{_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml => _template/{{module_name}}/workflow/schemas/config.schema.yaml.jinja} (100%) rename modules/{_copier_template => _template}/{{module_name}}/workflow/scripts/.gitkeep (100%) diff --git a/modules/_template/LICENSE b/modules/_template/LICENSE deleted file mode 100644 index e9b75a4..0000000 --- a/modules/_template/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021, AUTHORS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/modules/_template/README.md b/modules/_template/README.md deleted file mode 100644 index ac5876b..0000000 --- a/modules/_template/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Easy Energy Modules - {{module_name}} - - - - - -This module is a simple example of how you can build exportable and reproductible workflows in `snakemake`. - -## Input-Output - - - -Here is a brief summary of the IO structure of the module. -It just downloads a file with region shapes from a remote repository and also creates a text file with a greeting! - -```mermaid -flowchart LR - I1(shapefile.geojson) -.-> |Download| C - C(config.yaml) -->M((_template)) - M --> O1(downloaded_shapefile.csv) - M --> O2(hello-world.txt) -``` - -## DAG - -Here is a brief overview of the module's steps. -Please consult the code for more details. - -![dag](rulegraph.png) diff --git a/modules/_template/config/README.md b/modules/_template/config/README.md deleted file mode 100644 index 90ae39d..0000000 --- a/modules/_template/config/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Module configuration - -User-modifiable module settings should go in `default.yaml`. - -You should also provide a brief explanation of each setting below. - -## Example - -- shapefile: `.geojson` file containing at least a `geometry` column, a column with the country code in ISO 3166-1 alpha 3 standard, and a column with unique subregion IDs. - - path: URL to the shape, local path, or relative path (must be relative to the main workflow). - - download: if `True`, the module will use the `path` to download the shapefile. - - country-id-column: name of the column containing ISO country codes in alpha-3 format. - - subregion-id-column: name of the column containing unique subregion identifiers. -- year-slice: years to process, in the form [start_year, end_year]. Inclusive (e.g., [2015, 2017] will include 2015, 2016, 2017). diff --git a/modules/_template/config/default.yaml b/modules/_template/config/default.yaml deleted file mode 100644 index 6b95c71..0000000 --- a/modules/_template/config/default.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# User modifiable configuration -shapefile: - path: https://www.dropbox.com/scl/fi/sjjisuqnzck2mhxs9jca7/units-national.geojson?rlkey=rv0q1exsytxws3gfvankbt9p7&e=1&dl=0 - download: true - country-id-column: id - subregion-id-column: id # Shapes at national level -year-slice: [2016, 2016] diff --git a/modules/_copier_template/copier.yaml b/modules/_template/copier.yaml similarity index 91% rename from modules/_copier_template/copier.yaml rename to modules/_template/copier.yaml index 49d2daa..df146c0 100644 --- a/modules/_copier_template/copier.yaml +++ b/modules/_template/copier.yaml @@ -23,6 +23,6 @@ author_email: help: We auto-generate an MIT license for you. Please provide an email address. placeholder: yourname@university.edu validator: >- - {% if not (email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} + {% if not (author_email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} "This email does not seem valid... did you forget to add a dot?" {% endif %} diff --git a/modules/_template/rulegraph.png b/modules/_template/rulegraph.png deleted file mode 100644 index 0c0e675cccf06da78c265f1ee4fbdf81fb37eb6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9632 zcmYj%1yoeu8|~18(jZ+!3DVs)bcZM)AdN^!N|%Ck3O^VTX#}J}x*3p8X{15ALz;K^ zzqQ_au+|K-?wRi%zS{fS_e5xGD&an&d<20&a8;D$bs-QGJn;8dC?ddm*YVo+ zY;yM1V~>n4cXniN^Zorw_uO~IV)uT!b>Hp&vCFTzX|l`PahLzrXImt~!9^b)^vD|9 zh#q@JxusS5Gc_6t5k2hj;?&6n`B1OuMj~=K(XEAD4hqX;jdV4^=$<3gCRq=(UCCs% z>-@j3UY7H+Q93b1?}@qW=bYshasN}nFR34v9MyRZTREg(eniNPBNxf~=mc&-IEa7b zVZivktSqeICrJalex{RckV+29=uR`uWZi0b*V3m?vgCAeONLeS>B9I;<>kD4i4=~@ zn_UYpskfS<`!m z8yT59*rV+RW>DjGBy%gR-Tn(^Pl&ckVN|1j+OSihrGv@Hi!$kyExKa+2c{tt>O~|^ zeW#44c_~sd6MmBV@}?@EmP~+i_ZxG@@(ST4XAhpnp=-#?kj&dQ6!(B5jO(!WLocXd z9l@A&KS5eDW~f$~#&b{Mac1UCDHqg+BK?_l;|O$Kqgn8I1K_H-D!iK!KukQ*7G0sN-|O(_skOFMAil970YyfAop1-@BDd zr|vx`$Mgt^8GDyYF%1=Ll8k^yIdBvMI#a9qdT8T`roND8x(E~+Fy)8&MlS{e;X=x$ zbD*&!iJE=dwO8Y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j5P!r(iPv9)OKe<9(0VT}NT!!XpTH9Jb_(7%? zMYG^?c~XNX)f6Z;^2H~hs2=!23YRa!vB zt*i*-FeqML$z4rIP^ne~zjU)W>?!PrgLDwfgdrpdK^K!7?)yMUK}UfMM9zj3ED1nl zYVRnA1Y3o(J}Z?RiyLooK#Fl!NxRmA`$tM|(&dSjAWJ+F9O2$5Fw}ne{*u%aR=a5w zN7Keyxf51Y{%5oIkx`MiLDdv@O^AE62(!vsxyN2Ou#lkyGJ1huFK;e>8#$D~3Ak~# zDmlXwIgUMS-{tcOEH|wLjw~2~vkW|bfB3f8)DyVQJZy<&F#s+2Wu}``=Pf+z%RXbR z)BYAgQ%zwm`@5O)tN5mdWWm-A>ifO}vlRdb77lIrRdw&DS>WFXRq;Cb%7xiG(^pe8^vC}>+cWfG4* zeWzw=bg~a5Ar+uG8WZPv(STzdJ2JPdt|#E4&csqhyEpsH9h~`@nhuq6yqgL$~Yvi$tfQvSXpoIhktC[!WARNING] ->Do not modify the files in this folder - -`default/config.yaml` is a `snakemake` [profile](https://snakemake.readthedocs.io/en/v8.18.0/executing/cli.html) that enables us to link `ec_modules` together. -Any workflow that wishes to use our modules and wrappers should have a similar file. -It ensures two things: - -- That the workflow is always ran using `conda`. -- That wrappers point to the [`ec_modules`](https://github.com/calliope-project/ec_modules) repository. diff --git a/modules/_template/workflow/profiles/default/config.yaml b/modules/_template/workflow/profiles/default/config.yaml deleted file mode 100644 index 7ac5232..0000000 --- a/modules/_template/workflow/profiles/default/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -software-deployment-method: conda -use-conda: True -wrapper-prefix: https://github.com/calliope-project/ec_modules/raw/ diff --git a/modules/_template/workflow/report/README.md b/modules/_template/workflow/report/README.md deleted file mode 100644 index 886f330..0000000 --- a/modules/_template/workflow/report/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Reports - -Optionally, you can configure your workflow to [auto-generate reports](https://snakemake.readthedocs.io/en/stable/snakefiles/reporting.html) with statistics, plots and more! diff --git a/modules/_template/workflow/resources/README.md b/modules/_template/workflow/resources/README.md deleted file mode 100644 index 14e102e..0000000 --- a/modules/_template/workflow/resources/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Resources - -You can place small files that your workflow needs here. - -The most important of these is `internal.yaml`, where you can define settings that users cannot modify (i.e., urls for datasets you download, hard-coded parameters, etc). diff --git a/modules/_template/workflow/resources/internal.yaml b/modules/_template/workflow/resources/internal.yaml deleted file mode 100644 index 64711af..0000000 --- a/modules/_template/workflow/resources/internal.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# This file contains settings that users cannot modify. -# Use it for: -# - stuff that should not change (e.g., the URL of a raster the module needs to download) -# - data used for checks (e.g., a list of valid countries, if your module is not global) -valid-country-id: -- TZA -- MEX -- DEU -- BGD diff --git a/modules/_template/workflow/rules/README.md b/modules/_template/workflow/rules/README.md deleted file mode 100644 index 3e8e331..0000000 --- a/modules/_template/workflow/rules/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Rules - -All your rule files should be placed here in the form `file_name.smk`. diff --git a/modules/_template/workflow/rules/example.smk b/modules/_template/workflow/rules/example.smk deleted file mode 100644 index d414144..0000000 --- a/modules/_template/workflow/rules/example.smk +++ /dev/null @@ -1,16 +0,0 @@ - -if config["shapefile"]["download"]: - rule download_shapefile: - message: "Downloading the configured shapefile." - params: - url = config["shapefile"]["path"], - output: "results/downloads/shapes.geojson" - conda: "../envs/shell.yaml" - shell: "curl -sSLo {output} '{params.url}'" - - -rule hello_world: - message: "I am a module and that's OK!" - output: "results/hello.txt" - conda: "../envs/shell.yaml" - script: "../scripts/example.py" diff --git a/modules/_template/workflow/schemas/README.md b/modules/_template/workflow/schemas/README.md deleted file mode 100644 index a3a1190..0000000 --- a/modules/_template/workflow/schemas/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Schemas - -Optionally, you may want to validate user configurations through a [JSON schema](https://json-schema.org/understanding-json-schema/reference/array). - -This will enable you to automatically reject wrong module configurations before they reach rules or code. diff --git a/modules/_template/workflow/schemas/config.schema.yaml b/modules/_template/workflow/schemas/config.schema.yaml deleted file mode 100644 index 2316d03..0000000 --- a/modules/_template/workflow/schemas/config.schema.yaml +++ /dev/null @@ -1,26 +0,0 @@ -$schema: https://json-schema.org/draft/2020-12/schema -type: object -additionalProperties: false -properties: - shapefile: - type: object - additionalProperties: false - description: Settings related to shapes. - properties: - path: - type: string - description: url, full path or relative path to the shapefile. - download: - type: boolean - description: If True, the module will attempt to download the shapefile from the url in 'path'. - country-id-column: - type: string - description: name of the column containing ISO country codes in alpha-3 format. - subregion-id-column: - type: string - description: name of the column containing unique subregion IDs. - year-slice: - type: array - description: range of years to process. - items: - type: number diff --git a/modules/_template/workflow/scripts/README.md b/modules/_template/workflow/scripts/README.md deleted file mode 100644 index d5c34a8..0000000 --- a/modules/_template/workflow/scripts/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Scripts - -Python, R and similar scripts should be placed here. -Keep in mind that `snakemake` is not meant to be a development environment, making scripts hard to debug. -If your scripts are getting long (>100 lines), consider building a python module with wrappers instead. diff --git a/modules/_template/workflow/scripts/example.py b/modules/_template/workflow/scripts/example.py deleted file mode 100644 index a7e6902..0000000 --- a/modules/_template/workflow/scripts/example.py +++ /dev/null @@ -1,7 +0,0 @@ -"""A python script for your workflow!""" - -with open(snakemake.output[0], "w") as file: - file.write( - "I am just an example for your worklow... " - "Please delete me if you copy this example as a template!" - ) diff --git a/modules/_copier_template/{{module_name}}/AUTHORS.md b/modules/_template/{{module_name}}/AUTHORS.md.jinja similarity index 100% rename from modules/_copier_template/{{module_name}}/AUTHORS.md rename to modules/_template/{{module_name}}/AUTHORS.md.jinja diff --git a/modules/_copier_template/{{module_name}}/LICENSE b/modules/_template/{{module_name}}/LICENSE similarity index 100% rename from modules/_copier_template/{{module_name}}/LICENSE rename to modules/_template/{{module_name}}/LICENSE diff --git a/modules/_copier_template/{{module_name}}/README.md b/modules/_template/{{module_name}}/README.md.jinja similarity index 100% rename from modules/_copier_template/{{module_name}}/README.md rename to modules/_template/{{module_name}}/README.md.jinja diff --git a/modules/_copier_template/{{module_name}}/config/default.yaml b/modules/_template/{{module_name}}/config/default.yaml similarity index 100% rename from modules/_copier_template/{{module_name}}/config/default.yaml rename to modules/_template/{{module_name}}/config/default.yaml diff --git a/modules/_copier_template/{{module_name}}/rulegraph.png b/modules/_template/{{module_name}}/rulegraph.png similarity index 100% rename from modules/_copier_template/{{module_name}}/rulegraph.png rename to modules/_template/{{module_name}}/rulegraph.png diff --git a/modules/_copier_template/{{module_name}}/workflow/Snakefile b/modules/_template/{{module_name}}/workflow/Snakefile similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/Snakefile rename to modules/_template/{{module_name}}/workflow/Snakefile diff --git a/modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml b/modules/_template/{{module_name}}/workflow/envs/shell.yaml similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/envs/shell.yaml rename to modules/_template/{{module_name}}/workflow/envs/shell.yaml diff --git a/modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml b/modules/_template/{{module_name}}/workflow/internal/internal_config.yaml similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/internal/internal_config.yaml rename to modules/_template/{{module_name}}/workflow/internal/internal_config.yaml diff --git a/modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml b/modules/_template/{{module_name}}/workflow/profiles/default/config.yaml similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/profiles/default/config.yaml rename to modules/_template/{{module_name}}/workflow/profiles/default/config.yaml diff --git a/modules/_copier_template/{{module_name}}/workflow/report/report.rst b/modules/_template/{{module_name}}/workflow/report/report.rst.jinja similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/report/report.rst rename to modules/_template/{{module_name}}/workflow/report/report.rst.jinja diff --git a/modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk b/modules/_template/{{module_name}}/workflow/rules/downloads.smk similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/rules/downloads.smk rename to modules/_template/{{module_name}}/workflow/rules/downloads.smk diff --git a/modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml b/modules/_template/{{module_name}}/workflow/schemas/config.schema.yaml.jinja similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/schemas/config.schema.yaml rename to modules/_template/{{module_name}}/workflow/schemas/config.schema.yaml.jinja diff --git a/modules/_copier_template/{{module_name}}/workflow/scripts/.gitkeep b/modules/_template/{{module_name}}/workflow/scripts/.gitkeep similarity index 100% rename from modules/_copier_template/{{module_name}}/workflow/scripts/.gitkeep rename to modules/_template/{{module_name}}/workflow/scripts/.gitkeep From a72ca2ae4e4c0ccfc31a8bcdda067a375746bf7e Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 13:03:18 +0200 Subject: [PATCH 3/8] Update documentation --- docs/development_guide/getting_started.md | 27 ++++++++++++++++++++++- modules/_template/copier.yaml | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/development_guide/getting_started.md b/docs/development_guide/getting_started.md index dabe766..541f550 100644 --- a/docs/development_guide/getting_started.md +++ b/docs/development_guide/getting_started.md @@ -17,5 +17,30 @@ If you don't, We recommend following `mamba`'s [installation advice](https://git conda activate ec_modules ``` -3. You are ready to go! +3. Create your module or wrapper using one of our standard [`copier`](https://github.com/copier-org/copier) templates. + + ??? example "Example: using a module template" + + With the `ec_modules` environment activated, type: + + ```shell + copier copy modules/_template/ modules/ + ``` + + You'll be promted with some questions. After answering them, `copier` will auto-generate the module for you! + + ```html + 🎤 What is your module's name? + electrical_transmission + 🎤 Please give a brief sentence describing your module. + A module to estimate transmission capacities between subregions in Europe. + 🎤 We auto-generate an MIT license for you. Please provide your full name. + E. Dantès + 🎤 We auto-generate an MIT license for you. Please provide the name of your institution. + Morrel Technical Institute + 🎤 We auto-generate an MIT license for you. Please provide an email address. + e.dantes@morrel-ti.edu + ``` + +You are ready to go! Please look into our [code conventions](conventions.md#code-conventions) and our requirements for developing [modules](modules.md) and [wrappers](wrappers.md) for more details. diff --git a/modules/_template/copier.yaml b/modules/_template/copier.yaml index df146c0..97d7f57 100644 --- a/modules/_template/copier.yaml +++ b/modules/_template/copier.yaml @@ -16,7 +16,7 @@ author_name: placeholder: Laura Patricia Orellana author_institution: type: str - help: We auto-generate an MIT license for you. Please provide the name of your instutition." + help: We auto-generate an MIT license for you. Please provide the name of your institution. placeholder: TU Delft author_email: type: str From eaec9a37409498ec6385e40d9812d1215790ba81 Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 14:07:18 +0200 Subject: [PATCH 4/8] Add wrapper template. --- .../workflow/{Snakefile => Snakefile.jinja} | 0 wrappers/_template/copier.yaml | 48 +++++++++++++++++++ .../{{wrapper_name}}/README.md.jinja | 11 +++++ .../{{wrapper_name}}/environment.yaml.jinja | 6 +++ .../{{wrapper_name}}/meta.yaml.jinja | 9 ++++ .../{{wrapper_name}}/test/Snakefile.jinja | 9 ++++ .../{{wrapper_name}}/wrapper.py.jinja | 6 +++ 7 files changed, 89 insertions(+) rename modules/_template/{{module_name}}/workflow/{Snakefile => Snakefile.jinja} (100%) create mode 100644 wrappers/_template/copier.yaml create mode 100644 wrappers/_template/{{tool_name}}/{{wrapper_name}}/README.md.jinja create mode 100644 wrappers/_template/{{tool_name}}/{{wrapper_name}}/environment.yaml.jinja create mode 100644 wrappers/_template/{{tool_name}}/{{wrapper_name}}/meta.yaml.jinja create mode 100644 wrappers/_template/{{tool_name}}/{{wrapper_name}}/test/Snakefile.jinja create mode 100644 wrappers/_template/{{tool_name}}/{{wrapper_name}}/wrapper.py.jinja diff --git a/modules/_template/{{module_name}}/workflow/Snakefile b/modules/_template/{{module_name}}/workflow/Snakefile.jinja similarity index 100% rename from modules/_template/{{module_name}}/workflow/Snakefile rename to modules/_template/{{module_name}}/workflow/Snakefile.jinja diff --git a/wrappers/_template/copier.yaml b/wrappers/_template/copier.yaml new file mode 100644 index 0000000..f1fa1f1 --- /dev/null +++ b/wrappers/_template/copier.yaml @@ -0,0 +1,48 @@ +tool_name: + type: str + help: What is the name of the tool you are designing a wrapper for? + placeholder: tsam + validator: >- + {% if not (tool_name | regex_search('^[a-z][a-z0-9_]+$')) %} + "'tool_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + {% endif %} +tool_url: + type: str + help: Please provide a valid to the tool's official website. + placeholder: https://github.com/FZJ-IEK3-VSA/tsam + validator: >- + {% if not (tool_url | regex_search('^(https?|http?):\/\/.+$')) %} + "'tool_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + {% endif %} +wrapper_name: + type: str + help: What is the name of the wrapper? + placeholder: timeseries + validator: >- + {% if not (wrapper_name | regex_search('^[a-z][a-z0-9_]+$')) %} + "'wrapper_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + {% endif %} +wrapper_description: + type: str + help: Please give a brief sentence describing your wrapper. + placeholder: Runs timeseries aggregation functions for any number of files. +author_name: + type: str + help: We auto-generate an MIT license for you. Please provide your full name. + placeholder: A. Donda +author_institution: + type: str + help: We auto-generate an MIT license for you. Please provide the name of your institution. + placeholder: Solaris University +author_email: + type: str + help: We auto-generate an MIT license for you. Please provide an email address. + placeholder: a.donda@solaris.uni.edu + validator: >- + {% if not (author_email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} + "This email does not seem valid... did you forget to add a dot?" + {% endif %} +year: + type: int + help: We auto-generate an MIT license for you. What year is this? + placeholder: 2024 diff --git a/wrappers/_template/{{tool_name}}/{{wrapper_name}}/README.md.jinja b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/README.md.jinja new file mode 100644 index 0000000..1470691 --- /dev/null +++ b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/README.md.jinja @@ -0,0 +1,11 @@ +# `{{tool_name}}` - {{wrapper_name}} + +{{wrapper_description}} + +```mermaid +flowchart LR + I1(some_file.csv) --> W(({{wrapper_name}})) + I2(some_optional_file.nc) --> |Optional| W + W --> O1(some_output.csv) + W --> |Optional| O2(optional_output.png) +``` diff --git a/wrappers/_template/{{tool_name}}/{{wrapper_name}}/environment.yaml.jinja b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/environment.yaml.jinja new file mode 100644 index 0000000..b7a23a7 --- /dev/null +++ b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/environment.yaml.jinja @@ -0,0 +1,6 @@ +name: ec-{{tool_name}}-{{wrapper_name}} +channels: + - conda-forge + - nodefaults +dependencies: + - diff --git a/wrappers/_template/{{tool_name}}/{{wrapper_name}}/meta.yaml.jinja b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/meta.yaml.jinja new file mode 100644 index 0000000..8d9af82 --- /dev/null +++ b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/meta.yaml.jinja @@ -0,0 +1,9 @@ +name: {{tool_name}} - {{wrapper_name}} +description: | + {{wrapper_description}} +url: {{tool_url}} +authors: + - {{author_name}} +input: +output: +params: diff --git a/wrappers/_template/{{tool_name}}/{{wrapper_name}}/test/Snakefile.jinja b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/test/Snakefile.jinja new file mode 100644 index 0000000..80cbb66 --- /dev/null +++ b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/test/Snakefile.jinja @@ -0,0 +1,9 @@ +rule {{tool_name}}_{{wrapper_name}}: + input: + some_file = "somefile.csv", + some_optional_file = "some_optional_file.nc" + output: + some_output = "results/some_output.csv", + optional_output = "results/optional_output.png" + params: + wrapper: "file:../" diff --git a/wrappers/_template/{{tool_name}}/{{wrapper_name}}/wrapper.py.jinja b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/wrapper.py.jinja new file mode 100644 index 0000000..df00b1c --- /dev/null +++ b/wrappers/_template/{{tool_name}}/{{wrapper_name}}/wrapper.py.jinja @@ -0,0 +1,6 @@ +"""Wrapper for {{tool_name}} - {{wrapper_name}}.""" + +__author__ = "{{author_name}}" +__copyright__ = "Copyright {{year}}, {{author_name}}" +__email__ = "{{author_email}}" +__license__ = "MIT" From 1c726585862067849def22db4c2de816f576a73b Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 14:18:00 +0200 Subject: [PATCH 5/8] Template message corrections --- modules/_template/copier.yaml | 2 +- wrappers/_template/copier.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/_template/copier.yaml b/modules/_template/copier.yaml index 97d7f57..a1424ba 100644 --- a/modules/_template/copier.yaml +++ b/modules/_template/copier.yaml @@ -4,7 +4,7 @@ module_name: placeholder: transport_road validator: >- {% if not (module_name | regex_search('^[a-z][a-z0-9\-_]+$')) %} - "'module_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + "Must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." {% endif %} module_description: type: str diff --git a/wrappers/_template/copier.yaml b/wrappers/_template/copier.yaml index f1fa1f1..80f6ef4 100644 --- a/wrappers/_template/copier.yaml +++ b/wrappers/_template/copier.yaml @@ -4,7 +4,7 @@ tool_name: placeholder: tsam validator: >- {% if not (tool_name | regex_search('^[a-z][a-z0-9_]+$')) %} - "'tool_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + "Must be a single word in lowercase. Letters, digits and underscores are valid characters." {% endif %} tool_url: type: str @@ -12,7 +12,7 @@ tool_url: placeholder: https://github.com/FZJ-IEK3-VSA/tsam validator: >- {% if not (tool_url | regex_search('^(https?|http?):\/\/.+$')) %} - "'tool_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + "Must be a valid URL." {% endif %} wrapper_name: type: str @@ -20,7 +20,7 @@ wrapper_name: placeholder: timeseries validator: >- {% if not (wrapper_name | regex_search('^[a-z][a-z0-9_]+$')) %} - "'wrapper_name' must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + "Must be a single word in lowercase. Letters, digits and underscores are valid characters." {% endif %} wrapper_description: type: str @@ -43,6 +43,6 @@ author_email: "This email does not seem valid... did you forget to add a dot?" {% endif %} year: - type: int + type: str help: We auto-generate an MIT license for you. What year is this? - placeholder: 2024 + placeholder: "2024" From e866d7829eea7094cb8306279ccc76b3bfb2879b Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 14:45:43 +0200 Subject: [PATCH 6/8] Wrapper template documentation --- docs/development_guide/getting_started.md | 35 +++++++++++++++++-- modules/_template/copier.yaml | 9 +++-- .../{LICENSE => LICENSE.jinja} | 2 +- wrappers/_template/copier.yaml | 2 +- 4 files changed, 42 insertions(+), 6 deletions(-) rename modules/_template/{{module_name}}/{LICENSE => LICENSE.jinja} (97%) diff --git a/docs/development_guide/getting_started.md b/docs/development_guide/getting_started.md index 541f550..7e151d1 100644 --- a/docs/development_guide/getting_started.md +++ b/docs/development_guide/getting_started.md @@ -31,15 +31,46 @@ If you don't, We recommend following `mamba`'s [installation advice](https://git ```html 🎤 What is your module's name? - electrical_transmission + wind_offshore 🎤 Please give a brief sentence describing your module. - A module to estimate transmission capacities between subregions in Europe. + A module to estimate offshore-wind potentials for arbitrary subregions in Europe. 🎤 We auto-generate an MIT license for you. Please provide your full name. E. Dantès 🎤 We auto-generate an MIT license for you. Please provide the name of your institution. Morrel Technical Institute 🎤 We auto-generate an MIT license for you. Please provide an email address. e.dantes@morrel-ti.edu + 🎤 We auto-generate an MIT license for you. What year is this? + 1815 + ``` + + ??? example "Example: using a wrapper template" + + Similar to the module example, call `copier` with the following: + + ```shell + copier copy wrappers/_template/ wrappers/ + ``` + + In the case of wrappers, there are some additional answers you must provide. + + ```html + 🎤 What is the name of the tool you are designing a wrapper for? + gregor + 🎤 Please provide a valid link to the tool's official website. + https://github.com/jnnr/gregor + 🎤 What is the name of the wrapper? + snip + 🎤 Please give a brief sentence describing your wrapper. + Snip a raster file into a smaller raster file. + 🎤 We auto-generate an MIT license for you. Please provide your full name. + G. Samsa + 🎤 We auto-generate an MIT license for you. Please provide the name of your institution. + Bekannt University + 🎤 We auto-generate an MIT license for you. Please provide an email address. + g.s@un.bekannt.edu + 🎤 We auto-generate an MIT license for you. What year is this? + 1915 ``` You are ready to go! diff --git a/modules/_template/copier.yaml b/modules/_template/copier.yaml index a1424ba..bf16bfc 100644 --- a/modules/_template/copier.yaml +++ b/modules/_template/copier.yaml @@ -3,8 +3,8 @@ module_name: help: What is your module's name? placeholder: transport_road validator: >- - {% if not (module_name | regex_search('^[a-z][a-z0-9\-_]+$')) %} - "Must be a single word in lowercase. Letters, digits, dashes and underscores are valid characters." + {% if not (module_name | regex_search('^[a-z][a-z0-9_]+$')) %} + "Must be a single word in lowercase. Letters, digits and underscores are valid characters." {% endif %} module_description: type: str @@ -26,3 +26,8 @@ author_email: {% if not (author_email | regex_search('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')) %} "This email does not seem valid... did you forget to add a dot?" {% endif %} +year: + type: str + help: We auto-generate an MIT license for you. What year is this? + placeholder: "2024" + diff --git a/modules/_template/{{module_name}}/LICENSE b/modules/_template/{{module_name}}/LICENSE.jinja similarity index 97% rename from modules/_template/{{module_name}}/LICENSE rename to modules/_template/{{module_name}}/LICENSE.jinja index b1cb50c..ca13cfd 100644 --- a/modules/_template/{{module_name}}/LICENSE +++ b/modules/_template/{{module_name}}/LICENSE.jinja @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024, AUTHORS +Copyright (c) {{year}}, AUTHORS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/wrappers/_template/copier.yaml b/wrappers/_template/copier.yaml index 80f6ef4..a54a060 100644 --- a/wrappers/_template/copier.yaml +++ b/wrappers/_template/copier.yaml @@ -8,7 +8,7 @@ tool_name: {% endif %} tool_url: type: str - help: Please provide a valid to the tool's official website. + help: Please provide a valid link to the tool's official website. placeholder: https://github.com/FZJ-IEK3-VSA/tsam validator: >- {% if not (tool_url | regex_search('^(https?|http?):\/\/.+$')) %} From 21fa7aea7ff27dc9ad5873cb8394e75dd50556fe Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 24 Aug 2024 12:47:30 +0000 Subject: [PATCH 7/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- modules/_template/copier.yaml | 1 - modules/_template/{{module_name}}/workflow/Snakefile.jinja | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/_template/copier.yaml b/modules/_template/copier.yaml index bf16bfc..6a3f51b 100644 --- a/modules/_template/copier.yaml +++ b/modules/_template/copier.yaml @@ -30,4 +30,3 @@ year: type: str help: We auto-generate an MIT license for you. What year is this? placeholder: "2024" - diff --git a/modules/_template/{{module_name}}/workflow/Snakefile.jinja b/modules/_template/{{module_name}}/workflow/Snakefile.jinja index 40d4dc8..234dcb5 100644 --- a/modules/_template/{{module_name}}/workflow/Snakefile.jinja +++ b/modules/_template/{{module_name}}/workflow/Snakefile.jinja @@ -20,4 +20,3 @@ include: "rules/downloads.smk" rule all: message: "Generate all outputs for '{{module_name}}'." input: - From c97c8db4ca529dc69d469198be199bce014469e8 Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Sat, 24 Aug 2024 14:50:20 +0200 Subject: [PATCH 8/8] PR: CI spelling fixes --- docs/development_guide/getting_started.md | 2 +- modules/_template/{{module_name}}/workflow/Snakefile.jinja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development_guide/getting_started.md b/docs/development_guide/getting_started.md index 7e151d1..4382e6f 100644 --- a/docs/development_guide/getting_started.md +++ b/docs/development_guide/getting_started.md @@ -27,7 +27,7 @@ If you don't, We recommend following `mamba`'s [installation advice](https://git copier copy modules/_template/ modules/ ``` - You'll be promted with some questions. After answering them, `copier` will auto-generate the module for you! + You'll be prompted with some questions. After answering them, `copier` will auto-generate the module for you! ```html 🎤 What is your module's name? diff --git a/modules/_template/{{module_name}}/workflow/Snakefile.jinja b/modules/_template/{{module_name}}/workflow/Snakefile.jinja index 234dcb5..e168ae3 100644 --- a/modules/_template/{{module_name}}/workflow/Snakefile.jinja +++ b/modules/_template/{{module_name}}/workflow/Snakefile.jinja @@ -5,7 +5,7 @@ from snakemake.utils import min_version, validate # Limit the snakemake version to a modern one. min_version("8.10") -# Load the default configuration. This will be overriden by users. +# Load the default configuration. This will be overridden by users. configfile: "config/default.yaml" # Validate the configuration using the schema file. validate(config, workflow.source_path("schemas/config.schema.yaml"))