Skip to content

ci: fix model runs#522

Merged
FabianHofmann merged 8 commits into
PyPSA:masterfrom
lkstrp:ci-fix-model
Jun 3, 2026
Merged

ci: fix model runs#522
FabianHofmann merged 8 commits into
PyPSA:masterfrom
lkstrp:ci-fix-model

Conversation

@lkstrp
Copy link
Copy Markdown
Member

@lkstrp lkstrp commented Nov 24, 2025

Removed PACKAGE_NAME environment variable and adjusted package removal commands.
@lkstrp
Copy link
Copy Markdown
Member Author

lkstrp commented Dec 1, 2025

Hey @brynpickering,

I played around here and need your pixi help again. We can't do the same as in PyPSA/PyPSA#1443, since linopy is a dependency of pypsa. And pixi allows to remove it (why?) but does not allow to install it again. There is no --no-deps flag, which I would normally use and removing pypsa first and bringing it back after the linopy install, is hacky and does not work, since we lose the pinned range defined in eur then. There must be a proper way to handle this. Any ideas?

We could also remove it completely. But we had a serious bug introduced in a linopy a couple of months ago, which the model run tests would have caught.

@brynpickering
Copy link
Copy Markdown
Contributor

@lkstrp sorry for the late response - I missed this mention.

Likely linked to this issue: prefix-dev/pixi#3032

Just add pypsa back in as a pypi dependency pixi add --pypi pypsa for this CI check.

@FabianHofmann
Copy link
Copy Markdown
Collaborator

@lkstrp is this pr stale/unneeded?

@lkstrp
Copy link
Copy Markdown
Member Author

lkstrp commented Jun 1, 2026

@lkstrp is this pr stale/unneeded?

It's not, I just lost it. Thanks @brynpickering for fixing this!

@brynpickering
Copy link
Copy Markdown
Contributor

@lkstrp I think my latest updates should be doing the trick. Since we likely want this kind of check in multiple places (pypsa/linopy/atlite), we should consider creating a repository of reproducible actions. I did this in some past projects and it helped keep maintenance to a minimum since the actions are centralised. Only makes sense if we have a common set of them across projects.

@FBumann FBumann mentioned this pull request Jun 1, 2026
4 tasks
grep_line=$(grep -- '- pypsa' envs/environment.yaml)
if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
grep_line=$(grep -- '${{ github.event.repository.name }} = ' pixi.toml)
if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Isn't this breaking the pin detection? Why remove the "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because it's checking the pixi toml, and deps are defined differently there:

linopy = ">=0.6.1"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, the bash script is broken and fails silently. > needs quoting and the quote is not part of the string:

for v in ">=0.6.1" "<0.6.1" "==0.6.1"; do
    grep_line="linopy = \"$v\""

    # current
    if [[ $grep_line == *"<* || $grep_line == *"==* ]]; then
      cur="PINNED"; else cur="unpinned"
    fi

    # fixed
    if [[ $grep_line == *"<"* || $grep_line == *"=="* ]]; then
      fix="PINNED"; else fix="unpinned"
    fi

    printf '%-22s  current=%-8s  fixed=%s\n' "$grep_line" "$cur" "$fix"
  done

linopy = ">=0.6.1" current=unpinned fixed=unpinned
linopy = "<0.6.1" current=unpinned fixed=PINNED
linopy = "==0.6.1" current=unpinned fixed=PINNED

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@brynpickering, this is resolved?

Copy link
Copy Markdown
Collaborator

@FabianHofmann FabianHofmann Jun 3, 2026

Choose a reason for hiding this comment

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

anyway I merge the pr now as it is for sure improving

@lkstrp
Copy link
Copy Markdown
Member Author

lkstrp commented Jun 1, 2026

Since we likely want this kind of check in multiple places (pypsa/linopy/atlite), we should consider creating a repository of reproducible actions. I did this in some past projects and it helped keep maintenance to a minimum since the actions are centralised. Only makes sense if we have a common set of them across projects.

I do agree. I did think about it when copying all the release workflows from repo to repo a while ago, which are most likely now also not in sync anymore. Can you point me to where you set this up already? I never did

@brynpickering
Copy link
Copy Markdown
Contributor

brynpickering commented Jun 1, 2026

I do agree. I did think about it when copying all the release workflows from repo to repo a while ago, which are most likely now also not in sync anymore. Can you point me to where you set this up already? I never did

Annoyingly, I went to go to check on it and they've made the repo private 😩. I'll see if I have a clone somewhere since it was public and openly licensed at one point. EDIT: @lkstrp found it and uploaded a clone here

@brynpickering
Copy link
Copy Markdown
Contributor

@FabianHofmann I think this is now good to go, following your review. It runs as expected but fails on Zenodo retrieval. I assume this is beyond the scope of this PR to resolve?

@FabianHofmann FabianHofmann merged commit d8d52b4 into PyPSA:master Jun 3, 2026
22 of 23 checks passed
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