From e393855bbcdbcedec96c1e5309e8743268bddc6d Mon Sep 17 00:00:00 2001
From: Eric Nitschke <eric.nitschke@tuhh.de>
Date: Thu, 16 Jan 2025 00:38:25 +0100
Subject: [PATCH] Bugfix: Fix admin needs for Windows (#1295)

* Bugfix: Fix admin needs for Windows

Minor changes:
- fix the admin needs for Windows by setting the shadow directory settings in the Snakefile to "copy-minimal" for Windows

* Update the release_notes

---------

Co-authored-by: Davide Fioriti <67809479+davide-f@users.noreply.github.com>
---
 Snakefile             | 6 +++---
 doc/release_notes.rst | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Snakefile b/Snakefile
index d2ecc38f3..6653014a3 100644
--- a/Snakefile
+++ b/Snakefile
@@ -906,7 +906,7 @@ if config["monte_carlo"]["options"].get("add_to_snakefile", False) == True:
         resources:
             mem_mb=memory,
         shadow:
-            "shallow"
+            "copy-minimal" if os.name == "nt" else "shallow"
         script:
             "scripts/solve_network.py"
 
@@ -1631,7 +1631,7 @@ if config["foresight"] == "overnight":
             RESDIR
             + "postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export.nc",
         shadow:
-            "shallow"
+            "copy-minimal" if os.name == "nt" else "shallow"
         log:
             solver=RESDIR
             + "logs/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export_solver.log",
@@ -2097,7 +2097,7 @@ if config["foresight"] == "myopic":
             # config=RESDIR
             # + "configs/config.elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export.yaml",
         shadow:
-            "shallow"
+            "copy-minimal" if os.name == "nt" else "shallow"
         log:
             solver=RESDIR
             + "logs/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export_solver.log",
diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 0674f7c49..4b6bce8ef 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -29,6 +29,8 @@ This part of documentation collects descriptive release notes to capture the mai
 
 * Fix lossy bidirectional links, especially H2 pipelines, which would sometimes gain H2 instead of losing it.  `PR #1192 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1192>`__
 
+* Fix the need for administrative rights on Windows by changing all shadow directory settings for Windows in the Snakefile `PR #1295 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1295>`__
+
 PyPSA-Earth 0.6.0
 =================