PyPSA / PyPSA/PyPSA

Add config attribute to store history of settings applied during network optimisation (and build?)

Open
#1,622 0 comments 0 reactions 2 assignees View on GitHub

@brynpickering is already working on this.

Since Mar 23, 2026.

IO
Dominant language
Python
Stars
2.2k
Forks
699
Avg merge
2d 10h
Merged PRs (30d)
13

Description

A solved network loaded from file has missing information pertaining, in particular, to settings used at the optimisation stage. This means it isn't entirely reproducible.

I would propose a Network.config attribute that stores this information. It could be generalised so that it has a optimize sub-key which stores the most recent set of args passed to the optimisation. This would leave open the option to extend it to storing applied settings for other network methods.

This config could be:

  1. applied by default when running the optimize step, such that a user automatically runs with the same settings. They would then call something like n.config.clear() to reset it.
  2. passed to the optimise function explicitly by the user, to achieve reproduction: n.optimize(**n.config.optimize).

This could be extended to other steps in the process of building and processing a network object, so that applied settings can be easily checked and/or can used as new baseline for defaults applied at different stages (if following the process defined in option (1) above).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.