Last active
July 26, 2024 15:50
-
-
Save ShyftXero/e2b5c02108ce426e426f872cd3d47cb0 to your computer and use it in GitHub Desktop.
uv python venv management
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
# include or add this to your .zshrc file | |
# curl -fsSL https://gist.githubusercontent.com/ShyftXero/e2b5c02108ce426e426f872cd3d47cb0/raw/uv_venv.sh >> ~/.zshrc | |
. "$HOME/.cargo/env" | |
#ensure uv is installed https://astral.sh/uv | |
if ! command -v uv &> /dev/null | |
then | |
echo "uv could not be found. installing... " | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
fi | |
# this is only to remind me that this is an alias | |
function verbose_alias { | |
local name=${1%%=*} expansion=${1#*=} | |
eval "function $name { | |
printf >&2 '%s is an alias for %s\\n' \"$name\" \"$expansion\"; | |
$expansion \"\$@\"; | |
}" | |
} | |
verbose_alias pip='uv pip ' | |
verbose_alias venv='uv venv venv --preview --allow-existing ' | |
alias svenv='source venv/bin/activate || source .venv/bin/activate' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment