-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use uv to create python's venv by default
- Loading branch information
Showing
8 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
export MISE_PYTHON_DEFAULT_PACKAGES_FILE="$HOME/.default-python-packages" | ||
|
||
cat >.mise.toml <<EOF | ||
[env._.python] | ||
venv = {path = "my_venv", create=true} | ||
[tools] | ||
python = "3.12.3" | ||
uv = "0.3.4" | ||
EOF | ||
|
||
mise i | ||
assert "mise x -- python --version" "Python 3.12.3" | ||
assert "mise x -- uv --version" "uv 0.3.4" | ||
assert "mise env -s bash | grep VIRTUAL_ENV" "export VIRTUAL_ENV=$PWD/my_venv" | ||
assert "mise x -- which python" "$PWD/my_venv/bin/python" | ||
assert "mise x -- uv pip list" "Package Version | ||
------- ------- | ||
pip 24.0" | ||
|
||
# Allows opt-out uv's venv | ||
mkdir -p subdir | ||
cat >subdir/.mise.toml <<EOF | ||
[env._.python] | ||
venv = {path = "my_subvenv", create=true} | ||
[tools] | ||
python = "3.12.3" | ||
uv = "0.3.4" | ||
[settings] | ||
python_venv_stdlib = true | ||
EOF | ||
|
||
cd subdir || exit | ||
mise i | ||
assert "mise x -- python --version" "Python 3.12.3" | ||
assert "mise env -s bash | grep VIRTUAL_ENV" "export VIRTUAL_ENV=$PWD/my_subvenv" | ||
assert "mise x -- which python" "$PWD/my_subvenv/bin/python" | ||
assert_contains "ls $PWD/my_subvenv/" "include" # stdlib virtual venv has an "include" folder while uv doesn't |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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