This commit is contained in:
Marc Beninca 2024-09-26 21:27:56 +02:00
parent 4216ce769a
commit d6dd102a7c
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

108
re.sh Executable file
View file

@ -0,0 +1,108 @@
#! /usr/bin/env sh
root="/prj"
url="http://localhost:8000"
url_pypi="${url}/pypi/simple"
activate() {
echo
export VIRTUAL_ENV="${1}"
echo "${VIRTUAL_ENV}"
export OLD_PATH="${PATH}"
export PATH="${VIRTUAL_ENV}/bin:${PATH}"
echo "${PATH}"
python3 --version
pip --version
}
deactivate() {
echo
echo "${VIRTUAL_ENV}"
export PATH="${OLD_PATH}"
echo "${PATH}"
unset OLD_PATH VIRTUAL_ENV
}
list() {
echo
ls -a -l "${1}/bin"
}
pip_install() {
echo
pip install --index-url "${url_pypi}" "${@}"
}
remove() {
rm --force --recursive "${@}"
}
uv_install() {
echo
uv pip install --index-url "${url_pypi}" "${@}"
}
uv_python() {
echo
export UV_PYTHON_INSTALL_MIRROR="${url}/cpypy"
uv python install
#--cache-dir "${1}/cpypy"
unset UV_PYTHON_INSTALL_MIRROR
}
uv_venv() {
echo
uv venv --index-url "${url_pypi}" --seed "${1}"
#--cache-dir "${1}/cpypy"
}
remove ~/.cache/pip ~/.local/share/uv
pip="${root}/venv.pip"
uv="${root}/venv"
remove "${pip}" "${uv}"
python3 -m "venv" "${pip}"
activate "${pip}"
list "${pip}"
pip_install --upgrade "pip"
pip_install "uv"
list "${pip}"
uv_python "${uv}"
uv_venv "${uv}"
deactivate
remove "${pip}"
activate "${uv}"
list "${uv}"
pip_install "uv"
list "${uv}"
set \
\
"pelican" \
\
"hatch" \
\
"Sphinx" \
"sphinx-rtd-theme" \
\
"gitlint" \
"pydoclint" \
"pylint" \
"ruff" \
\
"pytest" \
\
"toml" \
\
"twine" \
\
"mypy" \
"pyright" \
\
"ruamel.yaml" \
"PyYAML" \
"types-PyYAML"
uv_install "${@}"
list "${uv}"