pypsa-meets-earth / pypsa-earth-sec

GNU General Public License v3.0
19 stars 16 forks source link

Git submodules #196

Closed davide-f closed 1 year ago

davide-f commented 1 year ago

Closes #195

Changes proposed in this Pull Request

Revise pypsa-earth dependency with git submodules and revise atlite deprecation.

Major commands to reproduce this PR are: git submodule add {github url} : adds the package at {github url} as a submodule within the current folder. Optionally commits/branches/... can be specified Note that the version will fix the pypsa-earth version to the current commit.

To update the submodule version to the latest commit, the following command can be used followed by a commit&PR to the repo: git submodule update

With the new version, it is recommended to clone the repo using git clone --recurse-submodules update {repo path} to automatically clone the pypsa-earth-sec repo AND the pypsa-earth submodule. README has been updated accordingly.

If only git clone update {repo path} is used, hence without the --recurse-submodules, then the command git submodule init is needed to fill the repo.

I don't think this needs a release_note, but if not, I'll be happy to add it.

Checklist

energyLS commented 1 year ago

I have read into fixing the submodules to a certain commit. Not sure wether git reset --hard is the best way, I am not a git export though. I have asked ChatGPT, the answer seems to make sense. @davide-f what do you think?

P.S. I have checked it out and it works fine

grafik grafik

davide-f commented 1 year ago

You mean: a. It is better to use checkout instead of reset: I agree b. To my knowledge and according to the guide, 'git submodule update' updates the entire workflow to the latest commit. I understand that it is possible to specify in the gitsubmodule the commit spec, but is it a good idea? That means that we keep by default a specific commit and it is very easy to loose track of what's going on in the main repo. That's why the proposal was to have that as an option

energyLS commented 1 year ago

You're right, we should keep it as it is. Just whenever needed we can set a specific commit, but not as default.