Skip to content

fix: add offline wheel lookup to repackaged plugins#67

Open
UncleFB wants to merge 1 commit into
junjiem:mainfrom
UncleFB:main
Open

fix: add offline wheel lookup to repackaged plugins#67
UncleFB wants to merge 1 commit into
junjiem:mainfrom
UncleFB:main

Conversation

@UncleFB
Copy link
Copy Markdown

@UncleFB UncleFB commented May 21, 2026

Summary by CodeRabbit

  • Improvements

    • Optimized offline wheel installation in the repackaging workflow with enhanced requirements file management and improved dependency handling for cross-platform compatibility.
  • Chores

    • Refined package configuration with better ignore file handling and cleaner workflow management during repackaging operations across different operating systems.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

The PR refactors how the repackaging script configures offline wheel installation. A new update_requirements_for_offline() helper function is added to inject offline flags into a requirements file via awk, replacing previous inline sed logic. The repackage flow now calls this helper and updates the selected ignore file (.difyignore or .gitignore) to expose the wheels directory on Linux.

Changes

Offline Requirements Update Refactoring

Layer / File(s) Summary
Offline requirements helper function and integration
plugin_repackaging.sh
Adds update_requirements_for_offline() to inject --no-index and --find-links=./wheels/ via awk while avoiding duplicates. The repackage Step 4 now calls this helper instead of inline sed insertion, then selects and updates the appropriate ignore file (.difyignore or .gitignore) to remove wheels entries on Linux.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A helper born from sed's old way,
Now awk refines the offline day,
With wheels exposed and flags injected clean,
The simplest refactor ever seen. 🐰⚙️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding offline wheel lookup functionality to repackaged plugins by introducing the update_requirements_for_offline() function.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugin_repackaging.sh`:
- Around line 157-160: The current awk snippet in plugin_repackaging.sh that
rewrites "$REQFILE" only removes one exact combined flag and misses other forms;
update the filter to remove any lines that are standalone "--no-index", any
"--find-links" using "=" or space, with or without "./" and trailing slashes
(e.g. "--find-links=./wheels", "--find-links ./wheels",
"--find-links=../wheels/"), and also remove the case where "--no-index" and
"--find-links" are on separate lines; then prepend the canonical combined line
"--no-index --find-links=./wheels/" at the top as before and write back to
"$REQFILE" (use patterns like /^--no-index($|[[:space:]])/ and
/^--find-links([=[:space:]]).*(\/?wheels\/?)$/ to identify and drop all
variants).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 007ba004-a623-4af0-80a3-0cb94d9e689d

📥 Commits

Reviewing files that changed from the base of the PR and between 1a2cb48 and 4b72d2c.

📒 Files selected for processing (1)
  • plugin_repackaging.sh

Comment thread plugin_repackaging.sh
Comment on lines +157 to +160
awk '
BEGIN { print "--no-index --find-links=./wheels/" }
$0 !~ /^--no-index[[:space:]]+--find-links=\.\/wheels\/?$/ { print }
' "$REQFILE" > "$REQFILE.tmp" && mv "$REQFILE.tmp" "$REQFILE"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Dedup logic misses common --find-links forms, so offline flags can accumulate.

The awk filter only removes one exact combined line. Existing lines like --find-links=./wheels, --find-links ./wheels, or separate --no-index remain, so repeated runs can keep stale/duplicate resolver flags.

Suggested fix
 	awk '
-		BEGIN { print "--no-index --find-links=./wheels/" }
-		$0 !~ /^--no-index[[:space:]]+--find-links=\.\/wheels\/?$/ { print }
+		BEGIN { print "--no-index --find-links=./wheels/" }
+		# Drop any existing no-index / find-links directives so output is canonical and idempotent.
+		$0 ~ /^[[:space:]]*--no-index([[:space:]]|$)/ { next }
+		$0 ~ /^[[:space:]]*--find-links([=[:space:]]|$)/ { next }
+		{ print }
 	' "$REQFILE" > "$REQFILE.tmp" && mv "$REQFILE.tmp" "$REQFILE"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin_repackaging.sh` around lines 157 - 160, The current awk snippet in
plugin_repackaging.sh that rewrites "$REQFILE" only removes one exact combined
flag and misses other forms; update the filter to remove any lines that are
standalone "--no-index", any "--find-links" using "=" or space, with or without
"./" and trailing slashes (e.g. "--find-links=./wheels", "--find-links
./wheels", "--find-links=../wheels/"), and also remove the case where
"--no-index" and "--find-links" are on separate lines; then prepend the
canonical combined line "--no-index --find-links=./wheels/" at the top as before
and write back to "$REQFILE" (use patterns like /^--no-index($|[[:space:]])/ and
/^--find-links([=[:space:]]).*(\/?wheels\/?)$/ to identify and drop all
variants).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant