-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcreate_uvenv
More file actions
executable file
·49 lines (40 loc) · 1.12 KB
/
create_uvenv
File metadata and controls
executable file
·49 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -euo pipefail
# set -x
DEF_NAME=pallas-slenderpy-uv
PYTHON_VERSION="--python-preference=system"
# PYTHON_VERSION="--python 3.11"
# PYTHON_VERSION="--python 3.12"
# PYTHON_VERSION="--python 3.13"
# PYTHON_VERSION="--python 3.14"
# -----------------------------------------------------------------------------
# -- dir for all envs
ENV_DIR=${ENV_DIR:-$HOME/ENV}
mkdir -p $ENV_DIR
# -- check uv install, update if necessary
if ! command -v uv &> /dev/null; then
echo "uv not found; installing ..."
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
else
# uv self update
echo "uv already installed ($(uv --version))"
fi
# -- current env with link
VENV=${ENV_DIR}/${DEF_NAME}
VLNK=.uvenv
ln -sf $VENV $VLNK
uv venv --clear $VENV ${PYTHON_VERSION}
source $VENV/bin/activate
# -- upgrade pip
uv pip install --upgrade pip
# -- install local package
rm -rf build
uv pip install .[examples,dev]
# -- end text
echo "---"
echo -e "\e[1mto start the environment, type :\e[0m"
echo "source ${VENV}/bin/activate"
echo ""
echo -e "\e[1mto stop the environment, type :\e[0m"
echo "deactivate"