From fe143ff8fef243d0fb78e420ee7a8274aac02b39 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 12 Feb 2024 12:10:05 +0100 Subject: [PATCH] use default config as base configuration --- Snakefile | 11 +++-------- config/config.yaml | 7 +++++++ doc/configuration.rst | 2 +- doc/installation.rst | 13 ++++--------- doc/introduction.rst | 2 +- doc/release_notes.rst | 5 +++++ 6 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 config/config.yaml diff --git a/Snakefile b/Snakefile index 8391156c..ba60cbc9 100644 --- a/Snakefile +++ b/Snakefile @@ -2,8 +2,8 @@ # # SPDX-License-Identifier: MIT -from os.path import normpath, exists -from shutil import copyfile, move, rmtree +from os.path import normpath +from shutil import move, rmtree from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider @@ -13,12 +13,7 @@ from snakemake.utils import min_version min_version("7.7") -conf_file = os.path.join(workflow.current_basedir, "config/config.yaml") -conf_default_file = os.path.join(workflow.current_basedir, "config/config.default.yaml") -if not exists(conf_file) and exists(conf_default_file): - copyfile(conf_default_file, conf_file) - - +configfile: "config/config.default.yaml" configfile: "config/config.yaml" diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 00000000..6fa1862c --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: : 2024 The PyPSA-Eur Authors +# +# SPDX-License-Identifier: CC0-1.0 +# add your own configuration overrides here, for instance + +# enable: +# retrieve: false \ No newline at end of file diff --git a/doc/configuration.rst b/doc/configuration.rst index 92ed269b..f65aa4c2 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -9,7 +9,7 @@ Configuration ########################################## -PyPSA-Eur has several configuration options which are documented in this section and are collected in a ``config/config.yaml`` file located in the root directory. Users should copy the provided default configuration (``config/config.default.yaml``) and amend their own modifications and assumptions in the user-specific configuration file (``config/config.yaml``); confer installation instructions at :ref:`defaultconfig`. +PyPSA-Eur has several configuration options which are documented in this section and are collected in a ``config/config.yaml`` file. This file defines deviations from the default configuration (``config/config.default.yaml``); confer installation instructions at :ref:`defaultconfig`. .. _toplevel_cf: diff --git a/doc/installation.rst b/doc/installation.rst index 01fdafeb..d2fdfb4e 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -118,11 +118,10 @@ Nevertheless, you can still use open-source solvers for smaller problems. Handling Configuration Files ============================ -PyPSA-Eur has several configuration options that must be specified in a -``config/config.yaml`` file located in the root directory. An example configuration -``config/config.default.yaml`` is maintained in the repository, which will be used to -automatically create your customisable ``config/config.yaml`` on first use. More -details on the configuration options are in :ref:`config`. +PyPSA-Eur has several configuration options that users can specify in a +``config/config.yaml`` file. The default configuration +``config/config.default.yaml`` is maintained in the repository. More details on +the configuration options are in :ref:`config`. You can also use ``snakemake`` to specify another file, e.g. ``config/config.mymodifications.yaml``, to update the settings of the ``config/config.yaml``. @@ -131,7 +130,3 @@ You can also use ``snakemake`` to specify another file, e.g. .../pypsa-eur % snakemake -call --configfile config/config.mymodifications.yaml -.. warning:: - Users are advised to regularly check their own ``config/config.yaml`` against changes - in the ``config/config.default.yaml`` when pulling a new version from the remote - repository. diff --git a/doc/introduction.rst b/doc/introduction.rst index 413db9d1..0047f0a7 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -74,7 +74,7 @@ what data to retrieve and what files to produce. Details are explained in :ref:`wildcards` and :ref:`scenario`. The model also has several further configuration options collected in the -``config/config.yaml`` file located in the root directory, which that are not part of +``config/config.default.yaml`` file located in the root directory, which that are not part of the scenarios. Options are explained in :ref:`config`. Folder Structure diff --git a/doc/release_notes.rst b/doc/release_notes.rst index fce4ae1b..cab8229a 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -10,6 +10,11 @@ Release Notes Upcoming Release ================ +* The default configuration ``config/config.default.yaml`` is now automatically + used as a base configuration file and no longer copied to + ``config/config.yaml`` on first use. The file ``config/config.yaml`` should be + used to define deviations from the default configuration. + * Merged two OPSD time series data versions into such that the option ``load: power_statistics:`` becomes superfluous and was hence removed.