I would like to set some VisualStudioCode or PyCharm breakpoints for the script
https://github.com/PyPSA/pypsa-eur/blob/master/scripts/prepare_sector_network.py
and then run and debug it to better understand how it works.
Usually the scripts of PyPSA-EUR are run as part of a snakemake workflow.
Therefore, I currently see two strategies:
a) Create a run configuration (launch.json) that uses snakemake executable as program or
b) Run the script with python and mock the usage of snakemake in a main function of the script
=> What is the recommended way to do it and where can I find instructions?
Actually, the script file includes a main section at the end of the file:
if __name__ == "__main__":
#...
#snakemake = mock_snakemake(...)
However, that functionality seems to be outdated and/or serves a different purpose?
I created a corrensponding bug ticket here:
https://github.com/PyPSA/pypsa-eur/issues/1118
If instead a) is the recommended way to do it, could someone please provide an example launch.json and PyCharm run configuration settings file?
Related:
How to debug snakemake snakefile in visual studio code?