Add check and prepush script.

This commit is contained in:
g_it 2026-04-06 22:16:43 +02:00
commit 0f13893693
Signed by untrusted user who does not match committer: g_it
GPG key ID: A2B0A7C06A054627
4 changed files with 144 additions and 5 deletions

34
.envrc Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
# Check if .venv exists
if [[ -d ".venv" ]]; then
# Activate the virtual environment
export VIRTUAL_ENV="$PWD/.venv"
export PATH="$VIRTUAL_ENV/bin:$PATH"
# Verify we're using the right Python
if [[ -x "$VIRTUAL_ENV/bin/python3.14" ]]; then
export PYTHONPATH="$PWD/src:$PYTHONPATH"
echo "Activated virtual environment: $VIRTUAL_ENV"
else
echo "Warning: Virtual environment Python not found"
fi
else
echo "Warning: No .venv directory found"
fi
# Run pip to update packages inside the venv
echo "Running pip update..."
"$VIRTUAL_ENV/bin/python3.14" -m pip install --upgrade pip
"$VIRTUAL_ENV/bin/python3.14" -m pip install --no-cache-dir --upgrade $(pip list --format=freeze | grep -v '^\-e' | cut -d = -f 1 | tr '\n' ' ')
# Update requirements.txt with pinned versions only if installs succeeded
if [[ $? -eq 0 ]]; then
"$VIRTUAL_ENV/bin/python3.14" -m pip freeze > requirements.txt
echo "Packages updated successfully"
else
echo "pip install failed; requirements.txt not updated"
fi
echo "Environment configured with direnv"