Skip to content

Instantly share code, notes, and snippets.

@ShyftXero
Last active July 2, 2024 15:49
Show Gist options
  • Save ShyftXero/e2b5c02108ce426e426f872cd3d47cb0 to your computer and use it in GitHub Desktop.
Save ShyftXero/e2b5c02108ce426e426f872cd3d47cb0 to your computer and use it in GitHub Desktop.
uv python venv management
# include or add this to your .zshrc file
. "$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