Commit graph

161 commits

Author SHA1 Message Date
Ítalo Johnny
067c1d7fc2
fix: remove duplicated Makefile target format_frontend (#9191)
fix: remove duplicated format_frontend target to silence warnings

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-30 12:01:28 +00:00
Gabriel Luiz Freitas Almeida
cd4464d6b1
refactor(tests): parameterize template tests and update timeout use (#9224)
* refactor: Simplify flow execution validation by removing unnecessary asyncio.wait_for calls

Updated the validate_flow_execution function to directly use the client.post and client.get methods with a timeout parameter, improving code readability and maintainability. This change eliminates redundant timeout handling while ensuring consistent timeout values across API calls.

* refactor: Enhance template tests for improved structure and validation

Refactored the template tests in `test_starter_projects.py` to utilize parameterization for better readability and maintainability. Introduced helper functions to retrieve template files and disabled tracing for all tests. Updated individual test methods to validate JSON structure, flow execution, and endpoint validation, ensuring comprehensive coverage of template functionality. This change streamlines the testing process and enhances the robustness of the test suite.

* refactor: Update project metadata and import paths in starter project JSON files

Modified the metadata section in multiple starter project JSON files to reflect updated code hashes and module paths, transitioning from 'lfx' to 'langflow' components. This change enhances consistency across the codebase and ensures that the correct modules are referenced for improved maintainability and clarity.

* chore: Update template test commands to utilize parallel execution

Modified the commands in the Makefile and CI workflows to include the `-n auto` option for pytest, enabling parallel test execution for the starter project template tests. This change enhances test performance and efficiency across the codebase.

* chore: Remove  news-aggregated.json file

Deleted the news-aggregated.json file

* Update test_template_validation.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-29 22:32:48 +00:00
Yuqi Tang
d0e4e7d1cc
feat: Add template tests (#9083)
* add template tests

* remove files

* adding validate flow build

* add validate endpoint and flow execution

* Update .github/workflows/template-tests.yml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/backend/base/langflow/utils/template_validation.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* change workflow running

* add ci

* fix test

* fix test

* delete when push

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Exclude template tests from unit test bundle

Template tests are already run separately in CI via the test-templates job.
This change prevents duplicate execution and eliminates timeout failures
in the unit test suite by excluding slow template execution tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Remove remaining merge conflict markers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Improve validate.py unit tests to eliminate CI failures

Fixed 4 failing tests in test_validate.py:
- test_code_with_syntax_error: Better error message handling for syntax errors
- test_raises_error_for_missing_function: Handle StopIteration along with ValueError
- test_creates_simple_class: Use optional constructor parameter to avoid TypeError
- test_handles_validation_error: Use proper ValidationError constructor from pydantic_core
- test_creates_context_with_langflow_imports: Remove invalid module patching
- test_creates_mock_classes_on_import_failure: Use proper import mocking

All 50 validate tests now pass consistently, improving CI stability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* enhance: Add comprehensive edge case tests for template_validation.py

Added 6 additional test cases to improve coverage of template_validation.py:
- test_validate_stream_exception: Tests Graph.validate_stream() exception handling
- test_code_validation_other_exceptions: Tests TypeError/KeyError/AttributeError handling
- test_vertices_sorted_without_end_vertex_events: Tests variable usage tracking
- test_vertex_count_tracking: Tests vertex_count increment paths
- test_empty_lines_in_stream: Tests empty line handling in event streams
- test_event_stream_validation_exception: Tests exception handling in _validate_event_stream

These tests target the remaining 7 uncovered lines to maximize coverage percentage.
Total tests: 40 (all passing)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-28 18:32:24 +00:00
Mike Fortman
0f89e39da1
feat: Move to Biome for linting and formatting (#8997)
* init biome

* lint

* format

* unused vars

* more unused vars

* error fixes

* import ordering

* test precommit hook

* add precommit hook

* [autofix.ci] apply automated fixes

* remove prettier and eslint and update gh actions

* pre-commit update

*  (Makefile): add new targets 'biome' and 'biome_check' to run biome check and format on frontend code.

* 🔧 (Makefile): rename 'biome' target to 'format_frontend' for clarity and consistency
🔧 (Makefile): rename 'biome_check' target to 'format_frontend_check' for clarity and consistency

* 📝 (biome.json): Update a11y rule in biome.json to turn off 'noStaticElementInteractions' warning
🔧 (apiModal/code-tabs.tsx): Remove unused 'autologin' variable in APITabsComponent
♻️ (global-variable-modal.tsx): Simplify GeneralGlobalVariableModal component by removing unused props definition

* 📝 (biome.json): Remove 'debug' from allowed console methods to improve code quality
🔧 (index.tsx): Replace console.debug with console.log for better logging consistency
♻️ (index.tsx): Refactor UpdateAllComponents function signature to remove unnecessary empty object parameter

* fix console rules

* 📝 (biome.json): update a11y rule to warn for noStaticElementInteractions to improve accessibility compliance.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2025-07-15 18:46:51 +00:00
Deon Sanchez
ff00eb582f
fix: improves table formatting in the playground and adds Jest tests (#8743)
* feat(tests): add Jest configuration and setup for testing environment

- Introduced Jest configuration file to set up testing environment with TypeScript support and JSDOM.
- Added setupTests.ts for global test configurations, including mocks for ResizeObserver and IntersectionObserver.
- Updated package.json and package-lock.json to include Jest and related dependencies.
- Implemented utility functions for processing markdown content, including handling tables and <think> tags.
- Added comprehensive tests for markdown utility functions to ensure proper functionality.

* refactor(makefile): separate frontend commands into a dedicated Makefile

- Removed frontend-related targets from the main Makefile and created a new Makefile.frontend to manage frontend-specific commands.
- Updated the main Makefile to include a reference to the new frontend Makefile and added a help message for frontend commands.
- This restructuring improves organization and clarity for managing backend and frontend build processes.
2025-06-30 21:13:04 +00:00
Gabriel Luiz Freitas Almeida
8ae85abb9f
feat(makefile): add patch target for automated version management (#8719)
* feat: Add version management to Makefile for streamlined updates

* Introduced a new `patch` target in the Makefile to update version numbers across all projects.
* The target updates `pyproject.toml` and `package.json` files, syncing backend and frontend dependencies.
* Includes error handling for missing version argument and cleanup of backup files after updates.

* refactor: Replace sed commands with Python scripts for version updates in Makefile

* Updated the `patch` target in the Makefile to use Python for modifying version numbers in `pyproject.toml` and `package.json`, enhancing readability and maintainability.
* Removed cleanup of backup files as they are no longer created with the new approach.

* chore: Update Makefile to remove frozen flag from uv sync command

* Modified the `patch` target in the Makefile to remove the `--frozen` flag from the `uv sync` command, allowing for more flexible dependency synchronization.
* This change enhances the update process for backend dependencies.

* chore: Enhance Makefile patch target with validation and parallel dependency syncing

* Updated the `patch` target in the Makefile to include validation checks for version changes in `pyproject.toml` and `package.json`.
* Implemented parallel execution for syncing backend and frontend dependencies to improve efficiency.
* Added final state validation to ensure expected files are modified after the update process.
* Improved user feedback during the version update process with clear success and error messages.
2025-06-24 23:11:18 +00:00
Gabriel Luiz Freitas Almeida
dbaa8a1c6f
refactor: simplify init target by removing cache cleanup and adding pre-commit hook (#8590)
* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-06-23 13:46:55 +00:00
Deon Sanchez
f091d6373c
fix: add selected_output field to components & templates to prevent disconnected edges (#8444)
* feat: add selected_output property to Component and update validation logic

* feat: add selected_output property to various components and update related logic

* fix: improve error handling in JSON processing and update type hints

* refactor: clean up Makefile and reorder JSON properties in Vector Store RAG.json

* Removed the update_selected_outputs target from the Makefile to streamline the build process.
* Reordered properties in Vector Store RAG.json for consistency, ensuring "selected_output" appears before "type" in multiple entries.

* chore: remove add_selected_outputs.py script

* Deleted the add_selected_outputs.py script, which was responsible for adding selected_output fields to Langflow JSON template files. This script is no longer needed as part of the project.

* chore: clean up Makefile by removing unnecessary blank line

* Removed an extra blank line in the Makefile to improve readability and maintain consistency.

* chore: tidy up Makefile by adding a blank line for better readability

* Added a blank line before the help target in the Makefile to enhance readability and maintain consistency in formatting.

* chore: remove unnecessary blank line in Makefile

* Eliminated an extra blank line before the help target in the Makefile to enhance readability and maintain consistency in formatting.

* [autofix.ci] apply automated fixes

* fix(GenericNode): update output selection logic to use selected_output name

* Modified the logic for selecting the initial output in GenericNode to match the selected_output name from the data object.
* Adjusted the return logic in NodeOutputs to ensure it correctly handles the selected output state.

* fix(GenericNode): refine output selection logic to prioritize selected outputs

* Updated the output selection logic in the cleanEdges function to filter for selected outputs before finding the matching output by name. This change enhances the accuracy of output handling for generic nodes.

* updated blog writer

* fix: update Memory Chatbot configuration for improved message handling

- Adjusted JSON structure for Memory Chatbot to ensure correct output types and display names.
- Added new input fields for sender type and refined existing fields for clarity.
- Enhanced message retrieval methods to support dynamic output based on selected modes.
- Improved overall structure for better integration with Langflow components.

* Update src/backend/base/langflow/custom/custom_component/component.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* [autofix.ci] apply automated fixes

* Ruff linting error fix

* [autofix.ci] apply automated fixes

* fix: Update test to reflect change in heading from "OpenAi" to "Language Model"

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Eric Hare <ericrhare@gmail.com>
2025-06-13 15:51:37 +00:00
yihong
61e345a029
fix: wrong command in Makefile since drop poetry (#6745)
* fix: wrong command in Makefile since drop poetry

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

* fix: address comments

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

* fix: update Makefile to use uvx for codespell commands

---------

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-06-03 11:33:31 +00:00
Gabriel Luiz Freitas Almeida
4953227391
chore: Update Makefile to include PostgreSQL in backend installation (#7561)
fix: update Makefile to include 'postgresql' in backend installation command
2025-04-10 17:23:24 +00:00
Christophe Bornet
d9b8211a18
build: Bump ruff version to 0.9.7 (#6614)
* Bump ruff version to 0.9.7

* [autofix.ci] apply automated fixes

* refactor: Update Gmail Agent starter project to Langflow 1.2.0

This commit updates the Gmail Agent starter project with new node IDs and configuration reflecting Langflow version 1.2.0. Changes include:
- Updated node identifiers for Agent, ChatInput, ChatOutput, and ComposioAPI
- Refreshed project metadata and version information
- Minor adjustments to node configurations and viewport settings

* [autofix.ci] apply automated fixes

* fix: Revert Gmail Agent name to original

* fix: Remove trailing comma in Gmail Agent JSON

* feat: Add tags to Gmail Agent starter project

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-02-26 20:36:36 +00:00
Jordan Frazier
400572342f
feat: add nvidia ingest component (#6333)
* initial

* cleanup

* [autofix.ci] apply automated fixes

* ruff

* add else

* update deps

* uv lock

* Make nv-ingest an optional dep

* revert change to validate

* rebase fixes

* [autofix.ci] apply automated fixes

* Update language

* add extra args to make target

* [autofix.ci] apply automated fixes

* update error language

* lockfile update

* rebase lockfile:

* [autofix.ci] apply automated fixes

* Adds nv-ingest by default to -ep docker image

* caps fixes

* update uv lock

* revert ruff upgrade

* ruff

* Fix lint

* [autofix.ci] apply automated fixes

* No code changes made.

* fix: update ruff configuration to ignore additional linting rule and allow built-in modules

* fix: update ruff command to ignore linting rule A005 during autofix

* fix: update Ruff check command to ignore linting rule A005

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-02-20 19:26:03 +00:00
Christophe Bornet
41edba73c9
feat: Add support for Python 3.13 (#6685) 2025-02-20 18:13:21 +00:00
Gabriel Luiz Freitas Almeida
e1fb90074c
chore: Enhance Locust load testing and optimize database settings (#6265)
* feat: Enhance Locust load testing for Langflow run endpoint

Refactor locustfile to provide more robust and configurable load testing:
- Add dynamic configuration via environment variables
- Improve error handling and logging
- Implement realistic flow run simulation
- Add connection and timeout handling
- Support API key authentication
- Enhance stats tracking and error reporting

* fix: Improve transaction logging error handling and performance

- Add `no_autoflush` context to prevent unnecessary database operations
- Change transaction logging error from exception to error level logging
- Simplify error handling in log_transaction function

* chore: Add Locust to development dependencies

Update project dependencies by adding Locust (version 2.32.9) to the development requirements, supporting load testing capabilities

* feat: Optimize database connection settings for improved performance and scalability

- Increase default pool_size from 10 to 20 for better connection handling
- Adjust max_overflow to 40 to support higher concurrent connections
- Extend db_connect_timeout from 20 to 30 seconds
- Add pool_recycle and echo settings to db_connection_settings
- Enhance documentation for database connection settings, highlighting SQLite limitations

* feat: Add Locust load testing configuration to Makefile

- Introduce comprehensive Locust load testing target with configurable parameters
- Support flexible testing scenarios with customizable users, spawn rate, and host
- Enable headless and interactive testing modes
- Add environment variable support for API key, flow ID, and other testing parameters
- Provide sensible default values for load testing configuration

* refactor: Remove unused retry configuration in Locust load testing

- Remove RETRY_DELAY and MAX_RETRIES environment variables
- Simplify FlowRunUser configuration by eliminating unused retry settings
- Maintain existing wait time configuration for load testing

* feat: Enforce FLOW_ID requirement for Locust load testing

- Add mandatory validation for FLOW_ID environment variable
- Raise a clear ValueError if FLOW_ID is not provided
- Remove default flow ID to ensure explicit configuration
- Improve load testing configuration robustness

* feat: Add configurable request timeout for Locust load testing

- Introduce `locust_request_timeout` parameter in Makefile
- Update locustfile to use configurable request timeout from environment variable
- Set dynamic connection and network timeout based on REQUEST_TIMEOUT
- Improve request handling with flexible timeout configuration

* revert change to database connection retry
2025-02-17 14:26:36 +00:00
Ítalo Johnny
93d5a22c56
fix: adjust path to run only unit tests (#5184)
* fix: adjust path to run only unit tests

* style: split unit test command for readability
2025-01-08 13:40:08 +00:00
Gabriel Luiz Freitas Almeida
039f80cb50
refactor: Enhance frontend build process with detailed logging and error handling (#5473) 2024-12-27 12:23:54 -08:00
Gabriel Luiz Freitas Almeida
37126991f4
ci: Update Makefile to show output during frontend build (#5472) 2024-12-27 11:09:47 -08:00
Gabriel Luiz Freitas Almeida
50b6a0b5a5
fix: Remove unnecessary directory clearing in build_langflow_base target (#5356)
fix: remove unnecessary directory clearing in build_langflow_base target
2024-12-19 04:12:06 -08:00
Phil Miesle
d1821cb466
ref: improving development environment and instructions (#5180)
* improving development environment and instructions

* minor edits as requested

* fix typo in  DEVELOPMENT.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2024-12-12 04:01:05 -08:00
Gabriel Luiz Freitas Almeida
fb83af224a
chore: Add pyproject.toml configuration to ruff format command in Makefile (#4714)
* Add pyproject.toml config flag to ruff commands in Makefile

* Update ruff exclude path in pyproject.toml

* Remove unused TYPE_CHECKING import from api_key.py

* Remove redundant config flag from 'ruff check' command in Makefile
2024-11-19 19:06:01 +00:00
Ítalo Johnny
d65274da78
chore: remove unnecessary target from makefile (#4702) 2024-11-19 06:20:27 -08:00
Gabriel Luiz Freitas Almeida
467e546e8e
docs: Update local run instructions in CONTRIBUTING.md (#4615)
* docs: Update local run instructions in CONTRIBUTING.md

* chore: Remove pipx check and environment compatibility check from Makefile
2024-11-14 18:24:07 +00:00
Gabriel Luiz Freitas Almeida
6b3bf7b523
chore: Add 'lf' and 'ff' options to Makefile for pytest configuration (#4494)
Add 'lf' and 'ff' options to Makefile for pytest configuration
2024-11-11 18:59:56 +00:00
Ítalo Johnny
7dd85ac0fe
fix: update regex to get supported python versions (#4175)
* fix: update regex to get supported python versions

* chore: move version check to bash script
2024-10-19 13:08:50 +00:00
Edwin Jose
6aa34dac65
chore:Add Alembic Commands to Makefile (#4083)
Update Makefile

added make commands related to alembic
2024-10-10 11:35:17 -04:00
Gabriel Luiz Freitas Almeida
8d88fc3059
chore: Add 'unsafe_fix' target to Makefile (#4081)
Add 'unsafe_fix' target to Makefile for applying unsafe fixes with ruff
2024-10-09 14:37:26 +00:00
Gabriel Luiz Freitas Almeida
54dd81a681
chore: removes Poetry references from pyproject.toml and updates the project metadata (#4019)
* Remove Poetry references from pyproject.toml and update project metadata

* Remove '--no-update' flag from 'uv lock' commands in Makefile

* Add script metadata with Python version and dependencies

* Remove Poetry references and integrate UV setup in CI workflow

* Remove Poetry setup and installation from integration tests workflow

* Remove Poetry references and update workflow to use custom setup action

* Remove references to Poetry from configuration files
2024-10-04 17:24:55 +00:00
Ítalo Johnny
ed7ec6a332
feat: improve CLI parameter handling and cleanup unused code (#4002)
* chore: remove envvar parameter from CLI option

* chore: add show_default=False flag to CLI option

* chore: update argument type to accept None

* feat: add missing Settings to CLI options

* feat: add default path value for components

* chore: rename CLI parameters to match Settings

* feat: update function to enforce parameter hierarchy

CLI > specific env_file > default env_file

* fix: adjust CLI parameter code to pass unit tests

* fix: mypy error arg-type

* fix: little ajustments
2024-10-03 16:10:04 +00:00
Jordan Frazier
e19d90bd6c
ci: fix releases with uv (#3971)
* Update scripts

* update the base dep in uv deps

* update nightly scripts

* Add uv creds for publish

* skip tests for now

* fix version

* only build the wheel

* try again

* add uv to python run

* [autofix.ci] apply automated fixes

* use uv cache

* more version fixe

* fixing versions

* fix base version

* Try no frozen?

* skip everything to try docker build

* tag

* frozen

* separate script for updating uv dep

* [autofix.ci] apply automated fixes

* hardcoded versions

* hardcoded versions

* add version to editable package

* build project before docker file runs

* try again

* fix uv patht o build

* don't know why this would mkae a difference

* debug statements

* debug statements

* debug statements

* change path to whl 🤷

* manually move the wheel...

* make dir

* try no sources

* add back tests

* refactor uv to action

* add uv action

* Update nightly build workflow to include uv lock files in version update commit

* Update lint-py workflow to use specific ref for setup-uv action

* Add checkout step to style-check-py GitHub Actions workflow

* Remove redundant GitHub ref syntax in lint-py.yml workflow

* Update lint-py.yml to use specific ref for setup-uv action

* Update action.yml: standardize quotes and remove redundant checkout step

* Add checkout step to GitHub Actions workflows for specific ref handling

- Introduced `actions/checkout@v4` step to multiple workflows to ensure code is checked out at a specific ref.
- Updated `.github/workflows/docker-build.yml`, `.github/workflows/release_nightly.yml`, `.github/workflows/lint-py.yml`, and `.github/workflows/style-check-py.yml` to include the new checkout step.
- Ensured credentials are persisted during the checkout process.

* Add checkout step to Python test workflow with specific ref

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-10-02 05:37:04 -07:00
Gabriel Luiz Freitas Almeida
43ad226ddb
chore: update docker images to use uv (#3916)
* fix dev dependencies

* fix dev dependencies

* update lock

* Add langchain-unstructured dependency to pyproject.toml

* Switch to uv-based Docker image and streamline build process

- Use `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` as the base image
- Simplify environment variable setup and remove unnecessary ones
- Install project dependencies using `uv sync` with cache mounts
- Add and copy necessary files for the build process
- Update npm installation and frontend build steps
- Adjust entrypoint and runtime configurations
- Remove redundant user setup and streamline CMD execution

* Refactor Dockerfile to use multi-stage builds for optimized image size

- Introduce a builder stage to install dependencies and build the frontend.
- Use npm ci instead of npm install for more reliable builds.
- Copy built frontend assets to the final image.
- Transition to a runtime stage with a slimmer Python base image.
- Ensure the final image only contains necessary runtime dependencies.

* Switch base image to `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` and update Dockerfile

- Replace `python:3.12.3-slim` with `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` as the base image.
- Enable bytecode compilation and set link mode to copy.
- Update dependency installation process using `uv sync`.
- Simplify frontend build and copy process.
- Add OCI labels for image metadata.
- Update CMD to use `langflow-base` for running the application.

* Update Dockerfile to use uv base image and optimize dependency installation

- Switch base image to `ghcr.io/astral-sh/uv:python3.12-bookworm-slim`
- Combine apt-get commands and clean up to reduce image size
- Replace Poetry with uv for dependency management and caching

* Refactor Dockerfile to use multi-stage build for optimized image size

- Introduce a builder stage using `ghcr.io/astral-sh/uv:python3.12-bookworm-slim`
- Add a runtime stage using `python:3.12.3-slim`
- Copy the virtual environment from the builder stage to the runtime stage
- Remove the `uv` entrypoint to avoid invoking it by default

* Update Dockerfile: Fix indentation and remove redundant ENTRYPOINT reset

* ci: update release workflows to use uv (#3919)

* Update nightly build workflow to use 'uv' for dependency management and caching

- Replace Poetry with 'uv' for dependency installation and project setup
- Add steps to install 'uv' and set up caching for 'uv.lock'
- Modify Python setup to use version specified in 'pyproject.toml'
- Remove Node.js setup steps

* Update release workflow to use uv for dependency management

- Replace Poetry with uv for dependency installation and caching
- Update Python setup to use version specified in pyproject.toml
- Add steps to restore uv cache and install project dependencies using uv
- Adjust publish steps to maintain functionality with new setup

* Replace 'poetry publish' with 'uv publish' in Makefile for consistency

* Update nightly build workflow to use 'uv' for dependency management and caching

* Set up Node.js 20 in release_nightly workflow and update version verification logic

* Update Makefile to use `uv sync --frozen` for backend dependencies installation

* Update Makefile to pass arguments to 'uv build' and remove '--skip-existing' from publish commands

- Modified 'build_langflow' target to accept arguments.
- Removed '--skip-existing' from 'publish_base' and 'publish_base_testpypi' commands.
- Added TODO comments for updating test-pypi repository usage.

* Remove --skip-existing flag from uv publish commands and add TODO comments for test-pypi updates

* new lock

* Update CI workflow to remove version prefix and add build args

- Removed 'v' prefix from version extraction in nightly release workflow.
- Added '--no-sources' argument to the build command in the distribution step.

* Update CI workflow to use 'uv' for versioning and publishing

- Replace 'poetry' with 'uv' for version extraction in release checks

* Update CI workflow to use UV_PUBLISH_TOKEN for PyPI publishing

* Add verification step for 'langflow-nightly' name and version in CI workflow

- Corrected awk commands for extracting 'langflow-base' name and version.
- Added a new step to verify 'langflow-nightly' name and version against expected values.

* feat: Update dev.Dockerfile to use 'uv' for dependency management and caching

* update dockerfiles with --no-editable

---------

Co-authored-by: phact <estevezsebastian@gmail.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
2024-09-30 22:49:25 +00:00
Gabriel Luiz Freitas Almeida
bbeaf68a26
docs: Update CONTRIBUTING.md to mention uv (#3965)
* Remove Poetry check, update uv command, and remove dev target from Makefile

* Update CONTRIBUTING.md to reflect new development setup and remove docker-compose instructions
2024-09-30 12:23:35 -07:00
Gabriel Luiz Freitas Almeida
bf2aadf6a4
refactor: update dependency versions and streamline backend installation commands (#3939)
* Update Makefile to streamline backend dependency installation commands

* Update dependency versions in pyproject.toml for weaviate-client, httpx, and others

* Update dependency versions in pyproject.toml for better compatibility and stability

* new lock

* refactor: streamline backend dependency installation commands

* update examples formatting
2024-09-26 12:23:26 -07:00
Sebastián Estévez
fbb097dc4c
chore: uv to replace poetry (#3900)
* uv sync works

* fist stab at Makefile

* uv treatment for langflow-base

* sqlmodel to 0.0.18

* add reinstall_backend to Makefile

* makefile - reinstall_backend fix and unit_test dependency

* fix dev dependencies

* fix dev dependencies

* fix dev dependencies

* lock

* Makefile

* [autofix.ci] apply automated fixes

* Update Makefile

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* delete update_dependencies

* fix lint

* Remove Poetry lock check from GitHub Actions workflow

* Switch to 'uv' for dependency management and caching in style-check workflow

* Update style-check workflow to use '--only-dev' flag for Ruff check

* Integrate 'uv' package setup and caching in GitHub Actions workflows

* Update version check in GitHub Actions to use 'uv tree' for langflow-base

* Remove redundant poetry environment setup in GitHub Actions workflow

* Add step to minimize uv cache in GitHub Actions workflow

* Update GitHub Actions workflow to use 'uv' for dependency management and caching

* Remove redundant script execution from build_langflow target in Makefile

* [autofix.ci] apply automated fixes

* Switch build system from Poetry to Hatchling and update dependencies

- Replace `poetry-core` with `hatchling` in build-system requirements
- Update `langflow-base` dependency to version `0.0.96`
- Add `tool.hatch.build.targets.wheel` configuration
- Adjust `tool.uv.sources` paths for `langflow-frontend` and `langflow-base`

* update lock

* Switch build system from Poetry to Hatchling in pyproject.toml

* Add langchain-unstructured dependency to pyproject.toml

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-09-25 13:40:30 -07:00
Gabriel Luiz Freitas Almeida
fcf780bf42
tests: optimize test durations and refactor test fixtures (#3713)
* Refactor test fixtures and imports for optimization

- Reordered and optimized imports in `conftest.py`.
- Changed return statements to yield in `basic_graph` and `create_webhook` fixtures for better resource management.
- Added cleanup step to `create_webhook` fixture to delete created webhook after test completion.

* Refactor imports and add placeholder client fixture in test_ChatOllama_component.py

* Add pytest fixture 'client' to test_graph.py

* Add pytest fixture 'client' to test_callback_graph.py for test optimization

* Add 'unit_tests_looponfail' target to Makefile for running unit tests with loop-on-fail option

* Optimize test durations and update test cases in various modules
2024-09-06 14:03:27 -07:00
Jordan Frazier
7b3e51f769
ci: create a nightly build workflow (#3553)
* test poetry install

* Add nightly builds workflow

* remove old comments and fix poetry

* remove old debug statement

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-05 19:13:04 +00:00
Gabriel Luiz Freitas Almeida
6388883f1b
fix: update Makefile to conditionally enable --reload based on worker count (#3675)
* Update Makefile to handle backend port kill errors

* Update Makefile to conditionally enable --reload based on worker count
2024-09-03 17:58:35 -03:00
Gabriel Luiz Freitas Almeida
439565413e
refactor: conditionally disable reload and workers in Makefile based on the presence of the workers variable (#3614)
Conditionally disable reload and workers in Makefile based on the presence of the workers variable
2024-09-03 09:28:35 -07:00
Nicolò Boschi
96872f3aa5
chore: refactor and add components integration tests (#3607)
* improve inegration tests

* add fixes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-02 15:21:47 +02:00
Gabriel Luiz Freitas Almeida
5d81e8dce6
refactor: update Makefile commands for improved readability and efficiency (#3596)
* chore(Makefile): redirect output of 'poetry install' and 'npm install' commands to /dev/null to reduce noise
chore(Makefile): redirect output of 'npm run build' command to /dev/null to improve build process efficiency
feat(Makefile): update build_frontend target to include copying built files to backend directory for deployment

* chore(Makefile): refactor lint target to depend on install_backend task for better dependency management
chore(Makefile): refactor frontend, frontendc, backend, build_and_run, build_and_install, and build targets to depend on setup_env task for consistent environment setup before execution

* chore(Makefile): update Makefile commands to use @ symbol for silent execution and improve readability

* chore(Makefile): update Makefile commands to use "@" to suppress command output and improve readability

* chore(Makefile): update run_cli target to include dependencies installation and frontend build steps for better clarity and consistency

* chore(Makefile): add command to delete empty directories in clean_python_cache target
2024-08-28 11:45:56 -07:00
Ítalo Johnny
6cdc915460
build: update docker for dev environment (#3551)
* build: update dockerfile for dev environment

* chore: add script to centralize docker commands

* build: create docker-compose.yml for services

* chore: add makefile target for docker-compose
2024-08-26 22:05:08 +00:00
Gabriel Luiz Freitas Almeida
db72268a04
chore: remove unused script and log (#3343)
* refactor: Removed the unnecessary update_poetry script.

* fix: Handle existing .env file without logging unnecessary message.
2024-08-15 04:36:06 -07:00
Daniel Gines
ca008a1346
fix: update PYTHON_REQUIRED extraction to correctly capture Python version (#3199)
* Updates and changes to the Makefile:

1. Added removal of `frontend` directory inside `src/backend/base/langflow/` and `build` directory inside `src/frontend/` to the `clean_npm_cache` target.
2. Added descriptive comments for the `build_and_install`, `build_and_run`, `fix_codespell`, `setup_poetry`, `unit_tests`, `integration_tests`, and `tests_frontend` targets.

Looking forward to your feedback.

* Improvements: Structure and Functionality Improvements

- Reorganized commands to facilitate understanding of the structure
- Enhanced check_tools to detect the Python version
- Added a multi-environment script to support check_tools
- make init now builds the frontend and runs the application
- Aesthetic improvements in output messages

TO-DO:
- Reorganize container-related commands
- Reorganize other miscellaneous utilities
- Document usage in the application docs
- Prepare the dev environment following the maintainers' recommended practices

* Removed pre-commit as it is no longer used.

* Restored 'patch' command in Makefile, it updates the 'pyproject.toml' with the new project version.

* fix: update PYTHON_REQUIRED extraction to correctly capture Python version

Changed the method of extracting the required Python version from `pyproject.toml`:

- Old method:
  `PYTHON_REQUIRED=$(shell grep "^python" pyproject.toml | sed -n 's/.*"\(.*\)"$$/\1/p')`

- New method:
  `PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')`

The old method of capturing the Python version was too broad and could inadvertently match other dependencies starting with "python" (e.g., `python-socketio`, `python-dotenv`). This could lead to incorrect extraction of the required Python version, potentially causing version mismatches and failures in environment setup.

* fix: update PYTHON_REQUIRED extraction to correctly capture Python version

Changed the method of extracting the required Python version from `pyproject.toml`:

- Old method:
  `PYTHON_REQUIRED=$(shell grep "^python" pyproject.toml | sed -n 's/.*"\(.*\)"$$/\1/p')`

- New method:
  `PYTHON_REQUIRED=$(shell grep '^python[[:space:]]*=' pyproject.toml | sed -n 's/.*"\([^"]*\)".*/\1/p')`

The old method of capturing the Python version was too broad and could inadvertently match other dependencies starting with "python" (e.g., `python-socketio`, `python-dotenv`). This could lead to incorrect extraction of the required Python version, potentially causing version mismatches and failures in environment setup.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-08-08 15:15:41 +00:00
Gabriel Luiz Freitas Almeida
bb1bc5c2df
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.
2024-08-05 21:00:46 +00:00
Gabriel Luiz Freitas Almeida
a861b86354 feat(Makefile): add build steps for frontend and langflow components when 'main' target is specified 2024-07-30 16:25:39 -03:00
Gabriel Luiz Freitas Almeida
554294c2cd
chore: update Makefile to skip publishing if package already exists (#3077) 2024-07-30 16:18:34 +00:00
Daniel Gines
3e6d3dc326
chore: update makefile structure and functionality (#3000)
* Updates and changes to the Makefile:

1. Added removal of `frontend` directory inside `src/backend/base/langflow/` and `build` directory inside `src/frontend/` to the `clean_npm_cache` target.
2. Added descriptive comments for the `build_and_install`, `build_and_run`, `fix_codespell`, `setup_poetry`, `unit_tests`, `integration_tests`, and `tests_frontend` targets.

Looking forward to your feedback.

* Improvements: Structure and Functionality Improvements

- Reorganized commands to facilitate understanding of the structure
- Enhanced check_tools to detect the Python version
- Added a multi-environment script to support check_tools
- make init now builds the frontend and runs the application
- Aesthetic improvements in output messages

TO-DO:
- Reorganize container-related commands
- Reorganize other miscellaneous utilities
- Document usage in the application docs
- Prepare the dev environment following the maintainers' recommended practices

* Removed pre-commit as it is no longer used.

* Restored 'patch' command in Makefile, it updates the 'pyproject.toml' with the new project version.

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-07-30 06:43:13 -07:00
Gabriel Luiz Freitas Almeida
340bfe22c4
refactor: lock poetry dependencies without updating (#3050)
Lock poetry dependencies without updating in the Makefile build_langflow target
2024-07-29 23:36:20 +00:00
Gabriel Luiz Freitas Almeida
9ce12c8598
chore: bump langflow and langflow-base versions to 1.0.13 and 0.0.89 respectively (#2956)
* feat(Makefile): add 'patch' target to bump the version in langflow and langflow-base

* chore: bump langflow and langflow-base versions to 1.0.13 and 0.0.89 respectively
2024-07-25 17:18:02 +00:00
Gabriel Luiz Freitas Almeida
d8a90f6bb5
chore: update dependencies and add lock step in py_autofix.yml (#2875)
* chore: lock dependencies without updating in Makefile

Lock the dependencies without updating them in the Makefile. This ensures that the dependencies remain at their current versions and prevents any unintended changes in compatibility or functionality.

* chore: update dependencies and add lock step in py_autofix.yml

Update the dependencies in the py_autofix.yml workflow file to include a new step for checking the Poetry lock file. This ensures that the dependencies are locked and prevents any unintended changes in compatibility or functionality. The lock step is added to the existing workflow to ensure that the Poetry lock file is checked and updated if necessary.
2024-07-22 11:19:10 -07:00
Gabriel Luiz Freitas Almeida
0122a50a35
refactor: move tests folder structure and update pytest commands (#2785)
* refactor: move tests folder to src/backend

* chore(Makefile): update pytest commands to run tests from the correct directory paths for unit and integration tests

* refactor: update file path in test_custom_component.py

The file path in the test_custom_component.py file has been updated to use the correct relative path to the component_multiple_outputs.py file. This change ensures that the test code can access the correct file and improves the reliability of the test.
2024-07-18 15:19:43 +00:00