Skip to content

Conversation

euronion
Copy link
Contributor

@euronion euronion commented Aug 6, 2025

When working on a development branch or with the master branch installed in editable mode uv pip install -e ., the current logic retrieves powerplants.csv from the past minor release (not past patch).

This PR changes the behavior, such that in case of a development branch or the master branch, the data is always retrieved from the current HEAD of the branch that is on GitHub.
Will fail if the branch is not in the PyPSA/powerplantmatching repo in GitHub.

Changes proposed in this Pull Request

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@euronion euronion requested a review from lkstrp August 6, 2025 08:27
@fneum
Copy link
Member

fneum commented Aug 6, 2025

uv.lock committed by accident? Otherwise looks sensible!

@euronion
Copy link
Contributor Author

euronion commented Aug 6, 2025

No, uv.lock committed by habit (we have some repos where we commit it). Should I add it to the .gitignore?

@fneum
Copy link
Member

fneum commented Aug 6, 2025

I'll let @lkstrp decide, but it seems like changed line noise to me.

@lkstrp
Copy link
Member

lkstrp commented Aug 6, 2025

Ah maybe should have read here, before merging #252

As discussed, I am a bit against adding uv.lock before good process on when updating it

"""
from . import latest_release
from . import __version__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't like non absolute imports and not adding version.py as discussed is on purpose?


url: str = ""
if any(substr in __version__ for substr in ["dev", "post"]):
# Detect running from a development installation - retrieve data from the HEAD of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With version.py all the git stuff below would also not be needed, is it? Why would you want to retrieve powerplants.csv from an dev branch? Not sure if we wanna have an extra dependency for that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the version.py fixes things, then I would be fine to remove.
I was thinking about the case where someone is installing from master and suddenly receiving the wrong powerplants.csv (because it is taken from the tag version).

I guess packaging and shipping the powerplants.csv would be an alternative as well, instead of retrieving it from a semi-hardcoded URL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But powerplants.csv is only automatically update per release, so even when installing from master, you would retrieve the same file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I didn't consider this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want to change this, then I guess we can close here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants