Skip to content

Commit 40ca61b

Browse files
authored
Add purge and all rules (#187)
* Add purge rule * Add all rule * Add release note
1 parent 66ae2df commit 40ca61b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Snakefile

+22
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: GPL-3.0-only
44

55
import pathlib
6+
from shutil import rmtree
67

78

89
configfile: "config.yaml"
@@ -88,3 +89,24 @@ rule convert_EWG:
8889
"environment.yaml"
8990
script:
9091
"scripts/convert_pdf_EWG_to_dataframe.py"
92+
93+
94+
rule all:
95+
input:
96+
rules.compile_cost_assumptions.output,
97+
rules.compile_cost_assumptions_usa.output,
98+
default_target:True
99+
100+
101+
rule purge:
102+
run:
103+
import builtins
104+
105+
do_purge = builtins.input(
106+
"Do you really want to delete all generated outputs? [y/N] "
107+
)
108+
if do_purge == "y":
109+
rmtree("outputs/", ignore_errors=True)
110+
print("Purging generated outputs.")
111+
else:
112+
raise Exception(f"Input {do_purge}. Aborting purge.")

docs/release_notes.rst

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Upcoming Release
2828

2929
* Updates the documentation with compile_cost_assumptions_usa.py (https://github.com/PyPSA/technology-data/pull/186)
3030

31+
* Add `purge` and `all` rules to clean all generated outputs and regenerate them (https://github.com/PyPSA/technology-data/pull/187)
32+
3133
`v0.11.0 <https://github.com/PyPSA/technology-data/releases/tag/v0.11.0>`__ (24th January 2025)
3234
=======================================================================================
3335

0 commit comments

Comments
 (0)