fix: update stale detached environment and build symlinks#6154
Open
kilian-hu wants to merge 1 commit into
Open
fix: update stale detached environment and build symlinks#6154kilian-hu wants to merge 1 commit into
kilian-hu wants to merge 1 commit into
Conversation
1480301 to
f66276e
Compare
f66276e to
9830a29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Unix-like systems, when using pixi detached environments, pixi creates a symlink
.pixi/envsthat points to a directory in the pixi cache like/Users/user/Library/Caches/rattler/cache/envs/some-project-name-5275720292851974748/envsbut right now it only does this once because that symlink creation is coupled to a check that is only run once and potentially emits a warning if.pixi/envs/already existed as a directory which pixi rightfully does not delete because that could have unintended consequences.When changing the location of the pixi cache directory, this symlink can become stale because pixi does not check if it is still correct. We usually do not notice because pixi internally does not use this symlink but tooling like an IDE which needs to know about the currently used Python interpreter then might use the wrong interpreter or not find an interpreter at all.
This PR ensures that pixi always checks if the symlink is still correct and updates it if necessary. On Windows, the behavior is different because it does not ever create such a symlink and pixi instead creates a readme file with a note that points to the actual location of the envs but that readme file currently can also become stale so this PR updates this as well. Since this is similar for pixi build which can also use a detached build dir, I adjusted this as well in a similar manner.
How Has This Been Tested?
Manually tested whether pixi with this fix updates stale the stale symlinks. I do not have a Windows machine at my disposal, so I rely on CI to run the Windows test case.
AI Disclosure
Tools: Codex with gpt-5.5 xhigh
Checklist:
schema/model.py.