Skip to content

Commit

Permalink
Fix requirement actions (opea-project#500)
Browse files Browse the repository at this point in the history
Signed-off-by: Sun, Xuehao <[email protected]>
Signed-off-by: siddhivelankar23 <[email protected]>
  • Loading branch information
XuehaoSun authored and siddhivelankar23 committed Aug 22, 2024
1 parent df8dc36 commit 39cc3e3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual-freeze-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
- name: Commit changes
run: |
git add .
git commit -m "Freeze requirements"
git commit -s -m "Freeze requirements"
git push
16 changes: 10 additions & 6 deletions .github/workflows/scripts/freeze_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ function freeze() {
--output-file "$folder/freeze.txt" \
"$file"
echo "::endgroup::"

if [[ -e "$folder/freeze.txt" ]]; then
if [[ "$keep_origin_packages" == "true" ]]; then
sed -i '/^\s*#/d; s/#.*//; /^\s*$/d' "$file"
sed -i '/^\s*#/d; s/#.*//; /^\s*$/d' "$folder/freeze.txt"

packages1=$(cut -d'=' -f1 "$file" | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g')
# fix corner cases
sed -i '/^\s*#/d; s/#.*//; /^\s*$/d; s/ //g' "$file"
sed -i '/^\s*#/d; s/#.*//; /^\s*$/d; s/ //g; s/huggingface-hub\[inference\]/huggingface-hub/g; s/uvicorn\[standard\]/uvicorn/g' "$folder/freeze.txt"
if grep -q '^transformers$' $file && ! grep -q '^transformers\[sentencepiece\]$' $file; then
sed -i "s/transformers\[sentencepiece\]/transformers/" "$folder/freeze.txt"
fi
packages1=$(tr '><' '=' <"$file" | cut -d'=' -f1 | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g')
packages2=$(cut -d'=' -f1 "$folder/freeze.txt" | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g')
common_packages=$(comm -12 <(echo "$packages2" | sort) <(echo "$packages1" | sort))

rm "$file"
grep '^git\+' "$file" >temp_file || touch temp_file
rm -rf "$file" && mv temp_file "$file"
while IFS= read -r line; do
package=$(echo "$line" | cut -d'=' -f1)
package_transformed=$(echo "$package" | tr '[:upper:]' '[:lower:]' | sed 's/[_-]/-/g')
Expand Down
2 changes: 1 addition & 1 deletion comps/chathistory/mongo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
motor==3.4.0
motor==3.4.0
2 changes: 1 addition & 1 deletion comps/dataprep/redis/llama_index/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ docarray[full]
fastapi
huggingface_hub
langsmith
llama-index
llama-index
llama-index-embeddings-huggingface==0.2.0
llama-index-readers-file
llama-index-vector-stores-redis
Expand Down

0 comments on commit 39cc3e3

Please sign in to comment.