Files
langflow/scripts/ci/test_constraint_preservation.py
vjgit96 c1b423862d fix: preserve [complete] extra in langflow-base pre-release constraint (#11931)
* fix: preserve [complete] extra in langflow-base pre-release constraint

The sed replacement for pre-release builds was dropping the [complete]
extra from the langflow-base dependency, causing the built wheel to
depend on bare langflow-base instead of langflow-base[complete]. This
meant hundreds of optional dependencies (LLM providers, vector stores,
document loaders, etc.) were missing from pre-release installs, breaking
the CLI and all cross-platform installation tests.

* test: add regression test for sed constraint preservation

* [autofix.ci] apply automated fixes

* test: add regression test for sed constraint preservation in release workflow

* [autofix.ci] apply automated fixes

* test: add regression test for sed constraint preservation in release workflow

* [autofix.ci] apply automated fixes

* fix: move noqa comment to correct line for S603 check

* [autofix.ci] apply automated fixes

* test: add regression test for sed constraint preservation in release workflow

* [autofix.ci] apply automated fixes

* test: add regression test for sed constraint preservation in release workflow

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-27 10:00:39 -05:00

43 lines
1.3 KiB
Python

import subprocess
# Simulate the sed pattern from release.yml
# The pattern should preserve trailing commas
SED_PATTERN = 's|"langflow-base[^"]*"|"langflow-base[complete]>=0.8.0.rc3,<1.dev0"|g'
TEST_CASES = [
' "langflow-base[complete]~=0.8.0",',
' "langflow-base~=0.8.0",',
' "langflow-base[openai]~=0.8.0",',
' "langflow-base[complete]>=0.8.0,<1.dev0",',
' "langflow-base[complete]>=0.8.0.rc2,<1.dev0",',
]
EXPECTED = ' "langflow-base[complete]>=0.8.0.rc3,<1.dev0",'
def run_sed(input_line):
"""Run sed on input line and return the result."""
# Use sed with stdin/stdout instead of file operations
result = subprocess.run( # noqa: S603
["sed", SED_PATTERN], # noqa: S607
input=input_line,
capture_output=True,
text=True,
check=True,
)
# Use rstrip() to only remove trailing whitespace (newline), preserve leading spaces
return result.stdout.rstrip()
def test_all():
for i, case in enumerate(TEST_CASES):
output = run_sed(case)
if output != EXPECTED:
msg = f"Test case {i + 1} failed: {case}{output}"
raise AssertionError(msg)
print("All sed constraint preservation tests passed.")
if __name__ == "__main__":
test_all()