diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index f84dead6b..bc7f9efb3 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -21,12 +21,14 @@ on: - main env: POETRY_VERSION: "1.8.2" + TEST_TAG: "langflowai/langflow:test" jobs: setup: runs-on: ubuntu-latest outputs: tags: ${{ steps.set-vars.outputs.tags }} + file: ${{ steps.set-vars.outputs.file }} steps: - uses: actions/checkout@v4 - name: Set Dockerfile and Tags @@ -34,16 +36,22 @@ jobs: run: | if [[ "${{ inputs.release_type }}" == "base" ]]; then echo "tags=langflowai/langflow:base-${{ inputs.version }}" >> $GITHUB_OUTPUT + echo "file=./docker/build_and_push_base.Dockerfile" >> $GITHUB_OUTPUT else echo "tags=langflowai/langflow:${{ inputs.version }},langflowai/langflow:1.0-alpha" >> $GITHUB_OUTPUT + echo "file=./docker/build_and_push.Dockerfile" >> $GITHUB_OUTPUT fi - build_base: + build: runs-on: ubuntu-latest needs: setup strategy: matrix: platform: [linux/amd64, linux/arm64/v8] - file: [./docker/build_and_push.Dockerfile, ./docker/build_and_push_base.Dockerfile] + file: + [ + ./docker/build_and_push.Dockerfile, + ./docker/build_and_push_base.Dockerfile + ] steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx @@ -53,19 +61,39 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Base Image + # - name: Build Docker Image + # uses: docker/build-push-action@v5 + # id: docker_build + # with: + # context: . + # push: false # Do not push yet + # platforms: "linux/amd64,linux/arm64/v8" + # load: true + # file: ${{ matrix.file }} + # tags: ${{ env.TEST_TAG }} + # - name: Run Container + # run: | + # docker run -d --name test_container -p 8000:8000 ${{ needs.setup.outputs.tags }} + # - name: Wait for Container to Start and Check Health + # run: | + # timeout 40 bash -c 'until curl -f http://127.0.0.1:8000/health; do sleep 1; done' || (echo "Server did not start in time" && docker logs test_container && docker stop test_container && docker rm test_container && exit 1) + # - name: Stop and Remove Container + # run: | + # docker stop test_container + # docker rm test_container + - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: context: . push: true - platforms: ${{ matrix.platform }} - file: ${{ matrix.file }} + platforms: "linux/amd64,linux/arm64/v8" + file: ${{ needs.setup.outputs.file }} tags: ${{ needs.setup.outputs.tags }} build_components: if: ${{ inputs.release_type == 'main' }} runs-on: ubuntu-latest - needs: build_base + needs: build strategy: matrix: component: [backend, frontend] @@ -85,6 +113,8 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Wait for Docker Hub to propagate (for backend) + run: sleep 120 - name: Build and push ${{ matrix.component }} uses: docker/build-push-action@v5 with: @@ -100,7 +130,7 @@ jobs: name: Restart HuggingFace Spaces if: ${{ inputs.release_type == 'main' }} runs-on: ubuntu-latest - needs: build_base + needs: build strategy: matrix: python-version: diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 84823b885..300903288 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -35,7 +35,7 @@ jobs: - name: Install Node.js dependencies run: | cd src/frontend - npm ci + npm install if: ${{ steps.setup-node.outputs.cache-hit != 'true' }} - name: Run linters @@ -45,7 +45,9 @@ jobs: auto_fix: true git_email: "gabriel@langflow.org" # Enable linters - eslint: true + # eslint: true + # eslint_auto_fix: true prettier: true + prettier_auto_fix: true prettier_args: '--write \"{tests,src}/**/*.{js,jsx,ts,tsx,json,md}\" --ignore-path .prettierignore' diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 286a7a921..85a12f978 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -62,6 +62,27 @@ jobs: else make build main=true fi + - name: Test CLI + run: | + if [ "${{ inputs.release_type }}" == "base" ]; then + python -m pip install src/backend/base/dist/*.whl + else + python -m pip install dist/*.whl + fi + python -m langflow run --host 127.0.0.1 --port 7860 & + SERVER_PID=$! + # Wait for the server to start + timeout 40 bash -c 'until curl -f http://127.0.0.1:7860/health; do sleep 1; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1) + # Terminate the server + kill $SERVER_PID || (echo "Failed to terminate the server" && exit 1) + sleep 10 # give the server some time to terminate + # Check if the server is still running + if kill -0 $SERVER_PID 2>/dev/null; then + echo "Failed to terminate the server" + exit 1 + else + echo "Server terminated successfully" + fi - name: Publish to PyPI env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python_test.yml b/.github/workflows/python_test.yml index dac1d4f6a..9a8ef15c8 100644 --- a/.github/workflows/python_test.yml +++ b/.github/workflows/python_test.yml @@ -42,4 +42,4 @@ jobs: poetry install - name: Run unit tests run: | - make tests args="-n auto" + make unit_tests args="-n auto" diff --git a/.github/workflows/style-check-py.yml b/.github/workflows/style-check-py.yml index 4063cd48d..217dc5aa8 100644 --- a/.github/workflows/style-check-py.yml +++ b/.github/workflows/style-check-py.yml @@ -13,6 +13,7 @@ env: jobs: lint: + name: Ruff Style Check runs-on: ubuntu-latest strategy: matrix: diff --git a/.gitignore b/.gitignore index 749eff4d3..243628fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -271,4 +271,4 @@ prof/* src/frontend/temp *.db-shm -*.db-wal \ No newline at end of file +*.db-wal diff --git a/Makefile b/Makefile index 88487d312..a305ed807 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,11 @@ coverage: ## run the tests and generate a coverage report # allow passing arguments to pytest -tests: ## run the tests - poetry run pytest tests --instafail -ra -n auto -m "not api_key_required" $(args) +unit_tests: + poetry run pytest tests/unit --instafail -ra -n auto -m "not api_key_required" $(args) +integration_tests: + poetry run pytest tests/integration --instafail -ra -n auto $(args) format: ## run code formatters poetry run ruff check . --fix diff --git a/docs/docs/contributing/how-contribute.md b/docs/docs/contributing/how-contribute.md index ba9223fec..ff0df55a6 100644 --- a/docs/docs/contributing/how-contribute.md +++ b/docs/docs/contributing/how-contribute.md @@ -15,7 +15,7 @@ Please do not try to push directly to this repo unless you are a maintainer. You can develop Langflow using docker compose, or locally. -We provide a .vscode/launch.json file for debugging the backend in VSCode, which is a lot faster than using docker compose. +We provide a `.vscode/launch.json` file for debugging the backend in VSCode, which is a lot faster than using docker compose. Setting up hooks: diff --git a/docs/docs/getting-started/canvas.mdx b/docs/docs/getting-started/canvas.mdx index 5fe03715b..7771746a7 100644 --- a/docs/docs/getting-started/canvas.mdx +++ b/docs/docs/getting-started/canvas.mdx @@ -84,7 +84,7 @@ To debug, hover over the component status to see the outputs. ### Component Parameters -Langflow components can be edited by clicking the component settings button. Hide parameters to reduce complexity and keep the canvas clean and intuitive for experimentation. +Langflow components can be edited by clicking the component settings button.
+Hide parameters with the **SHOW** button to reduce complexity and keep the canvas clean and intuitive for experimentation. + +Double-click the component name to rename it. + ### Component menu Each component is a little unique, but they will all have a menu bar on top that looks something like this. diff --git a/docs/docs/migration/migrating-to-one-point-zero.mdx b/docs/docs/migration/migrating-to-one-point-zero.mdx index 6b608adcf..3d83c8d21 100644 --- a/docs/docs/migration/migrating-to-one-point-zero.mdx +++ b/docs/docs/migration/migrating-to-one-point-zero.mdx @@ -32,49 +32,49 @@ We have a special channel in our Discord server dedicated to Langflow 1.0 migrat Langflow 1.0 introduces adds the concept of Inputs and Outputs to flows, allowing a clear definition of the data flow between components. Discover how to use Inputs and Outputs to pass data between components and create more dynamic flows. -[Learn more about Inputs and Outputs of Components](../components/inputs-and-outputs) +[Learn more about Inputs and Outputs](../components/inputs-and-outputs.mdx) -## To Compose or Not to Compose: the choice is yours +## To Compose or Not to Compose: The Choice is Yours Even though composition is still possible in Langflow 1.0, the new standard is getting data moving through the flow. This allows for more flexibility and control over the data flow in your projects. -We will create guides on how to interweave LangChain components with our Core components soon. +[See our example components](../examples/create-record.mdx) for examples of interweaving LangChain components with our Core components. ## Continued Support for LangChain and Multiple Frameworks Langflow 1.0 continues to support LangChain while also introducing support for multiple frameworks. This is another important boon that adding the paradigm of data flow brings to the table. Find out how to leverage the power of different frameworks in your projects. -**Guide coming soon** +[Learn more about compatibility and updating existing flows](./compatibility.mdx) ## Sidebar Redesign and Customizable Playground We've expanded on the chat experience by creating a customizable interaction panel that allows you to design a panel that fits your needs and interact with it. The sidebar has also been redesigned to provide a more intuitive and user-friendly experience. Explore the new sidebar and interaction panel features to enhance your workflow. -**Guide coming soon** +[Learn more about the Playground](../administration/playground.mdx) ## New Native Categories and Components Langflow 1.0 introduces many new native categories, including Inputs, Outputs, Helpers, Experimental, Models, and more. Discover the new components available, such as Chat Input, Prompt, Files, API Request, and others. -**Guide coming soon** +[Learn more about new components](../components/inputs-and-outputs.mdx) ## New Way of Using Langflow: Text and Data (and more to come) With the introduction of Text and Data types connections between Components are more intuitive and easier to understand. This is the first step in a series of improvements to the way you interact with Langflow. Learn how to use Text, and Data and how they help you build better flows. -[Learn more about Text and Data](../components/text-and-record) +[Learn more about Text and Record](../components/text-and-record.mdx) ## CustomComponent for All Components Almost all components in Langflow 1.0 are now CustomComponents, allowing you to check and modify the code of each component. Discover how to leverage this feature to customize your components to your specific needs. -**Guide coming soon** +[Learn more about CustomComponents](../components/custom.mdx) ## Compatibility with Previous Versions To use flows built in previous versions of Langflow, you can utilize the experimental component Runnable Executor along with an Input and Output. **We'd love your feedback on this**. Learn how to adapt your existing flows to work seamlessly in the new version of Langflow. -[Learn more about Compatibility with Previous Versions](../migration/compatibility) +[Learn more about Compatibility with Previous Versions](./compatibility.mdx) ## Multiple Flows in the Canvas @@ -86,25 +86,25 @@ Langflow 1.0 allows you to have more than one flow in the canvas and run them se Each component now displays its status more clearly, allowing you to quickly identify any issues or errors. Explore how to use the new component status feature to troubleshoot and optimize your flows. -**Guide coming soon** +[Learn more about Component Status](../getting-started/canvas.mdx#component) ## Connecting Output Components You can now connect Output components to any other component (that has a Text output), providing a better understanding of the data flow. Explore the possibilities of connecting Output components and how it enhances your flow's functionality. -**Guide coming soon** +[Learn more about Inputs and Outputs](../components/inputs-and-outputs.mdx) ## Renaming and Editing Component Descriptions Langflow 1.0 allows you to rename and edit the description of each component, making it easier to understand and interact with the flow. Learn how to customize your component names and descriptions for improved clarity. -**Guide coming soon** +[Learn more about Component Descriptions](../getting-started/canvas.mdx#component-parameters) ## Passing Tweaks and Inputs in the API Things got a whole lot easier. You can now pass tweaks and inputs in the API by referencing the Display Name of the component. Discover how to leverage this feature to dynamically control your flow's behavior. -**Guide coming soon** +[Learn more about Tweaks and API inputs](../getting-started/canvas.mdx#tweaks) ## Global Variables for Text Fields @@ -116,11 +116,11 @@ Global Variables can be used in any Text Field across your projects. Learn how t Explore the experimental components available in Langflow 1.0, such as SubFlow, which allows you to load a flow as a component dynamically, and Flow as Tool, which enables you to use a flow as a tool for an Agent. -**Guide coming soon** +[Learn more about Experimental Components](../components/experimental.mdx) ## Experimental State Management System -We are experimenting with a State Management system for flows that allows components to trigger other components and pass messages between them using the Notify and Listen components. Discover how to leverage this system to create more dynamic and interactive flows. +We are experimenting with a State Management system for flows that allow components to trigger other components and pass messages between them using the Notify and Listen components. Discover how to leverage this system to create more dynamic and interactive flows. **Guide coming soon** diff --git a/docs/docs/tutorials/rag-with-astradb.mdx b/docs/docs/tutorials/rag-with-astradb.mdx index 181f5677c..867c32f53 100644 --- a/docs/docs/tutorials/rag-with-astradb.mdx +++ b/docs/docs/tutorials/rag-with-astradb.mdx @@ -14,7 +14,7 @@ In this guide, we will use Astra DB as a vector store to store and retrieve the