forked from langflow-ai/langflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: script and workflow to update starter projects (langflow-ai#5195)
- Loading branch information
1 parent
9ead148
commit ba31d43
Showing
23 changed files
with
1,350 additions
and
2,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,6 @@ on: | |
paths: | ||
- "**/*.py" | ||
|
||
|
||
|
||
|
||
|
||
jobs: | ||
lint: | ||
name: Ruff Style Check | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Script to update Langflow starter projects with the latest component versions.""" | ||
|
||
import asyncio | ||
import os | ||
|
||
import langflow.main # noqa: F401 | ||
from langflow.initial_setup.setup import ( | ||
get_project_data, | ||
load_starter_projects, | ||
update_edges_with_latest_component_versions, | ||
update_project_file, | ||
update_projects_components_with_latest_component_versions, | ||
) | ||
from langflow.interface.types import get_and_cache_all_types_dict | ||
from langflow.services.deps import get_settings_service | ||
from langflow.services.utils import initialize_services | ||
|
||
|
||
async def main(): | ||
"""Updates the starter projects with the latest component versions. | ||
Copies the code from langflow/initial_setup/setup.py. Doesn't use the | ||
create_or_update_starter_projects function directly to avoid sql interactions. | ||
""" | ||
await initialize_services(fix_migration=False) | ||
all_types_dict = await get_and_cache_all_types_dict(get_settings_service()) | ||
|
||
starter_projects = await load_starter_projects() | ||
for project_path, project in starter_projects: | ||
_, _, _, _, project_data, _, _, _, _ = get_project_data(project) | ||
do_update_starter_projects = os.environ.get("LANGFLOW_UPDATE_STARTER_PROJECTS", "true").lower() == "true" | ||
if do_update_starter_projects: | ||
updated_project_data = update_projects_components_with_latest_component_versions( | ||
project_data.copy(), all_types_dict | ||
) | ||
updated_project_data = update_edges_with_latest_component_versions(updated_project_data) | ||
if updated_project_data != project_data: | ||
project_data = updated_project_data | ||
await update_project_file(project_path, project, updated_project_data) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 6 additions & 111 deletions
117
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 2 additions & 37 deletions
39
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 2 additions & 36 deletions
38
src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.