feat: add dump and dumps methods to Graph (#3202)
* feat(utils.py): add escape_json_dump function to escape JSON strings for Edge dictionaries * refactor(Output): streamline add_types method to prevent duplicate entries in types list for improved type management * feat(data.py): add classmethod decorator to validate_data for enhanced validation logic when checking data types * feat(setup.py): implement retry logic for loading starter projects to enhance robustness against JSON decode errors * fix(input_mixin.py): improve model_config formatting and update field_type alias for clarity and consistency in field definitions * feat(types.py): refactor vertex constructors to use NodeData and add input/output methods for better component interaction * feat(schema.py): add NodeData and Position TypedDicts for improved type safety and structure in vertex data handling * feat(base.py): update Vertex to use NodeData type and add to_data method for better data management and access * refactor(schema.py): update TargetHandle and SourceHandle models to include model_config attribute * Add TypedDict classes for graph schema serialization in `schema.py` * Refactor `Edge` class to improve handle validation and data handling - Consolidated imports and removed redundant `BaseModel` definitions for `SourceHandle` and `TargetHandle`. - Added `valid_handles`, `target_param`, and `_target_handle` attributes to `Edge` class. - Enhanced handle validation logic to distinguish between dictionary and string types. - Introduced `to_data` method to return edge data. - Updated attribute names to follow consistent naming conventions (`base_classes`, `input_types`, `field_name`). * Refactor `Edge` class to improve handle validation and data handling * Refactor: Standardize attribute naming and add `to_data` method in Edge class - Renamed attributes to use snake_case consistently (`baseClasses` to `base_classes`, `inputTypes` to `input_types`, `fieldName` to `field_name`). - Added `to_data` method to return `_data` attribute. - Updated validation methods to use new attribute names. * Refactor: Update Edge class to consistently use snake_case for attributes and improve validation logic for handles * Refactor: Change node argument type in add_node and _create_vertex methods to NodeData for better type safety and clarity * Refactor: Implement JSON serialization for graph data with `dumps` and `dump` methods, enhancing data export capabilities * Refactor: Add pytest fixtures for ingestion and RAG graphs, enhance test structure for better clarity and organization * Refactor: Add pytest fixtures for memory_chatbot_graph tests and improve test structure * Refactor: Remove unused methods in ComponentVertex class to streamline code and improve readability * Refactor: Remove unnecessary line in ComponentVertex class to enhance code clarity and maintainability * Refactor: Update import path for DefaultPromptField to improve code organization and maintainability in api_utils.py * Refactor: Update import path for DefaultPromptField to enhance code organization and maintainability in prompt.py * fix: Remove fixture in test_memory_chatbot.py that blocked db setup * Refactor: Add durations path for unit tests to improve test reporting * Refactor: Add splitting algorithm option for unit tests * Add async option to Makefile for unit tests and update GitHub Actions workflow - Introduced `async` variable in Makefile to conditionally run unit tests with or without parallel execution. - Updated `unit_tests` target in Makefile to handle `async` flag. - Modified GitHub Actions workflow to set `async=false` for unit tests.
This commit is contained in:
parent
8ece1cadf6
commit
bb1bc5c2df
19 changed files with 797 additions and 107 deletions
17
Makefile
17
Makefile
|
|
@ -18,7 +18,7 @@ env ?= .env
|
|||
open_browser ?= true
|
||||
path = src/backend/base/langflow/frontend
|
||||
workers ?= 1
|
||||
|
||||
async ?= true
|
||||
all: help
|
||||
|
||||
######################
|
||||
|
|
@ -130,14 +130,25 @@ coverage: ## run the tests and generate a coverage report
|
|||
@poetry run coverage erase
|
||||
|
||||
unit_tests: ## run unit tests
|
||||
ifeq ($(async), true)
|
||||
poetry run pytest src/backend/tests \
|
||||
--ignore=src/backend/tests/integration \
|
||||
--instafail -ra -n auto -m "not api_key_required" \
|
||||
--instafail -n auto -ra -m "not api_key_required" \
|
||||
--durations-path src/backend/tests/.test_durations \
|
||||
--splitting-algorithm least_duration \
|
||||
$(args)
|
||||
else
|
||||
poetry run pytest src/backend/tests \
|
||||
--ignore=src/backend/tests/integration \
|
||||
--instafail -ra -m "not api_key_required" \
|
||||
--durations-path src/backend/tests/.test_durations \
|
||||
--splitting-algorithm least_duration \
|
||||
$(args)
|
||||
endif
|
||||
|
||||
integration_tests: ## run integration tests
|
||||
poetry run pytest src/backend/tests/integration \
|
||||
--instafail -ra -n auto \
|
||||
--instafail -ra \
|
||||
$(args)
|
||||
|
||||
tests: ## run unit, integration, coverage tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue