fix: prepend virtualenv path rather than append #1751
Merged
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.
prepend virtualenv path rather than append
When using the
Syntax with nested directories, I found that
which python
would report the most globally available.mise.toml
virtualenv python rather than the more locally specific.mise.toml
. TheVIRTUAL_ENV
environment variable would be set correctly however, causing a bit of confusion initially.background
A minimal example:
And the output of
PATH
from themise-example/sub/nest
directory:changes
This change inserts the found virtualenv to the front of the
env_paths
instead, resulting in thePath Dirs
in the DEBUG output to be flipped and showing the correct python version when runningwhich python
:I added an
e2e
test to create a subdirectory to verify this, as well as a unit test. I verified the newe2e
test fails on the current main without the change:I'm not sure I completely like the unit test having to rely on the
cwd
and/
directories to pass - but I didn't see any test scaffolding / mocks to ensure aPath
exists. Let me know how you'd want this to change if anything.