Skip to content

Commit 45325f6

Browse files
feat: Langflow SDK and Flow DevOps API Toolkit (#12245)
* feat(sdk): add langflow-sdk Python client package * feat(lfx): add Flow DevOps CLI toolkit * feat(api): add flow upsert, export normalization, ZIP upload * chore: CI coverage merge, Docker fixes, dependency updates * Address CQ5 review / import bug * Update test_status_command.py * Update test_status_command.py * Fix more tests * Review edits * Review edits * Fix tests * Follow up review updates * Refactor common client code * Update templates and comp index * [autofix.ci] apply automated fixes * Update test_database.py * Updates from review comments * Fix push interface to match the rest * Update push.py * Update push.py --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 61bc076 commit 45325f6

98 files changed

Lines changed: 20702 additions & 1559 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.secrets.baseline

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@
16431643
"filename": "src/backend/base/langflow/api/utils/core.py",
16441644
"hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
16451645
"is_verified": false,
1646-
"line_number": 440,
1646+
"line_number": 413,
16471647
"is_secret": false
16481648
}
16491649
],
@@ -7147,16 +7147,6 @@
71477147
"is_secret": false
71487148
}
71497149
],
7150-
"src/lfx/tests/unit/cli/test_serve_simple.py": [
7151-
{
7152-
"type": "Secret Keyword",
7153-
"filename": "src/lfx/tests/unit/cli/test_serve_simple.py",
7154-
"hashed_secret": "3acfb2c2b433c0ea7ff107e33df91b18e52f960f",
7155-
"is_verified": false,
7156-
"line_number": 67,
7157-
"is_secret": false
7158-
}
7159-
],
71607150
"src/lfx/tests/unit/components/langchain_utilities/test_csv_agent.py": [
71617151
{
71627152
"type": "Secret Keyword",

docker/build_and_push.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ COPY ./src/backend/base/uv.lock /app/src/backend/base/uv.lock
4848
COPY ./src/backend/base/pyproject.toml /app/src/backend/base/pyproject.toml
4949
COPY ./src/lfx/README.md /app/src/lfx/README.md
5050
COPY ./src/lfx/pyproject.toml /app/src/lfx/pyproject.toml
51+
COPY ./src/sdk/README.md /app/src/sdk/README.md
52+
COPY ./src/sdk/pyproject.toml /app/src/sdk/pyproject.toml
5153

5254
RUN --mount=type=cache,target=/root/.cache/uv \
5355
RUSTFLAGS='--cfg reqwest_unstable' \

docker/build_and_push_backend.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN apt-get update \
2929
# Copy only backend source (excludes frontend)
3030
COPY ./src/backend ./src/backend
3131
COPY ./src/lfx ./src/lfx
32+
COPY ./src/sdk ./src/sdk
3233

3334
# Create venv and install langflow-base with dependencies
3435
# Using uv pip instead of uv sync to avoid workspace complexities
@@ -37,7 +38,7 @@ ENV PATH="/app/.venv/bin:$PATH"
3738
ENV VIRTUAL_ENV="/app/.venv"
3839

3940
RUN --mount=type=cache,target=/root/.cache/uv \
40-
uv pip install ./src/lfx "./src/backend/base[complete,postgresql]"
41+
uv pip install ./src/sdk ./src/lfx "./src/backend/base[complete,postgresql]"
4142

4243
################################
4344
# RUNTIME

pyproject.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ explicit = true
6969
langflow-base = { workspace = true }
7070
langflow = { workspace = true }
7171
lfx = { workspace = true }
72+
langflow-sdk = { workspace = true }
7273
torch = { index = "pytorch-cpu" }
7374
torchvision = { index = "pytorch-cpu" }
7475

@@ -77,6 +78,7 @@ members = [
7778
"src/backend/base",
7879
".",
7980
"src/lfx",
81+
"src/sdk",
8082
]
8183

8284
[tool.hatch.build.targets.wheel]
@@ -313,6 +315,46 @@ external = ["RUF027"]
313315
"src/lfx/src/lfx/inputs/input_mixin.py" = [
314316
"S105", # False positive: PASSWORD is a type constant
315317
]
318+
"src/lfx/src/lfx/__main__.py" = [
319+
"B008", # Typer CLI requires function calls in argument defaults
320+
"FBT001", # Bool flags are the standard typer pattern
321+
"FBT003", # Boolean positional values in typer.Option() calls
322+
]
323+
"src/lfx/src/lfx/cli/_setup_commands.py" = [
324+
"B008", # Typer CLI requires function calls in argument defaults
325+
"FBT001", # Bool flags are the standard typer pattern
326+
"FBT003", # Boolean positional values in typer.Option() calls
327+
]
328+
"src/lfx/src/lfx/cli/_authoring_commands.py" = [
329+
"B008", # Typer CLI requires function calls in argument defaults
330+
"FBT001", # Bool flags are the standard typer pattern
331+
"FBT003", # Boolean positional values in typer.Option() calls
332+
]
333+
"src/lfx/src/lfx/cli/_running_commands.py" = [
334+
"B008", # Typer CLI requires function calls in argument defaults
335+
"FBT001", # Bool flags are the standard typer pattern
336+
"FBT003", # Boolean positional values in typer.Option() calls
337+
]
338+
"src/lfx/src/lfx/cli/_remote_commands.py" = [
339+
"B008", # Typer CLI requires function calls in argument defaults
340+
"FBT001", # Bool flags are the standard typer pattern
341+
"FBT003", # Boolean positional values in typer.Option() calls
342+
]
343+
"src/backend/base/langflow/api/utils/*" = [
344+
"TCH", # Imports are used at runtime (FastAPI deps, SQLAlchemy queries, model constructors)
345+
]
346+
"src/sdk/src/langflow_sdk/_http.py" = [
347+
"TCH", # httpx is used at runtime (response object methods)
348+
]
349+
"src/sdk/src/langflow_sdk/environments.py" = [
350+
"TRY003", # Contextual error messages are necessary here
351+
"EM102", # f-string messages assigned before raise where possible
352+
]
353+
"src/sdk/tests/*" = [
354+
"S101", # assert is the standard pytest assertion style
355+
"INP001", # Not a package namespace issue in tests
356+
"TC003", # pytest fixture type hints are evaluated at runtime
357+
]
316358
"src/lfx/src/lfx/schema/table.py" = [
317359
"S105", # False positive: PASSWORD is a formatter type
318360
]

src/backend/base/langflow/api/utils/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
allowing for better code organization.
66
"""
77

8-
# Re-export everything from core module to maintain backward compatibility
8+
# Re-export everything from core and flow_utils modules to maintain backward compatibility
99
from langflow.api.utils.core import (
1010
API_WORDS,
1111
MAX_PAGE_SIZE,
@@ -17,12 +17,7 @@
1717
EventDeliveryType,
1818
ValidatedFileName,
1919
ValidatedFolderName,
20-
build_and_cache_graph_from_data,
21-
build_graph_from_data,
22-
build_graph_from_db,
23-
build_graph_from_db_no_cache,
2420
build_input_keys_response,
25-
cascade_delete_flow,
2621
check_langflow_version,
2722
custom_params,
2823
extract_global_variables_from_headers,
@@ -34,11 +29,20 @@
3429
get_suggestion_message,
3530
get_top_level_vertices,
3631
has_api_terms,
32+
normalize_code_for_import,
33+
normalize_flow_for_export,
3734
parse_exception,
3835
parse_value,
3936
raise_error_if_astra_cloud_env,
4037
remove_api_keys,
4138
validate_is_component,
39+
)
40+
from langflow.api.utils.flow_utils import (
41+
build_and_cache_graph_from_data,
42+
build_graph_from_data,
43+
build_graph_from_db,
44+
build_graph_from_db_no_cache,
45+
cascade_delete_flow,
4246
verify_public_flow_and_get_user,
4347
)
4448

@@ -75,6 +79,8 @@
7579
"get_top_level_vertices",
7680
# Functions
7781
"has_api_terms",
82+
"normalize_code_for_import",
83+
"normalize_flow_for_export",
7884
"parse_exception",
7985
"parse_value",
8086
"raise_error_if_astra_cloud_env",

0 commit comments

Comments
 (0)