Skip to content

Commit 58a55c2

Browse files
committed
fix: address version bump review feedback
1 parent e6e1483 commit 58a55c2

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ patch: ## Update version across all projects. Usage: make patch v=1.5.0 [sdk_v=0
642642
if ! grep -q "^version = \"$$LANGFLOW_VERSION\"" src/lfx/pyproject.toml; then echo "$(RED)✗ LFX pyproject.toml version validation failed$(NC)"; exit 1; fi; \
643643
if ! grep -q "^version = \"$$SDK_VERSION\"" src/sdk/pyproject.toml; then echo "$(RED)✗ SDK pyproject.toml version validation failed$(NC)"; exit 1; fi; \
644644
if ! grep -q "\"langflow-sdk>=$$SDK_VERSION\"" src/lfx/pyproject.toml; then echo "$(RED)✗ LFX SDK dependency validation failed$(NC)"; exit 1; fi; \
645-
if ! grep -q "\"version\": \"$$LANGFLOW_VERSION\"" src/lfx/src/lfx/_assets/component_index.json; then echo "$(RED)✗ Component index version validation failed$(NC)"; exit 1; fi; \
645+
if ! python -c 'import json, sys; index = json.load(open(sys.argv[1], encoding="utf-8")); raise SystemExit(index.get("version") != sys.argv[2])' src/lfx/src/lfx/_assets/component_index.json "$$LANGFLOW_VERSION"; then echo "$(RED)✗ Component index version validation failed$(NC)"; exit 1; fi; \
646646
if ! grep -q "\"version\": \"$$LANGFLOW_VERSION\"" src/frontend/package.json; then echo "$(RED)✗ Frontend package.json version validation failed$(NC)"; exit 1; fi; \
647647
echo "$(GREEN)✓ All versions updated successfully$(NC)"; \
648648
\

src/backend/tests/unit/test_bundle_lfx_pin.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
from pathlib import Path
1616

1717
import pytest
18-
import tomllib
18+
19+
try:
20+
import tomllib
21+
except ModuleNotFoundError: # Python 3.10: tomllib is stdlib only on 3.11+
22+
import tomli as tomllib
1923

2024
REPO_ROOT = Path(__file__).resolve().parents[4]
2125
_SCRIPT = REPO_ROOT / "scripts" / "ci" / "sync_bundle_lfx_pin.py"
@@ -145,7 +149,10 @@ def test_bundle_manifests_match_distribution_versions():
145149
"""Keep published extension identity aligned with wheel metadata."""
146150
for pyproject in sorted((REPO_ROOT / "src" / "bundles").glob("*/pyproject.toml")):
147151
project_version = tomllib.loads(pyproject.read_text(encoding="utf-8"))["project"]["version"]
148-
for manifest in pyproject.parent.glob("src/*/extension.json"):
152+
manifests = sorted(pyproject.parent.glob("src/*/extension.json"))
153+
if pyproject.parent.name != "lfx-bundles":
154+
assert manifests, f"{pyproject.relative_to(REPO_ROOT)} is missing extension.json"
155+
for manifest in manifests:
149156
manifest_version = json.loads(manifest.read_text(encoding="utf-8"))["version"]
150157
assert manifest_version == project_version, (
151158
f"{manifest.relative_to(REPO_ROOT)} has version {manifest_version}, "

src/lfx/tests/unit/test_patch_regexes.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import annotations
99

10+
import json
1011
import re
1112

1213
# ---------------------------------------------------------------------------
@@ -45,6 +46,18 @@ def _patch_lfx_pyproject(txt: str, langflow_version: str) -> str:
4546
return re.sub(r'^version = ".*"', f'version = "{langflow_version}"', txt, flags=re.MULTILINE)
4647

4748

49+
def _patch_sdk_pyproject(txt: str, sdk_version: str) -> str:
50+
return re.sub(r'^version = ".*"', f'version = "{sdk_version}"', txt, flags=re.MULTILINE)
51+
52+
53+
def _patch_lfx_sdk_dependency(txt: str, sdk_version: str) -> str:
54+
return re.sub(r'"langflow-sdk(?:==|>=|~=)[^"]*"', f'"langflow-sdk>={sdk_version}"', txt)
55+
56+
57+
def _component_index_version_matches(txt: str, langflow_version: str) -> bool:
58+
return json.loads(txt).get("version") == langflow_version
59+
60+
4861
# ---------------------------------------------------------------------------
4962
# langflow-core pins in main pyproject.toml
5063
# ---------------------------------------------------------------------------
@@ -220,6 +233,43 @@ def test_realistic_lfx_fragment(self):
220233
assert "Lightweight executor" in result
221234

222235

236+
# ---------------------------------------------------------------------------
237+
# SDK version and LFX SDK dependency
238+
# ---------------------------------------------------------------------------
239+
240+
241+
class TestSdkVersionSubstitution:
242+
def test_updates_sdk_version(self):
243+
txt = '[project]\nname = "langflow-sdk"\nversion = "0.3.0"\n'
244+
result = _patch_sdk_pyproject(txt, "0.4.0")
245+
assert 'version = "0.4.0"' in result
246+
assert 'name = "langflow-sdk"' in result
247+
248+
def test_updates_lfx_sdk_dependency(self):
249+
txt = 'dependencies = ["langflow-sdk~=0.3.0", "orjson>=3.10.0"]'
250+
result = _patch_lfx_sdk_dependency(txt, "0.4.0")
251+
assert '"langflow-sdk>=0.4.0"' in result
252+
assert '"orjson>=3.10.0"' in result
253+
254+
255+
# ---------------------------------------------------------------------------
256+
# component-index version validation
257+
# ---------------------------------------------------------------------------
258+
259+
260+
class TestComponentIndexVersionValidation:
261+
def test_accepts_matching_top_level_version(self):
262+
index = {"entries": [], "version": "1.12.0"}
263+
assert _component_index_version_matches(json.dumps(index), "1.12.0")
264+
265+
def test_rejects_nested_match_when_top_level_version_is_stale(self):
266+
index = {
267+
"entries": [["example", {"metadata": {"dependencies": [{"name": "langflow", "version": "1.12.0"}]}}]],
268+
"version": "1.11.0",
269+
}
270+
assert not _component_index_version_matches(json.dumps(index), "1.12.0")
271+
272+
223273
# ---------------------------------------------------------------------------
224274
# release.yml: major.minor extraction from the current lfx constraint
225275
#

0 commit comments

Comments
 (0)