feat(bundles): add torch-free all-no-torch extra to lfx-bundles#13886
feat(bundles): add torch-free all-no-torch extra to lfx-bundles#13886jordanrfrazier wants to merge 11 commits into
Conversation
lfx[bundles] resolves to lfx-bundles[all], which pulls torch via the cuga and codeagents providers. Add a generated all-no-torch aggregate (all minus those two, 70 of 72 providers) so slim/CPU images can install the full provider set without torch. Generated by consolidate_bundles.py via the new TORCH_EXTRAS set; bump lfx-bundles 1.0.0 -> 1.1.0. Add a guard test that re-resolves lfx-bundles[all-no-torch] and fails if any torch-family distribution appears, catching providers that pull torch transitively (e.g. via langchain/sentence-transformers) on future updates.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ Test Coverage AdvisorNo source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.11.0 #13886 +/- ##
==================================================
+ Coverage 59.58% 59.62% +0.04%
==================================================
Files 2349 2349
Lines 224820 224820
Branches 33523 33471 -52
==================================================
+ Hits 133954 134059 +105
+ Misses 89347 89242 -105
Partials 1519 1519
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 `@src/bundles/lfx-bundles/tests/test_all_no_torch_extra.py`:
- Around line 117-118: The guard in the test helper that runs uv pip compile is
treating every non-zero exit as an offline/registry issue, which hides real
resolver problems. Update the failure handling in the compile check so it only
calls pytest.skip for clearly transient environment failures (for example,
network/registry unavailability) and uses pytest.fail for unexpected resolver
errors such as invalid extras or dependency conflicts. Keep the logic localized
around the subprocess returncode handling in test_all_no_torch_extra.py so the
test still verifies the real behavior instead of masking failures.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 92e6e42c-608f-499e-8391-fa30133019f6
📒 Files selected for processing (3)
scripts/migrate/consolidate_bundles.pysrc/bundles/lfx-bundles/pyproject.tomlsrc/bundles/lfx-bundles/tests/test_all_no_torch_extra.py
| if proc.returncode != 0: | ||
| pytest.skip(f"could not resolve all-no-torch (offline / registry unavailable?):\n{proc.stderr[-800:]}") |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Don't skip every failed resolve.
Any non-zero uv pip compile exit currently turns this guard green, so an invalid extra or dependency conflict is indistinguishable from “offline/registry unavailable.” Only skip known transient environment failures; unexpected resolver errors should pytest.fail(...).
Suggested fix
if proc.returncode != 0:
- pytest.skip(f"could not resolve all-no-torch (offline / registry unavailable?):\n{proc.stderr[-800:]}")
+ stderr = proc.stderr.lower()
+ transient_markers = (
+ "offline",
+ "registry unavailable",
+ "temporary failure",
+ "timed out",
+ "connection",
+ "network",
+ "dns",
+ "tls",
+ "certificate",
+ )
+ if any(marker in stderr for marker in transient_markers):
+ pytest.skip(f"could not resolve all-no-torch (offline / registry unavailable?):\n{proc.stderr[-800:]}")
+ pytest.fail(f"uv failed to resolve all-no-torch:\n{proc.stderr[-800:]}")As per coding guidelines, "verify the tests actually cover the new or changed behavior rather than acting as placeholders."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if proc.returncode != 0: | |
| pytest.skip(f"could not resolve all-no-torch (offline / registry unavailable?):\n{proc.stderr[-800:]}") | |
| if proc.returncode != 0: | |
| stderr = proc.stderr.lower() | |
| transient_markers = ( | |
| "offline", | |
| "registry unavailable", | |
| "temporary failure", | |
| "timed out", | |
| "connection", | |
| "network", | |
| "dns", | |
| "tls", | |
| "certificate", | |
| ) | |
| if any(marker in stderr for marker in transient_markers): | |
| pytest.skip(f"could not resolve all-no-torch (offline / registry unavailable?):\n{proc.stderr[-800:]}") | |
| pytest.fail(f"uv failed to resolve all-no-torch:\n{proc.stderr[-800:]}") |
🤖 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 `@src/bundles/lfx-bundles/tests/test_all_no_torch_extra.py` around lines 117 -
118, The guard in the test helper that runs uv pip compile is treating every
non-zero exit as an offline/registry issue, which hides real resolver problems.
Update the failure handling in the compile check so it only calls pytest.skip
for clearly transient environment failures (for example, network/registry
unavailability) and uses pytest.fail for unexpected resolver errors such as
invalid extras or dependency conflicts. Keep the logic localized around the
subprocess returncode handling in test_all_no_torch_extra.py so the test still
verifies the real behavior instead of masking failures.
Source: Coding guidelines
erichare
left a comment
There was a problem hiding this comment.
LGTM @jordanrfrazier , a couple small comments but not blockers. Maybe look at them and the code rabbit comments but this is much needed to have a torchless “full” install.
Findings
1. scripts/migrate/consolidate_bundles.py:182 — Comment references a non-existent all-torch aggregate. The new comment reads “Excluded from the generated all-torch aggregate so it resolves torch-free.” There is no all-torch extra; the providers in TORCH_EXTRAS are excluded from all-no-torch. A future maintainer reading this could be misled about which aggregate the exclusion applies to. Should read all-no-torch.
2. src/bundles/lfx-bundles/tests/test_all_no_torch_extra.py:108 — The “real guard” resolution test skips on any non-zero exit, so a genuine torch regression can pass silently. test_all_no_torch_resolves_without_torch calls pytest.skip(...) whenever proc.returncode != 0. The intent (per the docstring) is to tolerate offline/registry-unavailable CI, but a non-zero exit can also mean a real resolution conflict — including one introduced by the very provider change this test is meant to catch. The torch assertion only runs on a clean exit, so in a CI environment where this resolve doesn’t fully succeed, the guard is effectively a no-op and goes green. This is an intentional tradeoff, but worth confirming the guard actually runs (not just skips) in CI — otherwise the structural test is the only real protection. Consider logging/surfacing skips so a perpetually-skipped guard is visible.
Benchmark harness used to measure lfx cold start and the planned TRM fork-from-warm path: forkserver_bench.py (cold/warm/concurrency/sustained/ ramp modes), Dockerfile.bench, the prewarm shim, and sample flows (no-LLM inputoutput, model flow, two CPU-intensive agent flows). Rough WIP; flow api_key fields are blank (read OPENAI_API_KEY from env at runtime).
Address CodeRabbit review on #13886: the resolution guard skipped on any non-zero uv pip compile exit, so an invalid extra or a torch-introducing dependency conflict would turn the test green. Skip only on transient network/registry failures; pytest.fail on unexpected resolver errors.
…torch aggregate - forkserver_bench.py: split two D205 multi-line summaries and one E501 - test_lfx_bundles_extras.py: exclude both generated aggregates (all, all-no-torch) from the per-provider drift checks and add an explicit guard that all-no-torch == all minus TORCH_EXTRAS (cuga, codeagents)
…mment Leftover from the all-torch -> all-no-torch rename; the comment referenced a non-existent all-torch aggregate. No behavior change.
scripts/bench/* was unrelated scope creep on this bundle PR; remove it.
Default `pip install langflow` no longer pulls torch. Two changes flip the default, plus the collateral fixes the flip requires: - langflow now depends on lfx-bundles[all-no-torch] instead of [all], dropping the torch-pulling bundle providers (cuga, codeagents) from the default install. - Remove the torch-pulling extras (cuga, docling, easyocr, opendsstar) from langflow-base[complete]. Their definitions remain, so each installs on demand; the File component's docling path is opt-in via `pip install "langflow[docling]"`. Collateral: - Declare openpyxl as a hard lfx dependency. It backs the File/Save-File .xlsx read/write path (pd.read_excel / to_excel(engine="openpyxl")) but was reachable only transitively via docling-slim -- without this the xlsx path breaks once docling becomes opt-in. - Regenerate uv.lock so the default resolution actually drops torch. Verified: `uv export --no-dev` resolves 0 torch packages and includes openpyxl (578 pkgs, down from ~689). - Update docs that claimed `pip install langflow` is the everything-included install. Builds on the lfx-bundles[all-no-torch] aggregate (#13886). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
…-all-no-torch-extra
|
Build successful! ✅ |
lfx[bundles] resolves to lfx-bundles[all], which pulls torch via the cuga and codeagents providers. Add a generated all-no-torch aggregate (all minus those two, 70 of 72 providers) so slim/CPU images can install the full provider set without torch. Generated by consolidate_bundles.py via the new TORCH_EXTRAS set; bump lfx-bundles 1.0.0 -> 1.1.0.
Add a guard test that re-resolves lfx-bundles[all-no-torch] and fails if any torch-family distribution appears, catching providers that pull torch transitively (e.g. via langchain/sentence-transformers) on future updates.
Summary by CodeRabbit
New Features
all-no-torchinstall option for the bundle, making it easier to install the full set of extras without torch-related dependencies.allandall-no-torchoptions.Bug Fixes