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>
This commit is contained in:
Sebastián Estévez 2024-09-25 16:40:30 -04:00 committed by GitHub
commit fbb097dc4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 14382 additions and 199 deletions

View file

@ -46,23 +46,33 @@ jobs:
id: setup-node
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
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 lock --no-update
poetry install
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
run: uv sync --dev
- name: Run unit tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 12
max_attempts: 2
command: make unit_tests async=false args="--splits ${{ matrix.splitCount }} --group ${{ matrix.group }}"
- name: Minimize uv cache
run: uv cache prune --ci
integration-tests:
name: Integration Tests - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
@ -73,20 +83,29 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
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 lock --no-update
poetry install
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
run: uv sync --dev
- name: Run integration tests
run: make integration_tests_no_api_keys
- name: Minimize uv cache
run: uv cache prune --ci
test-cli:
name: Test CLI - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
@ -98,16 +117,29 @@ jobs:
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
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
id: check-version
# We need to print $3 because langflow-base is a dependency of langflow
# For langlow we'd use print $2
run: |
version=$(cd src/backend/base && poetry version --short)
version=$(uv tree | grep 'langflow-base' | awk '{print $3}' | sed 's/^v//')
url="https://pypi.org/pypi/langflow-base/json"
if [ ${{ inputs.nightly }} == true ]; then
url="https://pypi.org/pypi/langflow-base-nightly/json"
@ -125,7 +157,6 @@ jobs:
- name: Build wheel
if: steps.check-version.outputs.skipped == 'false'
run: |
poetry env use ${{ matrix.python-version }}
make build main=true
- name: Install wheel
if: steps.check-version.outputs.skipped == 'false'
@ -148,3 +179,5 @@ jobs:
else
echo "Server terminated successfully"
fi
- name: Minimize uv cache
run: uv cache prune --ci