-
Notifications
You must be signed in to change notification settings - Fork 17
/
.envrc
28 lines (22 loc) · 847 Bytes
/
.envrc
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
layout_pdm() {
PYPROJECT_TOML="${PYPROJECT_TOML:-pyproject.toml}"
if [ ! -f "$PYPROJECT_TOML" ]; then
log_status "No pyproject.toml found. Executing \`pmd init\` to create a \`$PYPROJECT_TOML\` first."
pdm init --non-interactive --python "$(python3 --version 2>/dev/null | cut -d' ' -f2 | cut -d. -f1-2)"
fi
VIRTUAL_ENV=$(pdm venv list | grep "^\*" | awk -F" " '{print $3}')
if [ -z "$VIRTUAL_ENV" ] || [ ! -d "$VIRTUAL_ENV" ]; then
log_status "No virtual environment exists. Executing \`pdm info\` to create one."
pdm info
VIRTUAL_ENV=$(pdm venv list | grep "^\*" | awk -F" " '{print $3}')
fi
PATH_add "$VIRTUAL_ENV/bin"
export PDM_ACTIVE=1
export VIRTUAL_ENV
}
for file in flake.nix flake.lock pyproject.toml pdm.lock;
do
watch_file "$file"
done
use_flake
layout pdm