Skip to content

Commit 787d157

Browse files
update script, fix some comp imports
1 parent aa9e45b commit 787d157

File tree

8 files changed

+6296
-7438
lines changed

8 files changed

+6296
-7438
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ build_component_index: ## build the component index with dynamic loading
443443
@make install_backend
444444
@echo 'Building component index'
445445
LFX_DEV=1 uv run python scripts/build_component_index.py
446-
LFX_DEV=1 uv run python scripts/build_hash_history.py
446+
LFX_DEV=1 uv run python scripts/build_hash_history.py --debug
447447

448448
lfx_build: ## build the LFX package
449449
@echo 'Building LFX package'

scripts/build_hash_history.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ def _import_components() -> tuple[dict, int]:
5858

5959

6060
def update_history(
61-
history: dict, component_name: str, code_hash: str, current_version: str, executes_code: bool = False
61+
history: dict,
62+
component_name: str,
63+
code_hash: str,
64+
current_version: str,
65+
executes_code: bool = False,
66+
debug: bool = False,
6267
) -> dict:
6368
"""Updates the hash history for a single component with the new simple schema.
6469
@@ -70,6 +75,7 @@ def update_history(
7075
code_hash: Hash of the component code
7176
current_version: Current version string
7277
executes_code: Whether the component executes arbitrary code (default: False)
78+
debug: Whether to print debug information (default: False)
7379
"""
7480
current_version_parsed = Version(current_version)
7581
# Use the string representation of the version as the key
@@ -103,6 +109,19 @@ def update_history(
103109
f"version {current_version}."
104110
)
105111
raise ValueError(msg)
112+
113+
# Check if we're updating an existing version's hash
114+
if version_key in history[component_name]["versions"]:
115+
old_hash_data = history[component_name]["versions"][version_key]
116+
# Extract hash from either string or dict format
117+
old_hash = old_hash_data if isinstance(old_hash_data, str) else old_hash_data.get("hash")
118+
119+
if old_hash != code_hash:
120+
if debug:
121+
print(
122+
f" [DEBUG] Updating hash for {component_name} v{version_key}: {old_hash}{code_hash}"
123+
)
124+
106125
history[component_name]["versions"][version_key] = version_data
107126

108127
return history
@@ -151,6 +170,7 @@ def main(argv=None):
151170
"""Main entry point for the script."""
152171
parser = argparse.ArgumentParser(description="Build and update component hash history.")
153172
parser.add_argument("--nightly", action="store_true", help="Update the nightly hash history.")
173+
parser.add_argument("--debug", action="store_true", help="Print debug information about hash updates.")
154174
args = parser.parse_args(argv)
155175

156176
current_version = get_lfx_version()
@@ -181,6 +201,9 @@ def main(argv=None):
181201
print(f"✓ Version check passed: {current_version} is a stable version")
182202
print("Updating stable hash history...")
183203

204+
if args.debug:
205+
print("[DEBUG] Debug mode enabled - will show hash updates")
206+
184207
modules_dict, components_count = _import_components()
185208
print(f"Found {components_count} components.")
186209
if not components_count:
@@ -207,7 +230,9 @@ def main(argv=None):
207230
if executes_code:
208231
print(f" → Component {comp_name} marked as executes_code=True")
209232

210-
new_history = update_history(new_history, comp_name, code_hash, current_version, executes_code)
233+
new_history = update_history(
234+
new_history, comp_name, code_hash, current_version, executes_code, debug=args.debug
235+
)
211236

212237
# Validate append-only constraint before saving
213238
validate_append_only(old_history, new_history)

src/lfx/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ build-backend = "hatchling.build"
5656
[tool.hatch.build.targets.wheel]
5757
packages = ["src/lfx"]
5858

59+
[tool.hatch.build.targets.sdist]
60+
include = ["src/lfx"]
61+
5962
[tool.pytest.ini_options]
6063
asyncio_mode = "auto"
6164
testpaths = ["tests"]

src/lfx/src/lfx/_assets/component_index.json

Lines changed: 19 additions & 23 deletions
Large diffs are not rendered by default.

src/lfx/src/lfx/_assets/stable_hash_history.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
"AmazonBedrockConverseModel": {
6868
"versions": {
69-
"0.3.0": "54c335f8699f"
69+
"0.3.0": "a7442bb44851"
7070
}
7171
},
7272
"AmazonBedrockEmbeddings": {
@@ -611,7 +611,7 @@
611611
},
612612
"URLComponent": {
613613
"versions": {
614-
"0.3.0": "f773f55e3820"
614+
"0.3.0": "8caf1fd1e0cd"
615615
}
616616
},
617617
"UnifiedWebSearch": {
@@ -1710,7 +1710,7 @@
17101710
},
17111711
"VLMRunTranscription": {
17121712
"versions": {
1713-
"0.3.0": "c91e2349a3df"
1713+
"0.3.0": "3cebea003b94"
17141714
}
17151715
},
17161716
"Weaviate": {

src/lfx/src/lfx/components/amazon/amazon_bedrock_converse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from langflow.field_typing import LanguageModel
2-
from langflow.inputs.inputs import BoolInput, FloatInput, IntInput, MessageTextInput, SecretStrInput
3-
from langflow.io import DictInput, DropdownInput
1+
from lfx.field_typing import LanguageModel
2+
from lfx.inputs.inputs import BoolInput, FloatInput, IntInput, MessageTextInput, SecretStrInput
3+
from lfx.io import DictInput, DropdownInput
44

55
from lfx.base.models.aws_constants import AWS_REGIONS, AWS_MODEL_IDs
66
from lfx.base.models.model import LCModelComponent

src/lfx/src/lfx/components/vlmrun/vlmrun_transcription.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from pathlib import Path
22
from urllib.parse import urlparse
33

4-
from langflow.custom.custom_component.component import Component
5-
from langflow.io import (
4+
from lfx.custom.custom_component.component import Component
5+
from lfx.io import (
66
DropdownInput,
77
FileInput,
88
IntInput,
99
MessageTextInput,
1010
Output,
1111
SecretStrInput,
1212
)
13-
from langflow.schema.data import Data
13+
from lfx.schema.data import Data
1414
from loguru import logger
1515

1616

0 commit comments

Comments
 (0)