Repository navigation
Conversation
native-api
requested changes
Oct 4, 2026
Author
|
Thanks @native-api — updated the regression test to assert the #494 property directly: after activate, |
r3wretrhy
force-pushed
the
fix/virtual-env-symlink-path-494
branch
from
October 4, 2026 07:01
5c0e99c to
8893cb8
Compare
native-api
reviewed
Oct 4, 2026
Comment on lines
+519
to
+537
| assert_success | ||
| assert_output <<EOS | ||
| deactivated | ||
| export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/myenv"; | ||
| export VIRTUAL_ENV="${PYENV_ROOT}/versions/myenv"; | ||
| export _OLD_VIRTUAL_PS1="\${PS1:-}"; | ||
| export PS1="(myenv) \${PS1:-}"; | ||
| EOS | ||
|
|
||
| # Per #494: VIRTUAL_ENV must agree with the python PATH yields. | ||
| eval "$(printf '%s\n' "$output" | grep '^export ')" | ||
| path_python="$(command -v python)" | ||
| assert_equal "${VIRTUAL_ENV}/bin/python" "${path_python}" | ||
|
|
||
| unstub pyenv-version-name | ||
| unstub pyenv-virtualenv-prefix | ||
| unstub pyenv-prefix | ||
| unstub pyenv-sh-deactivate | ||
| } |
Member
There was a problem hiding this comment.
Are we just checking equality or enforcing some specific value? If the latter then the latter check is redundant. If the former then the former check is redundant.
Author
There was a problem hiding this comment.
Kept the equality check (assert_equal of VIRTUAL_ENV/bin/python vs command -v python) and dropped the redundant specific-value assert_output for VIRTUAL_ENV.
pyenv-virtualenv installs $PYENV_ROOT/versions/<name> as a symlink to .../versions/<base>/envs/<name>, and shims put that symlink path on PATH. Resolving the symlink when activating made VIRTUAL_ENV disagree with PATH, which tools like Neovim warn about. Leave the prefix as pyenv-prefix returned it so VIRTUAL_ENV matches PATH. Adds a regression test for pyenv#494.
r3wretrhy
force-pushed
the
fix/virtual-env-symlink-path-494
branch
from
October 5, 2026 14:32
8893cb8 to
390b7ca
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.
pyenv activateresolves$PYENV_ROOT/versions/<name>through the symlink into.../versions/<base>/envs/<name>before exportingVIRTUAL_ENV. Shims keep the symlink path onPATH, so tools that compare the two (Neovim, for example) warn that they disagree.Stop resolving that symlink on activate so
VIRTUAL_ENVmatches the path onPATH.Fixes #494.
Summary by cubic
Fixes
pyenvactivate soVIRTUAL_ENVmatches the symlink path that shims put onPATH, eliminating tool warnings (e.g. Neovim) about the two disagreeing.$PYENV_ROOT/versions/<name>symlink before exportingVIRTUAL_ENV; the prefix is now left aspyenv-prefixreturned it.Written for commit 390b7ca. Summary will update on new commits.