Skip to content

Commit

Permalink
Improve clarity and efficiency in "pip conflicts check" workflow (#1731)
Browse files Browse the repository at this point in the history
- [x] Identify missing `%pip install` commands in notebooks with clear
error messages
- [x] Reduce `pip install` output for cleaner analysis

---------

Signed-off-by: Ilya Trushkin <[email protected]>
Co-authored-by: Artur Paniukov <[email protected]>
  • Loading branch information
itrushkin and apaniukov authored Feb 26, 2024
1 parent 55b2092 commit 5ad4a5a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .ci/pip_conflicts_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ find "$(pwd)" -type f -name "*.ipynb" -exec realpath --relative-to="$(pwd)" {} +

# Convert to Python script first to flatten multi-line commands
output=$(jupyter nbconvert --no-prompt --to script --stdout "$file")
matched=$(grep -Po "$PARSER_REGEX" <<< "$output" || { echo "No %pip install line found in $file"; exit 1; })

matched=$(grep -Po "$PARSER_REGEX" <<< "$output" || true)
if [ -z "$matched" ]; then
echo "ERROR: No '%pip install' command found in $file"
exit 1
fi

while IFS= read -r line; do
index_url=$(grep -Po "(--index-url \S+)" <<< "$line" || true)
extra_index_url=$(grep -Po "(--extra-index-url \S+)" <<< "$line" || true)
Expand All @@ -63,4 +67,4 @@ find "$(pwd)" -type f -name "*.ipynb" -exec realpath --relative-to="$(pwd)" {} +
echo "-r ${req_file_name##*/}" >> "$REQ_FILE" # add partial requirements to the main file
done
echo "Checking requirements..."
python -m pip install -vvv -r $REQ_FILE --dry-run --ignore-installed
python -m pip install -r $REQ_FILE --dry-run --ignore-installed

0 comments on commit 5ad4a5a

Please sign in to comment.