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>
This commit is contained in:
parent
b9bcb09e63
commit
e19d90bd6c
14 changed files with 259 additions and 232 deletions
30
.github/actions/setup-uv/action.yml
vendored
Normal file
30
.github/actions/setup-uv/action.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: "Setup uv"
|
||||||
|
description: "Checks out code, installs uv, and sets up Python environment"
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: "Reference to check out"
|
||||||
|
required: false
|
||||||
|
default: "github.ref"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v3
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
cache-dependency-glob: "uv.lock"
|
||||||
|
|
||||||
|
- name: "Set up Python"
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version-file: "pyproject.toml"
|
||||||
|
|
||||||
|
- name: Restore uv cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/.uv-cache
|
||||||
|
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
||||||
|
uv-${{ runner.os }}
|
||||||
68
.github/workflows/docker-build.yml
vendored
68
.github/workflows/docker-build.yml
vendored
|
|
@ -65,44 +65,70 @@ jobs:
|
||||||
- name: Resolve nightly tag
|
- name: Resolve nightly tag
|
||||||
id: resolve-nightly-tag
|
id: resolve-nightly-tag
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ inputs.nightly_tag_main }}" != '' ]]; then
|
# Note - this is more complex than I'd like. For `main` builds, we just pass the `main` tag.
|
||||||
echo "nightly_tag=${{ inputs.nightly_tag_main }}" >> $GITHUB_OUTPUT
|
# For `base` builds, we pass both the `base` and `main` tags. This is because the `main` tag is the
|
||||||
echo "nightly_build=true" >> $GITHUB_OUTPUT
|
# version we need to check out for the build, but the `base` tag is the version we need to build.
|
||||||
elif [[ "${{ inputs.nightly_tag_base }}" != '' ]]; then
|
#
|
||||||
|
# So, you need to check for `base` existence before `main`.
|
||||||
|
|
||||||
|
if [[ "${{ inputs.nightly_tag_base }}" != '' ]]; then
|
||||||
|
if [[ "${{ inputs.release_type }}" != "base" ]]; then
|
||||||
|
echo "Release type is not 'base'. Exiting the workflow."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Main tag must not be empty, otherwise we have no valid tag to check out.
|
||||||
|
if [[ "${{ inputs.nightly_tag_main }}" == '' ]]; then
|
||||||
|
echo "Nightly tag main is empty. Exiting the workflow."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "nightly_tag=${{ inputs.nightly_tag_base }}" >> $GITHUB_OUTPUT
|
echo "nightly_tag=${{ inputs.nightly_tag_base }}" >> $GITHUB_OUTPUT
|
||||||
echo "nightly_build=true" >> $GITHUB_OUTPUT
|
echo "nightly_build=true" >> $GITHUB_OUTPUT
|
||||||
|
elif [[ "${{ inputs.nightly_tag_main }}" != '' ]]; then
|
||||||
|
if [[ "${{ inputs.release_type }}" != "main" ]]; then
|
||||||
|
echo "Release type is not 'main'. Exiting the workflow."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "nightly_tag=${{ inputs.nightly_tag_main }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "nightly_build=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "nightly_tag=" >> $GITHUB_OUTPUT
|
echo "nightly_tag=" >> $GITHUB_OUTPUT
|
||||||
echo "nightly_build=false" >> $GITHUB_OUTPUT
|
echo "nightly_build=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check out the code at a specific ref
|
- name: Check out the code at a specific ref
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.nightly_tag_main || github.ref }}
|
ref: ${{ inputs.nightly_tag_main || github.ref }}
|
||||||
- name: Set up Python 3.12 + Poetry ${{ env.POETRY_VERSION }}
|
persist-credentials: true
|
||||||
uses: "./.github/actions/poetry_caching"
|
- name: "Setup Environment"
|
||||||
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
ref: ${{ inputs.nightly_tag_main || github.ref }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
|
- name: Install the project
|
||||||
|
run: uv sync --dev
|
||||||
|
|
||||||
- name: Get Version from Input
|
- name: Get Version from Input
|
||||||
if: ${{ inputs.version != '' }}
|
if: ${{ inputs.version != '' }}
|
||||||
id: get-version-input
|
id: get-version-input
|
||||||
run: |
|
run: |
|
||||||
version=${{ inputs.version }}
|
version=${{ inputs.version }}
|
||||||
|
echo version=$version
|
||||||
echo version=$version >> $GITHUB_OUTPUT
|
echo version=$version >> $GITHUB_OUTPUT
|
||||||
- name: Get Version Base
|
- name: Get Version Base
|
||||||
if: ${{ inputs.version == '' && inputs.release_type == 'base' }}
|
if: ${{ inputs.version == '' && inputs.release_type == 'base' }}
|
||||||
id: get-version-base
|
id: get-version-base
|
||||||
run: |
|
run: |
|
||||||
version=$(cd src/backend/base && poetry version --short)
|
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//')
|
||||||
|
echo version=$version
|
||||||
echo version=$version >> $GITHUB_OUTPUT
|
echo version=$version >> $GITHUB_OUTPUT
|
||||||
- name: Get Version Main
|
- name: Get Version Main
|
||||||
if: ${{ inputs.version == '' && inputs.release_type == 'main' }}
|
if: ${{ inputs.version == '' && inputs.release_type == 'main' }}
|
||||||
id: get-version-main
|
id: get-version-main
|
||||||
run: |
|
run: |
|
||||||
version=$(poetry version --short)
|
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
|
||||||
|
echo version=$version
|
||||||
echo version=$version >> $GITHUB_OUTPUT
|
echo version=$version >> $GITHUB_OUTPUT
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -111,8 +137,6 @@ jobs:
|
||||||
docker_tags: ${{ steps.set-vars.outputs.docker_tags }}
|
docker_tags: ${{ steps.set-vars.outputs.docker_tags }}
|
||||||
ghcr_tags: ${{ steps.set-vars.outputs.ghcr_tags }}
|
ghcr_tags: ${{ steps.set-vars.outputs.ghcr_tags }}
|
||||||
file: ${{ steps.set-vars.outputs.file }}
|
file: ${{ steps.set-vars.outputs.file }}
|
||||||
env:
|
|
||||||
NIGHTLY_TAG: ${{ needs.get-version.outputs.nightly-tag }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the code at a specific ref
|
- name: Check out the code at a specific ref
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -123,7 +147,7 @@ jobs:
|
||||||
id: set-vars
|
id: set-vars
|
||||||
run: |
|
run: |
|
||||||
nightly_suffix=''
|
nightly_suffix=''
|
||||||
if [[ "${{ env.NIGHTLY_TAG }}" != '' ]]; then
|
if [[ "${{ needs.get-version.outputs.nightly-build }}" == "true" ]]; then
|
||||||
nightly_suffix="-nightly"
|
nightly_suffix="-nightly"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -147,8 +171,22 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the code at a specific ref
|
- name: Check out the code at a specific ref
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
persist-credentials: true
|
||||||
|
- name: "Setup Environment"
|
||||||
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.nightly_tag_main || github.ref }}
|
ref: ${{ inputs.nightly_tag_main || github.ref }}
|
||||||
|
|
||||||
|
- name: Install the project
|
||||||
|
run: |
|
||||||
|
if [[ "${{ inputs.release_type }}" == "base" ]]; then
|
||||||
|
cd src/backend/base && uv sync --no-dev --no-sources
|
||||||
|
else
|
||||||
|
uv sync --no-dev --no-sources
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
|
|
||||||
23
.github/workflows/lint-py.yml
vendored
23
.github/workflows/lint-py.yml
vendored
|
|
@ -23,26 +23,15 @@ jobs:
|
||||||
- "3.11"
|
- "3.11"
|
||||||
- "3.10"
|
- "3.10"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out the code at a specific ref
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.branch || github.ref }}
|
ref: ${{ inputs.branch || github.ref }}
|
||||||
- name: Install uv
|
persist-credentials: true
|
||||||
uses: astral-sh/setup-uv@v3
|
- name: "Setup Environment"
|
||||||
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
ref: ${{ inputs.branch || github.ref }}
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
- name: Run Mypy
|
- name: Run Mypy
|
||||||
|
|
|
||||||
46
.github/workflows/nightly_build.yml
vendored
46
.github/workflows/nightly_build.yml
vendored
|
|
@ -24,28 +24,11 @@ jobs:
|
||||||
main_tag: ${{ steps.generate_main_tag.outputs.main_tag }}
|
main_tag: ${{ steps.generate_main_tag.outputs.main_tag }}
|
||||||
base_tag: ${{ steps.set_base_tag.outputs.base_tag }}
|
base_tag: ${{ steps.set_base_tag.outputs.base_tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: "Setup Environment"
|
||||||
uses: actions/checkout@v4
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
persist-credentials: true
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
|
|
||||||
|
|
@ -53,7 +36,7 @@ jobs:
|
||||||
id: generate_main_tag
|
id: generate_main_tag
|
||||||
run: |
|
run: |
|
||||||
# NOTE: This outputs the tag with the `v` prefix.
|
# NOTE: This outputs the tag with the `v` prefix.
|
||||||
MAIN_TAG="$(uv run python ./scripts/ci/pypi_nightly_tag.py main)"
|
MAIN_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py main)"
|
||||||
echo "main_tag=$MAIN_TAG" >> $GITHUB_OUTPUT
|
echo "main_tag=$MAIN_TAG" >> $GITHUB_OUTPUT
|
||||||
echo "main_tag=$MAIN_TAG"
|
echo "main_tag=$MAIN_TAG"
|
||||||
|
|
||||||
|
|
@ -72,7 +55,7 @@ jobs:
|
||||||
if: ${{ steps.check_main_tag.outputs.main_tag_exists == 'false' }}
|
if: ${{ steps.check_main_tag.outputs.main_tag_exists == 'false' }}
|
||||||
run: |
|
run: |
|
||||||
# NOTE: This outputs the tag with the `v` prefix.
|
# NOTE: This outputs the tag with the `v` prefix.
|
||||||
BASE_TAG="$(uv run python ./scripts/ci/pypi_nightly_tag.py base)"
|
BASE_TAG="$(uv run ./scripts/ci/pypi_nightly_tag.py base)"
|
||||||
echo "base_tag=$BASE_TAG" >> $GITHUB_OUTPUT
|
echo "base_tag=$BASE_TAG" >> $GITHUB_OUTPUT
|
||||||
echo "base_tag=$BASE_TAG"
|
echo "base_tag=$BASE_TAG"
|
||||||
|
|
||||||
|
|
@ -85,24 +68,25 @@ jobs:
|
||||||
git config --global user.email "bot-nightly-builds@langflow.org"
|
git config --global user.email "bot-nightly-builds@langflow.org"
|
||||||
git config --global user.name "Langflow Bot"
|
git config --global user.name "Langflow Bot"
|
||||||
|
|
||||||
# WARNING: These scripts must be run in this order.
|
|
||||||
# Poetry will use a different cached virtual environment once the main pyproject.toml
|
|
||||||
# project-name is updated, which does not have dependencies installed.
|
|
||||||
BASE_TAG="${{ steps.generate_base_tag.outputs.base_tag }}"
|
BASE_TAG="${{ steps.generate_base_tag.outputs.base_tag }}"
|
||||||
echo "Updating base project version to $BASE_TAG"
|
echo "Updating base project version to $BASE_TAG"
|
||||||
uv run python ./scripts/ci/update_pyproject_name.py langflow-base-nightly base
|
uv run ./scripts/ci/update_pyproject_name.py langflow-base-nightly base
|
||||||
uv run python ./scripts/ci/update_pyproject_version.py $BASE_TAG base
|
uv run ./scripts/ci/update_pyproject_version.py $BASE_TAG base
|
||||||
|
|
||||||
# This updates the dependency of langflow-base to langflow-base-nightly in {project_root}/pyproject.toml
|
# This updates the dependency of langflow-base to langflow-base-nightly in {project_root}/pyproject.toml
|
||||||
uv run python ./scripts/ci/update_lf_base_dependency.py $BASE_TAG
|
# Note: Still necessary for poetry
|
||||||
|
uv run ./scripts/ci/update_lf_base_dependency.py $BASE_TAG
|
||||||
|
|
||||||
# Use the main tag created earlier
|
# Use the main tag created earlier
|
||||||
MAIN_TAG="${{ steps.generate_main_tag.outputs.main_tag }}"
|
MAIN_TAG="${{ steps.generate_main_tag.outputs.main_tag }}"
|
||||||
echo "Updating main project version to $MAIN_TAG"
|
echo "Updating main project version to $MAIN_TAG"
|
||||||
uv run python ./scripts/ci/update_pyproject_version.py $MAIN_TAG main
|
uv run ./scripts/ci/update_pyproject_version.py $MAIN_TAG main
|
||||||
uv run python ./scripts/ci/update_pyproject_name.py langflow-nightly main
|
uv run ./scripts/ci/update_pyproject_name.py langflow-nightly main
|
||||||
|
uv run ./scripts/ci/update_uv_dependency.py $BASE_TAG
|
||||||
|
uv lock
|
||||||
|
cd src/backend/base && uv lock
|
||||||
|
|
||||||
git add pyproject.toml src/backend/base/pyproject.toml
|
git add pyproject.toml src/backend/base/pyproject.toml uv.lock src/backend/base/uv.lock
|
||||||
git commit -m "Update version and project name"
|
git commit -m "Update version and project name"
|
||||||
|
|
||||||
echo "Tagging main with $MAIN_TAG"
|
echo "Tagging main with $MAIN_TAG"
|
||||||
|
|
|
||||||
25
.github/workflows/python_test.yml
vendored
25
.github/workflows/python_test.yml
vendored
|
|
@ -113,27 +113,16 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ${{ fromJson(inputs.python-versions || '["3.10", "3.11", "3.12"]') }}
|
python-version: ${{ fromJson(inputs.python-versions || '["3.10", "3.11", "3.12"]') }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out the code at a specific ref
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref || github.ref }}
|
||||||
|
persist-credentials: true
|
||||||
|
- name: "Setup Environment"
|
||||||
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.ref || github.ref }}
|
ref: ${{ inputs.ref || github.ref }}
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Check Version
|
- name: Check Version
|
||||||
id: check-version
|
id: check-version
|
||||||
# We need to print $3 because langflow-base is a dependency of langflow
|
# We need to print $3 because langflow-base is a dependency of langflow
|
||||||
|
|
|
||||||
45
.github/workflows/release.yml
vendored
45
.github/workflows/release.yml
vendored
|
|
@ -56,24 +56,10 @@ jobs:
|
||||||
version: ${{ steps.check-version.outputs.version }}
|
version: ${{ steps.check-version.outputs.version }}
|
||||||
skipped: ${{ steps.check-version.outputs.skipped }}
|
skipped: ${{ steps.check-version.outputs.skipped }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Setup Environment
|
||||||
- name: Install uv
|
uses: ./.github/workflows/setup-uv.yml
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
ref: ${{ github.ref }}
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
- name: Check Version
|
- name: Check Version
|
||||||
|
|
@ -130,32 +116,19 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.check-version.outputs.version }}
|
version: ${{ steps.check-version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Setup Environment
|
||||||
- name: Install uv
|
uses: ./.github/workflows/setup-uv.yml
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
ref: ${{ github.ref }}
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
|
|
||||||
# If pre-release is true, we need to check if ["a", "b", "rc", "dev", "post"] is in the version string
|
# If pre-release is true, we need to check if ["a", "b", "rc", "dev", "post"] is in the version string
|
||||||
# if the version string is incorrect, we need to exit the workflow
|
# if the version string is incorrect, we need to exit the workflow
|
||||||
- name: Check if pre-release
|
- name: Check if pre-release
|
||||||
if: inputs.pre_release == 'true'
|
if: inputs.pre_release == 'true'
|
||||||
run: |
|
run: |
|
||||||
version=$(uv tree | grep 'langflow' | awk '{print $2}' | sed 's/^v//')
|
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
|
||||||
if [[ "${version}" =~ ^([0-9]+\.)?([0-9]+\.)?[0-9]+((a|b|rc|dev|post)([0-9]+))$ ]]; then
|
if [[ "${version}" =~ ^([0-9]+\.)?([0-9]+\.)?[0-9]+((a|b|rc|dev|post)([0-9]+))$ ]]; then
|
||||||
echo "Pre-release version detected. Continuing with the release."
|
echo "Pre-release version detected. Continuing with the release."
|
||||||
else
|
else
|
||||||
|
|
@ -165,7 +138,7 @@ jobs:
|
||||||
- name: Check Version
|
- name: Check Version
|
||||||
id: check-version
|
id: check-version
|
||||||
run: |
|
run: |
|
||||||
version=$(uv tree | grep 'langflow' | awk '{print $2}' | sed 's/^v//')
|
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}' | sed 's/^v//')
|
||||||
last_released_version=$(curl -s "https://pypi.org/pypi/langflow/json" | jq -r '.releases | keys | .[]' | sort -V | tail -n 1)
|
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
|
if [ "$version" = "$last_released_version" ]; then
|
||||||
echo "Version $version is already released. Skipping release."
|
echo "Version $version is already released. Skipping release."
|
||||||
|
|
|
||||||
114
.github/workflows/release_nightly.yml
vendored
114
.github/workflows/release_nightly.yml
vendored
|
|
@ -54,41 +54,26 @@ jobs:
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.verify.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the code at a specific ref
|
- name: Check out the code at a specific ref
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.nightly_tag_main }}
|
ref: ${{ inputs.nightly_tag_main }}
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
- name: Install uv
|
- name: "Setup Environment"
|
||||||
uses: astral-sh/setup-uv@v3
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
ref: ${{ inputs.nightly_tag_main }}
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Set up Nodejs 20
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "20"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
|
|
||||||
- name: Verify Nightly Name and Version
|
- name: Verify Nightly Name and Version
|
||||||
working-directory: src/backend/base
|
id: verify
|
||||||
run: |
|
run: |
|
||||||
name=$(uv tree | grep 'langflow-base' | awk '{print $1}')
|
name=$(uv tree | grep 'langflow-base' | awk '{print $2}')
|
||||||
version=$(uv tree | grep 'langflow-base' | awk '{print $2}')
|
version=$(uv tree | grep 'langflow-base' | awk '{print $3}')
|
||||||
if [ "$name" != "langflow-base-nightly" ]; then
|
if [ "$name" != "langflow-base-nightly" ]; then
|
||||||
echo "Name $name does not match langflow-base-nightly. Exiting the workflow."
|
echo "Name $name does not match langflow-base-nightly. Exiting the workflow."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -97,14 +82,21 @@ jobs:
|
||||||
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_base }}. Exiting the workflow."
|
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_base }}. Exiting the workflow."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# Strip the leading `v` from the version
|
||||||
|
version=$(echo $version | sed 's/^v//')
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build project for distribution
|
- name: Build project for distribution
|
||||||
run: make build base=true
|
run: make build base=true args="--wheel"
|
||||||
|
|
||||||
- name: Test CLI
|
- name: Test CLI
|
||||||
run: |
|
run: |
|
||||||
python -m pip install src/backend/base/dist/*.whl
|
# TODO: unsure why the whl is not built in src/backend/base
|
||||||
python -m langflow run --host 127.0.0.1 --port 7860 &
|
# uv pip install src/backend/base/dist/*.whl
|
||||||
|
mkdir src/backend/base/dist
|
||||||
|
mv dist/*.whl src/backend/base/dist/
|
||||||
|
uv pip install src/backend/base/dist/*.whl
|
||||||
|
uv run python -m langflow run --host 127.0.0.1 --port 7860 --backend-only &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
# Wait for the server to start
|
# Wait for the server to start
|
||||||
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/api/v1/auto_login; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
|
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/api/v1/auto_login; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
|
||||||
|
|
@ -122,6 +114,7 @@ jobs:
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
env:
|
env:
|
||||||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
make publish base=true
|
make publish base=true
|
||||||
|
|
||||||
|
|
@ -135,56 +128,49 @@ jobs:
|
||||||
name: Release Langflow Nightly Main
|
name: Release Langflow Nightly Main
|
||||||
needs: [release-nightly-base]
|
needs: [release-nightly-base]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.verify.outputs.version }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the code at a specific ref
|
- name: Check out the code at a specific ref
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
persist-credentials: true
|
||||||
|
- name: "Setup Environment"
|
||||||
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.nightly_tag_main }}
|
ref: ${{ inputs.nightly_tag_main }}
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Install the project
|
- name: Install the project
|
||||||
run: uv sync --dev
|
run: uv sync --dev
|
||||||
|
|
||||||
- name: Verify Nightly Name and Version
|
- name: Verify Nightly Name and Version
|
||||||
|
id: verify
|
||||||
run: |
|
run: |
|
||||||
name=$(uv tree | grep 'langflow' | awk '{print $1}')
|
name=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $1}')
|
||||||
version=$(uv tree | grep 'langflow' | awk '{print $2}')
|
version=$(uv tree | grep 'langflow' | grep -v 'langflow-base' | awk '{print $2}')
|
||||||
if [ "$name" != "langflow-nightly" ]; then
|
if [ "$name" != "langflow-nightly" ]; then
|
||||||
echo "Name $name does not match langflow-nightly. Exiting the workflow."
|
echo "Name $name does not match langflow-nightly. Exiting the workflow."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$version" != "${{ inputs.nightly_tag_base }}" ]; then
|
if [ "$version" != "${{ inputs.nightly_tag_main }}" ]; then
|
||||||
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_base }}. Exiting the workflow."
|
echo "Version $version does not match nightly tag ${{ inputs.nightly_tag_main }}. Exiting the workflow."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# Strip the leading `v` from the version
|
||||||
|
version=$(echo $version | sed 's/^v//')
|
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
- name: Wait for PyPI Propagation
|
- name: Wait for PyPI Propagation
|
||||||
run: sleep 300 # wait for 5 minutes to ensure PyPI propagation of base
|
run: sleep 300 # wait for 5 minutes to ensure PyPI propagation of base
|
||||||
|
|
||||||
- name: Build project for distribution
|
- name: Build project for distribution
|
||||||
run: make build main=true args="--no-sources"
|
run: make build main=true args="--no-sources --wheel"
|
||||||
- name: Test CLI
|
- name: Test CLI
|
||||||
run: |
|
run: |
|
||||||
python -m pip install dist/*.whl
|
uv pip install dist/*.whl
|
||||||
python -m langflow run --host 127.0.0.1 --port 7860 --backend-only &
|
uv run python -m langflow run --host 127.0.0.1 --port 7860 --backend-only &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
# Wait for the server to start
|
# Wait for the server to start
|
||||||
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/health_check; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
|
timeout 120 bash -c 'until curl -f http://127.0.0.1:7860/health_check; do sleep 2; done' || (echo "Server did not start in time" && kill $SERVER_PID && exit 1)
|
||||||
|
|
@ -201,6 +187,7 @@ jobs:
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
env:
|
env:
|
||||||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
make publish main=true
|
make publish main=true
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
|
|
@ -212,18 +199,14 @@ jobs:
|
||||||
call_docker_build_base:
|
call_docker_build_base:
|
||||||
name: Call Docker Build Workflow for Langflow Base
|
name: Call Docker Build Workflow for Langflow Base
|
||||||
if: always() && ${{ inputs.build_docker_base == 'true' }}
|
if: always() && ${{ inputs.build_docker_base == 'true' }}
|
||||||
needs: [release-nightly-base]
|
needs: [release-nightly-base, release-nightly-main]
|
||||||
uses: ./.github/workflows/docker-build.yml
|
uses: ./.github/workflows/docker-build.yml
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
release_type:
|
|
||||||
- base
|
|
||||||
with:
|
with:
|
||||||
# version should be needs.release-base.outputs.version if release_type is base
|
# Version should _not_ contain the leading `v`
|
||||||
# version should be needs.release-main.outputs.version if release_type is main
|
version: ${{ needs.release-nightly-base.outputs.version }}
|
||||||
version: ""
|
release_type: base
|
||||||
release_type: ${{ matrix.release_type }}
|
|
||||||
nightly_tag_base: ${{ inputs.nightly_tag_base }}
|
nightly_tag_base: ${{ inputs.nightly_tag_base }}
|
||||||
|
nightly_tag_main: ${{ inputs.nightly_tag_main }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
call_docker_build_main:
|
call_docker_build_main:
|
||||||
|
|
@ -231,14 +214,9 @@ jobs:
|
||||||
if: always() && ${{ inputs.build_docker_main == 'true' }}
|
if: always() && ${{ inputs.build_docker_main == 'true' }}
|
||||||
needs: [release-nightly-main]
|
needs: [release-nightly-main]
|
||||||
uses: ./.github/workflows/docker-build.yml
|
uses: ./.github/workflows/docker-build.yml
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
release_type:
|
|
||||||
- main
|
|
||||||
with:
|
with:
|
||||||
# version should be needs.release-base.outputs.version if release_type is base
|
# Version should _not_ contain the leading `v`
|
||||||
# version should be needs.release-main.outputs.version if release_type is main
|
version: ${{ needs.release-nightly-main.outputs.version }}
|
||||||
version: ""
|
release_type: main
|
||||||
release_type: ${{ matrix.release_type }}
|
|
||||||
nightly_tag_main: ${{ inputs.nightly_tag_main }}
|
nightly_tag_main: ${{ inputs.nightly_tag_main }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
|
||||||
23
.github/workflows/style-check-py.yml
vendored
23
.github/workflows/style-check-py.yml
vendored
|
|
@ -17,24 +17,15 @@ jobs:
|
||||||
python-version:
|
python-version:
|
||||||
- "3.12"
|
- "3.12"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Check out the code at a specific ref
|
||||||
- name: Install uv
|
uses: actions/checkout@v4
|
||||||
uses: astral-sh/setup-uv@v3
|
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
ref: ${{ github.ref }}
|
||||||
cache-dependency-glob: "uv.lock"
|
persist-credentials: true
|
||||||
- name: "Set up Python"
|
- name: "Setup Environment"
|
||||||
uses: actions/setup-python@v5
|
uses: ./.github/actions/setup-uv
|
||||||
with:
|
with:
|
||||||
python-version-file: "pyproject.toml"
|
ref: ${{ github.ref }}
|
||||||
- name: Restore uv cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /tmp/.uv-cache
|
|
||||||
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
||||||
uv-${{ runner.os }}
|
|
||||||
- name: Register problem matcher
|
- name: Register problem matcher
|
||||||
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
|
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
|
||||||
- name: Run Ruff Check
|
- name: Run Ruff Check
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -315,18 +315,18 @@ build: setup_env ## build the frontend static files and package the project
|
||||||
ifdef base
|
ifdef base
|
||||||
make install_frontendci
|
make install_frontendci
|
||||||
make build_frontend
|
make build_frontend
|
||||||
make build_langflow_base
|
make build_langflow_base args="$(args)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef main
|
ifdef main
|
||||||
make install_frontendci
|
make install_frontendci
|
||||||
make build_frontend
|
make build_frontend
|
||||||
make build_langflow_base
|
make build_langflow_base args="$(args)"
|
||||||
make build_langflow args="$(args)"
|
make build_langflow args="$(args)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build_langflow_base:
|
build_langflow_base:
|
||||||
cd src/backend/base && uv build
|
cd src/backend/base && uv build $(args)
|
||||||
rm -rf src/backend/base/langflow/frontend
|
rm -rf src/backend/base/langflow/frontend
|
||||||
|
|
||||||
build_langflow_backup:
|
build_langflow_backup:
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ RUN apt-get update \
|
||||||
gcc \
|
gcc \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install the project's dependencies using the lockfile and settings
|
# Install the project's dependencies using the lockfile and settings
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
--mount=type=bind,source=src/backend/base/README.md,target=src/backend/base/README.md \
|
--mount=type=bind,source=src/backend/base/README.md,target=src/backend/base/README.md \
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ description = "A Python package with a built-in web application"
|
||||||
requires-python = ">=3.10,<3.13"
|
requires-python = ">=3.10,<3.13"
|
||||||
# Define your main dependencies here
|
# Define your main dependencies here
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"langflow-base==0.0.96", # Local editable package
|
"langflow-base==0.0.96",
|
||||||
"beautifulsoup4>=4.12.2",
|
"beautifulsoup4>=4.12.2",
|
||||||
"google-search-results>=2.4.1",
|
"google-search-results>=2.4.1",
|
||||||
"google-api-python-client>=2.130.0",
|
"google-api-python-client>=2.130.0",
|
||||||
|
|
|
||||||
|
|
@ -13,25 +13,13 @@ def update_base_dep(pyproject_path: str, new_version: str) -> None:
|
||||||
with open(filepath, "r") as file:
|
with open(filepath, "r") as file:
|
||||||
content = file.read()
|
content = file.read()
|
||||||
|
|
||||||
# Regex to match the langflow-base dep line under [tool.poetry]
|
|
||||||
# NOTE: this functions similarly to `update_dependencies.py`.
|
|
||||||
# The order of operations for these scripts is more complex than it needs to be;
|
|
||||||
# this is a reminder to revisit this process.
|
|
||||||
# Currently, the process is as follows:
|
|
||||||
# 1. nightly-build workflow updates all names, version, and the langflow-base
|
|
||||||
# dependency in pyproject.toml, and commits the changes and creates a tag.
|
|
||||||
# 2. release-nightly workflow runs, which calls update_dependencies.py to update
|
|
||||||
# the langflow-base dependency in pyproject.toml _again_. This is redundant, but
|
|
||||||
# necessary because the release workflow relies on that script to update the base
|
|
||||||
# dependency.
|
|
||||||
pattern = re.compile(r'langflow-base = \{ path = "\./src/backend/base", develop = true \}')
|
|
||||||
|
|
||||||
if not pattern.search(content):
|
|
||||||
raise Exception(f'langflow-base dependency not found in "{filepath}"')
|
|
||||||
|
|
||||||
replacement = f'langflow-base-nightly = "{new_version}"'
|
replacement = f'langflow-base-nightly = "{new_version}"'
|
||||||
content = pattern.sub(replacement, content)
|
|
||||||
|
|
||||||
|
# Updates the pattern for poetry
|
||||||
|
pattern = re.compile(r'langflow-base = \{ path = "\./src/backend/base", develop = true \}')
|
||||||
|
if not pattern.search(content):
|
||||||
|
raise Exception(f'langflow-base poetry dependency not found in "{filepath}"')
|
||||||
|
content = pattern.sub(replacement, content)
|
||||||
with open(filepath, "w") as file:
|
with open(filepath, "w") as file:
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,35 @@ def update_pyproject_name(pyproject_path: str, new_project_name: str) -> None:
|
||||||
|
|
||||||
if not pattern.search(content):
|
if not pattern.search(content):
|
||||||
raise Exception(f'Project name not found in "{filepath}"')
|
raise Exception(f'Project name not found in "{filepath}"')
|
||||||
|
|
||||||
content = pattern.sub(new_project_name, content)
|
content = pattern.sub(new_project_name, content)
|
||||||
|
|
||||||
with open(filepath, "w") as file:
|
with open(filepath, "w") as file:
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
def update_uv_dep(pyproject_path: str, new_project_name: str) -> None:
|
||||||
|
"""Update the langflow-base dependency in pyproject.toml."""
|
||||||
|
filepath = os.path.join(BASE_DIR, pyproject_path)
|
||||||
|
with open(filepath, "r") as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
if new_project_name == "langflow-nightly":
|
||||||
|
pattern = re.compile(r"langflow = \{ workspace = true \}")
|
||||||
|
replacement = "langflow-nightly = { workspace = true }"
|
||||||
|
elif new_project_name == "langflow-base-nightly":
|
||||||
|
pattern = re.compile(r"langflow-base = \{ workspace = true \}")
|
||||||
|
replacement = "langflow-base-nightly = { workspace = true }"
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Invalid project name: {new_project_name}")
|
||||||
|
|
||||||
|
# Updates the dependency name for uv
|
||||||
|
if not pattern.search(content):
|
||||||
|
raise Exception(f"{replacement} uv dependency not found in {filepath}")
|
||||||
|
content = pattern.sub(replacement, content)
|
||||||
|
with open(filepath, "w") as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
raise Exception("Must specify project name and build type, e.g. langflow-nightly base")
|
raise Exception("Must specify project name and build type, e.g. langflow-nightly base")
|
||||||
|
|
@ -31,8 +53,10 @@ def main() -> None:
|
||||||
|
|
||||||
if build_type == "base":
|
if build_type == "base":
|
||||||
update_pyproject_name("src/backend/base/pyproject.toml", new_project_name)
|
update_pyproject_name("src/backend/base/pyproject.toml", new_project_name)
|
||||||
|
update_uv_dep("pyproject.toml", new_project_name)
|
||||||
elif build_type == "main":
|
elif build_type == "main":
|
||||||
update_pyproject_name("pyproject.toml", new_project_name)
|
update_pyproject_name("pyproject.toml", new_project_name)
|
||||||
|
update_uv_dep("pyproject.toml", new_project_name)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Invalid build type: {build_type}")
|
raise ValueError(f"Invalid build type: {build_type}")
|
||||||
|
|
||||||
|
|
|
||||||
42
scripts/ci/update_uv_dependency.py
Executable file
42
scripts/ci/update_uv_dependency.py
Executable file
|
|
@ -0,0 +1,42 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||||
|
|
||||||
|
|
||||||
|
def update_uv_dep(base_version: str) -> None:
|
||||||
|
"""Update the langflow-base dependency in pyproject.toml."""
|
||||||
|
|
||||||
|
pyproject_path = os.path.join(BASE_DIR, "pyproject.toml")
|
||||||
|
|
||||||
|
# Read the pyproject.toml file content
|
||||||
|
with open(pyproject_path, "r") as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
# For the main project, update the langflow-base dependency in the UV section
|
||||||
|
pattern = re.compile(r'(dependencies\s*=\s*\[\s*\n\s*)("langflow-base==[\d.]+")')
|
||||||
|
replacement = r'\1"langflow-base-nightly=={}"'.format(base_version)
|
||||||
|
|
||||||
|
# Check if the pattern is found
|
||||||
|
if not pattern.search(content):
|
||||||
|
raise Exception(f"{pattern} UV dependency not found in {pyproject_path}")
|
||||||
|
|
||||||
|
# Replace the matched pattern with the new one
|
||||||
|
content = pattern.sub(replacement, content)
|
||||||
|
|
||||||
|
# Write the updated content back to the file
|
||||||
|
with open(pyproject_path, "w") as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
raise Exception("specify base version")
|
||||||
|
base_version = sys.argv[1]
|
||||||
|
base_version = base_version.lstrip("v")
|
||||||
|
update_uv_dep(base_version)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue