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
1 change: 1 addition & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Upcoming Release
.. To use the features already you have to use the ``master`` branch.

* Include unit test execution and compile_cost_assumptions_usa.py in ci.yaml (https://github.com/PyPSA/technology-data/pull/174)
* Align `snakemake` version and the related `mock_snakemake` to PyPSA-Eur (https://github.com/PyPSA/technology-data/pull/177)

`v0.11.0 <https://github.com/PyPSA/technology-data/releases/tag/v0.11.0>`__ (24th January 2025)
=======================================================================================
Expand Down
2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- python>=3.8
- pip
# for running the package
- snakemake-minimal>=8.5
- snakemake-minimal>=8.5,<8.25 # See https://github.com/snakemake/snakemake/issues/3202
- pandas>=2.1
- pypsa
- pyarrow
Expand Down
31 changes: 20 additions & 11 deletions scripts/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@

# coding: utf-8

import os
import re
from pathlib import Path

import snakemake as sm
from snakemake.script import Snakemake


class Dict(dict):
"""
Expand Down Expand Up @@ -92,6 +88,19 @@ def mock_snakemake(
keyword arguments fixing the wildcards. Only necessary if wildcards are
needed.
"""
import os

import snakemake as sm
from snakemake.api import Workflow
from snakemake.common import SNAKEFILE_CHOICES
from snakemake.script import Snakemake
from snakemake.settings.types import (
ConfigSettings,
DAGSettings,
ResourceSettings,
StorageSettings,
WorkflowSettings,
)

script_dir = Path(__file__).parent.resolve()
if root_dir is None:
Expand All @@ -111,7 +120,7 @@ def mock_snakemake(
f" {root_dir} or scripts directory {script_dir}"
)
try:
for p in sm.SNAKEFILE_CHOICES:
for p in SNAKEFILE_CHOICES:
if os.path.exists(p):
snakefile = p
break
Expand All @@ -120,12 +129,12 @@ def mock_snakemake(
elif isinstance(configfiles, str):
configfiles = [configfiles]

resource_settings = sm.ResourceSettings()
config_settings = sm.ConfigSettings(configfiles=map(Path, configfiles))
workflow_settings = sm.WorkflowSettings()
storage_settings = sm.StorageSettings()
dag_settings = sm.DAGSettings(rerun_triggers=[])
workflow = sm.Workflow(
resource_settings = ResourceSettings()
config_settings = ConfigSettings(configfiles=map(Path, configfiles))
workflow_settings = WorkflowSettings()
storage_settings = StorageSettings()
dag_settings = DAGSettings(rerun_triggers=[])
workflow = Workflow(
config_settings,
resource_settings,
workflow_settings,
Expand Down