Compare commits

...

39 commits
root ... main

Author SHA1 Message Date
f64ebcd0f1
fix 2024-09-29 20:53:02 +02:00
23e3475c91
venvs/relate 2024-09-29 20:49:09 +02:00
8e69d784fc
os 2024-09-29 20:17:19 +02:00
323a1df906
url_pypi 2024-09-29 19:11:10 +02:00
8d978b6cee
venv/action 2024-09-29 17:31:06 +02:00
1a78ce53e7
venvs/list 2024-09-29 17:28:16 +02:00
44a925feb4
venvs/link 2024-09-29 17:26:02 +02:00
b0a3ae00eb
venvs/install 2024-09-29 17:23:06 +02:00
e3051799b0
venvs/uv 2024-09-29 17:19:15 +02:00
1217bf8115
venvs/create 2024-09-29 17:16:17 +02:00
d4b8d62d41
root 2024-09-29 17:10:59 +02:00
d7765033ce
venvs/start 2024-09-29 17:07:32 +02:00
1482de91c2
split 2024-09-29 16:38:38 +02:00
34dc630b2f
deactivate 2024-09-29 16:21:42 +02:00
8f3f727ad3
11,10 2024-09-29 16:13:38 +02:00
f7de33f0e4
command,list_venv 2024-09-29 14:10:06 +02:00
0ba236e266
home/ 2024-09-29 13:59:43 +02:00
9f15391fe2
caches/remove,ls 2024-09-29 13:56:10 +02:00
c08d4a8fb8
caches 2024-09-29 13:54:57 +02:00
1824fe3338
fix 2024-09-29 13:47:07 +02:00
17f8310bfb
dir/py,venv 2024-09-29 13:42:43 +02:00
9e8b139a81
venv/python 2024-09-29 13:19:30 +02:00
59b25759c1
done 2024-09-29 12:56:14 +02:00
7e876c7642
allow-existing 2024-09-29 12:54:58 +02:00
34225beee3
venvs 2024-09-29 12:53:34 +02:00
e5123c896f
clean 2024-09-29 12:23:57 +02:00
b91acf76de
useless 2024-09-29 12:23:20 +02:00
9616edc523
uv_install 2024-09-29 12:19:08 +02:00
9d537b2247
dir 2024-09-29 12:12:31 +02:00
7e1f425dd4
mv 2024-09-29 02:16:09 +02:00
02ebf0d2cd
relocatable 2024-09-28 23:58:18 +02:00
d4b83a1bfa
py 2024-09-28 23:52:50 +02:00
4b09ebadc2
os 2024-09-28 23:47:31 +02:00
a5720bcb43
pip 2024-09-28 23:41:07 +02:00
114aabce9c
rwx 2024-09-28 23:40:14 +02:00
59f569b2ee
\ 2024-09-28 23:01:05 +02:00
ac89a75a7d
tabs 2024-09-28 22:49:09 +02:00
6491592e72
tabs 2024-09-28 22:47:29 +02:00
d6dd102a7c
re 2024-09-26 21:27:56 +02:00

176
re.sh Executable file
View file

@ -0,0 +1,176 @@
#! /usr/bin/env sh
root="/prj/venv"
url="http://localhost:8000"
url_pypi="${url}/pypi/os/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
}
caches() {
local command="${1}"
set \
".cache/pip" \
".cache/uv" \
".local/share/pip" \
".local/share/uv"
echo
echo "caches:"
for cache in "${@}"; do
"${command}" "${HOME}/${cache}"
done
}
deactivate() {
echo
echo "${VIRTUAL_ENV}"
export PATH="${OLD_PATH}"
echo "${PATH}"
unset OLD_PATH VIRTUAL_ENV
}
list() {
echo
ls -a -l "${1}/${2}"
}
list_venv() {
list "${1}" "bin"
}
pip_install() {
echo
pip install \
--index-url "${url_pypi}" \
--no-cache-dir \
"${@}"
}
remove() {
rm --force --recursive "${@}"
}
uv_install() {
set \
"pelican" \
\
"hatch" \
\
"Sphinx" \
"sphinx-rtd-theme" \
\
"gitlint" \
\
"pydoclint" \
"pylint" \
"ruff" \
\
"pytest" \
\
"toml" \
\
"twine" \
\
"mypy" \
"pyright" \
\
"ruamel.yaml" \
"PyYAML" \
"types-PyYAML"
echo
uv pip install --index-url "${url_pypi}" "${@}"
}
uv_python() {
echo
export UV_PYTHON_INSTALL_MIRROR="${url}/cpypy"
uv python install "${2}"
unset UV_PYTHON_INSTALL_MIRROR
}
uv_venv() {
echo
uv venv \
--allow-existing \
--index-url "${url_pypi}" \
--python "${2}" \
--relocatable \
--seed \
"${1}"
}
venvs() {
local action="${1}"
local venv version
set \
"3.12" \
"3.11" \
"3.10"
for version in "${@}"; do
url_pypi="${url}/pypi/${version}/simple"
venv="${root}/${version}"
echo
echo "${venv}${action}"
case "${action}" in
"create")
export UV_PYTHON_INSTALL_DIR="${venv}/cpypy"
echo "→ install python ${version}"
uv_python "${venv}" "${version}"
echo "→ create venv ${version}"
uv_venv "${venv}" "${version}"
unset UV_PYTHON_INSTALL_DIR
;;
"init")
activate "${venv}"
pip_install "uv"
deactivate
;;
"install")
activate "${venv}"
uv_install
deactivate
;;
"link")
activate "${venv}"
for module in "rwx"; do
ln --symbolic \
"/rwx/rwx/${module}" \
"${venv}/lib/python${version}/site-packages/${module}"
done
deactivate
;;
"list")
activate "${venv}"
list_venv "${venv}"
deactivate
;;
"relate")
absolute="$(readlink -f "${venv}/bin/python")"
prevenv="$(readlink -f "${venv}")"
relative=$(echo "${absolute}" | sed "s|${prevenv}|..|")
ln --force --symbolic "${relative}" "${venv}/bin/python"
;;
*) ;;
esac
done
}
caches remove
remove "${root}"
os="${root}/os"
python3 -m "venv" "${os}"
activate "${os}"
list_venv "${os}"
pip_install --upgrade "pip"
pip_install "uv"
list_venv "${os}"
venvs create
deactivate
venvs init
venvs relate
venvs link
venvs install
venvs list
caches list_venv