Add freeze command

This commit is contained in:
Sage 2026-01-21 13:24:28 +00:00
parent 78927884c0
commit 8fa97234e4

View file

@ -2,7 +2,7 @@
set -e set -e
if [ "$1" = "py" ] && [ "$2" = "init" ]; then if [ "$1" = "init" ] && [ "$2" = "py" ]; then
echo "Initializing python devenv..." echo "Initializing python devenv..."
# 1. Init devenv # 1. Init devenv
@ -94,8 +94,23 @@ EOF
exit 1 exit 1
fi fi
elif [ "$1" = "freeze" ]; then
extra_index_url="https://europe-west1-python.pkg.dev/mk2-prod/python-packages/simple/"
# Install the auth plugin and keyring CLI
uv pip install keyrings.google-artifactregistry-auth==1.1.2 keyring
# Install project dependencies using the subprocess keyring provider
uv pip install --no-cache -e .[test] --extra-index-url "${extra_index_url}" --keyring-provider subprocess
# Generate requirements.txt
echo "--extra-index-url ${extra_index_url}" > requirements.txt
uv pip freeze --exclude-editable >> requirements.txt
else else
echo "Usage: hr py init" echo "Usage: hr <command>"
echo " py init Initialize a python devenv environment (git-ignored)" echo "Commands:"
echo " init py Initialize a python devenv environment (git-ignored)"
echo " freeze Freeze dependencies to requirements.txt"
exit 1 exit 1
fi fi