.local/bin: added new fuctions for creating python_env

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2026-02-10 13:56:16 +01:00
parent d209a982cd
commit 86b8444c03
2 changed files with 62 additions and 0 deletions

20
.local/bin/python_env Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
source "$HOME"/.local/bin/functions
# Function for creating a python env
python_env(){
[ -z "$PYTHONVERSION" ] && err "Python version is not set"
command_exists virtualenv
timestamp "Creating Python environment with version $PYTHONVERSION"
rm -rf .venv .env && timestamp "Old Python environment has been removed"
virtualenv -p "$PYTHONVERSION" .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/pip install -r requirements.txt --break --force
}
python_env "$@"