From 45552cd1dff475aa4460b48f28bb6066755528af Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Fri, 8 May 2026 18:55:26 -0700 Subject: [PATCH] fix: Delete outdated components --- .../base/langflow/components/__init__.py | 21 ------ .../components/knowledge_bases/__init__.py | 69 ------------------- .../components/processing/__init__.py | 0 .../components/processing/converter.py | 8 --- 4 files changed, 98 deletions(-) delete mode 100644 src/backend/base/langflow/components/__init__.py delete mode 100644 src/backend/base/langflow/components/knowledge_bases/__init__.py delete mode 100644 src/backend/base/langflow/components/processing/__init__.py delete mode 100644 src/backend/base/langflow/components/processing/converter.py diff --git a/src/backend/base/langflow/components/__init__.py b/src/backend/base/langflow/components/__init__.py deleted file mode 100644 index 67f356a2f8..0000000000 --- a/src/backend/base/langflow/components/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -"""LangFlow Components module.""" - -from __future__ import annotations - -from typing import Any - -from lfx.components import __all__ as _lfx_all - -__all__: list[str] = list(_lfx_all) - - -def __getattr__(attr_name: str) -> Any: - """Forward attribute access to lfx.components.""" - from lfx import components - - return getattr(components, attr_name) - - -def __dir__() -> list[str]: - """Forward dir() to lfx.components.""" - return list(__all__) diff --git a/src/backend/base/langflow/components/knowledge_bases/__init__.py b/src/backend/base/langflow/components/knowledge_bases/__init__.py deleted file mode 100644 index 08d8557bd0..0000000000 --- a/src/backend/base/langflow/components/knowledge_bases/__init__.py +++ /dev/null @@ -1,69 +0,0 @@ -"""Langflow knowledge bases module - forwards to lfx.components.files_and_knowledge. - -This module provides backwards compatibility by forwarding all imports -to files_and_knowledge where the actual knowledge base components are located. -""" - -from __future__ import annotations - -import sys -from typing import TYPE_CHECKING, Any - -if TYPE_CHECKING: - import types - -from lfx.components.files_and_knowledge import __all__ as _lfx_all - -__all__: list[str] = list(_lfx_all) - -# Register redirected submodules in sys.modules for direct importlib.import_module() calls -# This allows imports like: import langflow.components.knowledge_bases.ingestion -_redirected_submodules = { - # "langflow.components.knowledge_bases.ingestion": "lfx.components.files_and_knowledge.ingestion", - "langflow.components.knowledge_bases.retrieval": "lfx.components.files_and_knowledge.retrieval", -} - -for old_path, new_path in _redirected_submodules.items(): - if old_path not in sys.modules: - # Use a lazy loader that imports the actual module when accessed - class _RedirectedModule: - _module: types.ModuleType | None - - def __init__(self, target_path: str, original_path: str): - self._target_path = target_path - self._original_path = original_path - self._module = None - - def __getattr__(self, name: str) -> Any: - if self._module is None: - from importlib import import_module - - self._module = import_module(self._target_path) - # Also register under the original path for future imports - sys.modules[self._original_path] = self._module - return getattr(self._module, name) - - def __repr__(self) -> str: - return f" '{self._target_path}'>" - - sys.modules[old_path] = _RedirectedModule(new_path, old_path) # type: ignore[assignment] - - -def __getattr__(attr_name: str) -> Any: - """Forward attribute access to lfx.components.files_and_knowledge.""" - # Handle submodule access for backwards compatibility - if attr_name == "retrieval": - from importlib import import_module - - result = import_module("lfx.components.files_and_knowledge.retrieval") - globals()[attr_name] = result - return result - - from lfx.components import files_and_knowledge - - return getattr(files_and_knowledge, attr_name) - - -def __dir__() -> list[str]: - """Forward dir() to lfx.components.files_and_knowledge.""" - return list(__all__) diff --git a/src/backend/base/langflow/components/processing/__init__.py b/src/backend/base/langflow/components/processing/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/backend/base/langflow/components/processing/converter.py b/src/backend/base/langflow/components/processing/converter.py deleted file mode 100644 index bc74b5f8a7..0000000000 --- a/src/backend/base/langflow/components/processing/converter.py +++ /dev/null @@ -1,8 +0,0 @@ -# Forward import for converter utilities -# We intentionally keep this file, as the redirect to lfx in components/__init__.py -# only supports direct imports from lfx.components, not sub-modules. -# -# This allows imports from langflow.components.processing.converter. to still function. -from lfx.components.processing.converter import convert_to_dataframe - -__all__ = ["convert_to_dataframe"]