diff --git a/.env.example b/.env.example index 26f6e3a29..a63a9b4b1 100644 --- a/.env.example +++ b/.env.example @@ -71,6 +71,10 @@ LANGFLOW_SUPERUSER= # Example: LANGFLOW_SUPERUSER_PASSWORD=123456 LANGFLOW_SUPERUSER_PASSWORD= +# Should store environment variables in the database +# Values: true, false +LANGFLOW_STORE_ENVIRONMENT_VARIABLES= + # STORE_URL # Example: LANGFLOW_STORE_URL=https://api.langflow.store # LANGFLOW_STORE_URL= diff --git a/.github/actions/poetry_caching/action.yml b/.github/actions/poetry_caching/action.yml new file mode 100644 index 000000000..fb76b1723 --- /dev/null +++ b/.github/actions/poetry_caching/action.yml @@ -0,0 +1,94 @@ +# An action for setting up poetry install with caching. +# Using a custom action since the default action does not +# take poetry install groups into account. +# Action code from: +# https://github.com/actions/setup-python/issues/505#issuecomment-1273013236 +# Copy of https://github.com/langchain-ai/langchain/blob/2f8dd1a1619f25daa4737df4d378b1acd6ff83c4/.github/actions/poetry_setup/action.yml +name: poetry-install-with-caching +description: Poetry install with support for caching of dependency groups. + +inputs: + python-version: + description: Python version, supporting MAJOR.MINOR only + required: true + + poetry-version: + description: Poetry version + required: true + + cache-key: + description: Cache key to use for manual handling of caching + required: true + + working-directory: + description: Directory whose poetry.lock file should be cached + required: true + +runs: + using: composite + steps: + - uses: actions/setup-python@v5 + name: Setup python ${{ inputs.python-version }} + id: setup-python + with: + python-version: ${{ inputs.python-version }} + + - uses: actions/cache@v4 + id: cache-bin-poetry + name: Cache Poetry binary - Python ${{ inputs.python-version }} + env: + SEGMENT_DOWNLOAD_TIMEOUT_MIN: "1" + with: + path: | + /opt/pipx/venvs/poetry + # This step caches the poetry installation, so make sure it's keyed on the poetry version as well. + key: bin-poetry-${{ runner.os }}-${{ runner.arch }}-py-${{ inputs.python-version }}-${{ inputs.poetry-version }} + + - name: Refresh shell hashtable and fixup softlinks + if: steps.cache-bin-poetry.outputs.cache-hit == 'true' + shell: bash + env: + POETRY_VERSION: ${{ inputs.poetry-version }} + PYTHON_VERSION: ${{ inputs.python-version }} + run: | + set -eux + + # Refresh the shell hashtable, to ensure correct `which` output. + hash -r + + # `actions/cache@v3` doesn't always seem able to correctly unpack softlinks. + # Delete and recreate the softlinks pipx expects to have. + rm /opt/pipx/venvs/poetry/bin/python + cd /opt/pipx/venvs/poetry/bin + ln -s "$(which "python$PYTHON_VERSION")" python + chmod +x python + cd /opt/pipx_bin/ + ln -s /opt/pipx/venvs/poetry/bin/poetry poetry + chmod +x poetry + + # Ensure everything got set up correctly. + /opt/pipx/venvs/poetry/bin/python --version + /opt/pipx_bin/poetry --version + + - name: Install poetry + if: steps.cache-bin-poetry.outputs.cache-hit != 'true' + shell: bash + env: + POETRY_VERSION: ${{ inputs.poetry-version }} + PYTHON_VERSION: ${{ inputs.python-version }} + # Install poetry using the python version installed by setup-python step. + run: pipx install "poetry==$POETRY_VERSION" --python '${{ steps.setup-python.outputs.python-path }}' --verbose + + - name: Restore pip and poetry cached dependencies + uses: actions/cache@v4 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MIN: "4" + WORKDIR: ${{ inputs.working-directory == '' && '.' || inputs.working-directory }} + with: + path: | + ~/.cache/pip + ~/.cache/pypoetry/virtualenvs + ~/.cache/pypoetry/cache + ~/.cache/pypoetry/artifacts + ${{ env.WORKDIR }}/.venv + key: py-deps-${{ runner.os }}-${{ runner.arch }}-py-${{ inputs.python-version }}-poetry-${{ inputs.poetry-version }}-${{ inputs.cache-key }}-${{ hashFiles(format('{0}/**/poetry.lock', env.WORKDIR)) }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index d4a67f8f4..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: "Async API tests" - -on: - push: - branches: - - dev - pull_request: - branches: - - dev - - main - -jobs: - build-and-test: - runs-on: ubuntu-latest - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Set up Docker - run: docker --version && docker-compose --version - - - name: "Create env file" - working-directory: ./deploy - run: | - echo "${{ secrets.ENV_FILE }}" > .env - - - name: Build and start services - - working-directory: ./deploy - run: docker compose up --exit-code-from tests tests result_backend broker celeryworker db --build - continue-on-error: true - - # - name: Stop services - # run: docker compose down diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c78ba4c71..e1b427322 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,20 +26,24 @@ jobs: - "3.11" steps: - uses: actions/checkout@v4 - - name: Install poetry - run: | - pipx install poetry==$POETRY_VERSION - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - id: setup-python + - name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }} + uses: "./.github/actions/poetry_caching" with: python-version: ${{ matrix.python-version }} - cache: poetry + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }} - name: Install Python dependencies run: | poetry env use ${{ matrix.python-version }} poetry install - if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} - - name: Analysing the code with our lint + - name: Get .mypy_cache to speed up mypy + uses: actions/cache@v4 + env: + SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2" + with: + path: | + ./.mypy_cache + key: ${{ runner.os }}-mypy-${{ hashFiles('**/pyproject.toml') }} + - name: Lint check run: | make lint diff --git a/.github/workflows/pre-release-base.yml b/.github/workflows/pre-release-base.yml index ac2a29a94..44ffc92ee 100644 --- a/.github/workflows/pre-release-base.yml +++ b/.github/workflows/pre-release-base.yml @@ -1,26 +1,20 @@ name: Langflow Base Pre-release - +run-name: Langflow Base Pre-release by @${{ github.actor }} on: - pull_request: - types: - - closed - branches: - - dev - paths: - - "src/backend/base/pyproject.toml" workflow_dispatch: inputs: - force_release: - description: "Force a release" - required: false - default: "false" + release_package: + description: "Release package" + required: true + type: boolean + default: false env: POETRY_VERSION: "1.8.2" jobs: if_release: - if: ${{ (github.event.pull_request.merged == true) && contains(github.event.pull_request.labels.*.name, 'pre-release') }} || ${{ github.event_name == 'workflow_dispatch' && inputs.force_release == 'true' }} + if: inputs.release_package == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -50,22 +44,11 @@ jobs: fi - name: Build project for distribution run: make build base=true - - name: Publish to PyPI env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} run: | make publish base=true - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - draft: false - generateReleaseNotes: true - prerelease: true - tag: v${{ steps.check-version.outputs.version }} - commit: dev - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx diff --git a/.github/workflows/pre-release-langflow.yml b/.github/workflows/pre-release-langflow.yml index 11f894e1a..4c0be75c9 100644 --- a/.github/workflows/pre-release-langflow.yml +++ b/.github/workflows/pre-release-langflow.yml @@ -1,19 +1,13 @@ name: Langflow Pre-release - +run-name: Langflow Pre-release by @${{ github.actor }} on: - pull_request: - types: - - closed - branches: - - dev - paths: - - "pyproject.toml" workflow_dispatch: inputs: - force_release: - description: "Force a release" - required: false - default: "false" + release_package: + description: "Release package" + required: true + type: boolean + default: false workflow_run: workflows: ["pre-release-base"] types: [completed] @@ -24,7 +18,7 @@ env: jobs: if_release: - if: ${{ (github.event.pull_request.merged == true) && contains(github.event.pull_request.labels.*.name, 'pre-release') }} || ${{ github.event_name == 'workflow_dispatch' && inputs.force_release == 'true' }} + if: inputs.release_package == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -38,7 +32,7 @@ jobs: - name: Check Version id: check-version run: | - version=$(cd src/backend/base && poetry version --short) + version=$(poetry version --short) last_released_version=$(curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1) if [ "$version" = "$last_released_version" ]; then echo "Version $version is already released. Skipping release." @@ -55,16 +49,6 @@ jobs: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} run: | make publish main=true - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - draft: false - generateReleaseNotes: true - prerelease: true - tag: v${{ steps.check-version.outputs.version }} - commit: dev - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -83,3 +67,14 @@ jobs: tags: | logspace/langflow:${{ steps.check-version.outputs.version }} logspace/langflow:1.0-alpha + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + generateReleaseNotes: true + prerelease: true + tag: v${{ steps.check-version.outputs.version }} + commit: dev diff --git a/.github/workflows/python_test.yml b/.github/workflows/python_test.yml index a04a208f3..b0cfee04e 100644 --- a/.github/workflows/python_test.yml +++ b/.github/workflows/python_test.yml @@ -29,19 +29,16 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} steps: - uses: actions/checkout@v4 - - name: Install poetry - run: pipx install poetry==$POETRY_VERSION - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - id: setup-python + - name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }} + uses: "./.github/actions/poetry_caching" with: python-version: ${{ matrix.python-version }} - cache: "poetry" + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }} - name: Install Python dependencies run: | poetry env use ${{ matrix.python-version }} poetry install - if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} - name: Run unit tests run: | - make tests + make tests args="-n auto" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8004618f6..5d522c230 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,15 +31,6 @@ jobs: id: check-version run: | echo version=$(poetry version --short) >> $GITHUB_OUTPUT - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - draft: false - generateReleaseNotes: true - tag: v${{ steps.check-version.outputs.version }} - commit: main - name: Publish to PyPI env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} @@ -63,3 +54,12 @@ jobs: tags: | logspace/langflow:${{ steps.check-version.outputs.version }} logspace/langflow:latest + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + generateReleaseNotes: true + tag: v${{ steps.check-version.outputs.version }} + commit: main diff --git a/.gitignore b/.gitignore index 0d74c2208..03eed1556 100644 --- a/.gitignore +++ b/.gitignore @@ -264,4 +264,5 @@ scratchpad* chroma*/* stuff/* src/frontend/playwright-report/index.html -*.bak \ No newline at end of file +*.bak +prof/* \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c58bb92f1..383d21344 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,12 +16,12 @@ The branch structure is as follows: ## 🚩GitHub Issues -Our [issues](https://github.com/logspace-ai/langflow/issues) page is kept up to date +Our [issues](https://github.com/langflow-ai/langflow/issues) page is kept up to date with bugs, improvements, and feature requests. There is a taxonomy of labels to help with sorting and discovery of issues of interest. If you're looking for help with your code, consider posting a question on the -[GitHub Discussions board](https://github.com/logspace-ai/langflow/discussions). Please +[GitHub Discussions board](https://github.com/langflow-ai/langflow/discussions). Please understand that we won't be able to provide individual support via email. We also believe that help is much more valuable if it's **shared publicly**, so that more people can benefit from it. @@ -40,7 +40,7 @@ so that more people can benefit from it. ## Issue labels -[See this page](https://github.com/logspace-ai/langflow/labels) for an overview of +[See this page](https://github.com/langflow-ai/langflow/labels) for an overview of the system we use to tag our issues and pull requests. ## Local development diff --git a/GCP_DEPLOYMENT.md b/GCP_DEPLOYMENT.md index e00e9b1f8..12b6b0239 100644 --- a/GCP_DEPLOYMENT.md +++ b/GCP_DEPLOYMENT.md @@ -4,25 +4,27 @@ This guide will help you set up a Langflow development VM in a Google Cloud Plat > **Note**: When Cloud Shell opens, be sure to select **Trust repo**. Some `gcloud` commands might not run in an ephemeral Cloud Shell environment. +## Standard VM -## Standard VM -[](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/logspace-ai/langflow&working_dir=scripts&shellonly=true&tutorial=walkthroughtutorial.md) +[](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/langflow-ai/langflow&working_dir=scripts&shellonly=true&tutorial=walkthroughtutorial.md) This script sets up a Debian-based VM with the Langflow package, Nginx, and the necessary configurations to run the Langflow Dev environment. +
- Ensure that necessary credentials are provided to connect to the Amazon Bedrock API. If connection fails, a ValueError will be raised. -
++ Ensure that necessary credentials are provided to connect to the Amazon + Bedrock API. If connection fails, a ValueError will be raised. +
Please report errors with detailed tracebacks on the{" "}
Restart Langflow
diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx
index 9d389fb7e..2ec60e0a2 100644
--- a/src/frontend/src/components/cardComponent/index.tsx
+++ b/src/frontend/src/components/cardComponent/index.tsx
@@ -163,20 +163,26 @@ export default function CollectionCardComponent({
}