Skip to content

Commit

Permalink
remove lock headers, automate relock
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Feb 7, 2024
1 parent 478b64d commit 4c2f15f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
1 change: 0 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-i https://pypi.org/simple
aiohttp==3.9.3; python_version >= '3.8'
aiosignal==1.3.1; python_version >= '3.7'
annotated-types==0.6.0; python_version >= '3.8'
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-i https://pypi.org/simple
aiohttp==3.9.3; python_version >= '3.8'
aiosignal==1.3.1; python_version >= '3.7'
async-timeout==4.0.3; python_version < '3.11'
Expand Down
43 changes: 43 additions & 0 deletions scripts/relock_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

# Parse optional flag -k, to be used when we want to base the process on an existing Pipfile.lock
KEEP_LOCK=false
OPTIND=1
while getopts 'k' opt; do
case $opt in
k) KEEP_LOCK=true ;;
*) echo 'Error in command line parsing' >&2
exit 1
esac
done
shift "$(( OPTIND - 1 ))"

# can change output file names with relock_dependencies.sh <prefix>
PREFIX=${1:-requirements}

# these steps might fail, but that's okay.
if ! "$KEEP_LOCK"; then
echo "Removing existing Pipfile.lock file"
rm -f Pipfile.lock
fi

echo "Removing existing requirement files"
pipenv --rm
rm -f $PREFIX.txt
rm -f dev-$PREFIX.txt

echo "Removing pip cache"
pip cache purge

# start enforcing failures
set -e

echo "Building Development Requirements"
pipenv --python 3.12 lock --clear --pre --dev-only
pipenv requirements --dev-only > dev-$PREFIX.txt

echo "Building Standard Requirements"
pipenv --python 3.12 lock --clear --pre
pipenv requirements > $PREFIX.txt

echo "OK!"

0 comments on commit 4c2f15f

Please sign in to comment.