Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: uv to replace poetry #3900

Merged
merged 29 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f02c263
uv sync works
phact Sep 18, 2024
b5c0bd8
fist stab at Makefile
phact Sep 18, 2024
8bccaa6
uv treatment for langflow-base
phact Sep 20, 2024
5dc1569
sqlmodel to 0.0.18
phact Sep 20, 2024
601ae8a
add reinstall_backend to Makefile
phact Sep 23, 2024
110f07e
makefile - reinstall_backend fix and unit_test dependency
phact Sep 23, 2024
365bad7
fix dev dependencies
phact Sep 23, 2024
93c3647
fix dev dependencies
phact Sep 23, 2024
6b2c39d
fix dev dependencies
phact Sep 23, 2024
6fc4342
lock
phact Sep 23, 2024
8a559d6
Makefile
phact Sep 23, 2024
28177d8
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 24, 2024
e4c78b6
Update Makefile
phact Sep 25, 2024
5f6594b
delete update_dependencies
phact Sep 25, 2024
bcedc94
fix lint
phact Sep 25, 2024
fdb06ca
Remove Poetry lock check from GitHub Actions workflow
ogabrielluiz Sep 25, 2024
926e43e
Switch to 'uv' for dependency management and caching in style-check w…
ogabrielluiz Sep 25, 2024
c31c514
Update style-check workflow to use '--only-dev' flag for Ruff check
ogabrielluiz Sep 25, 2024
15331fa
Integrate 'uv' package setup and caching in GitHub Actions workflows
ogabrielluiz Sep 25, 2024
66ca583
Update version check in GitHub Actions to use 'uv tree' for langflow-…
ogabrielluiz Sep 25, 2024
1f6de66
Remove redundant poetry environment setup in GitHub Actions workflow
ogabrielluiz Sep 25, 2024
a02b22f
Add step to minimize uv cache in GitHub Actions workflow
ogabrielluiz Sep 25, 2024
081cc55
Update GitHub Actions workflow to use 'uv' for dependency management …
ogabrielluiz Sep 25, 2024
6bd9951
Remove redundant script execution from build_langflow target in Makefile
ogabrielluiz Sep 25, 2024
d92509e
[autofix.ci] apply automated fixes
autofix-ci[bot] Sep 25, 2024
6a9b52d
Switch build system from Poetry to Hatchling and update dependencies
ogabrielluiz Sep 25, 2024
9fd57b5
update lock
ogabrielluiz Sep 25, 2024
ec43ad0
Switch build system from Poetry to Hatchling in pyproject.toml
ogabrielluiz Sep 25, 2024
0c4d631
Add langchain-unstructured dependency to pyproject.toml
ogabrielluiz Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions .github/workflows/lint-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,29 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || 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 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 Mypy
run: |
poetry run mypy --namespace-packages -p "langflow"
uv run mypy --namespace-packages -p "langflow"
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Minimize uv cache
run: uv cache prune --ci
25 changes: 0 additions & 25 deletions .github/workflows/py_autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,3 @@ jobs:
- run: ruff check --fix-only .
- run: ruff format .
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
lock:
name: Check Poetry lock
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: "./.github/actions/poetry_caching"
with:
python-version: "3.12"
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Check poetry.lock
id: check
run: |
poetry check --lock
continue-on-error: true

- name: Run lock
if : steps.check.outcome == 'failure'
run: |
make lock
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
- name: Diff poetry.lock
uses: nborrmann/diff-poetry-lock@main
continue-on-error: true
89 changes: 61 additions & 28 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the install uv -> python -> restore -> install project .. -> minimize steps repeated a few times. Can we move that to a sub workflow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea want to take a stab at it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is addressed here #3919

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add this once we merge 3919

integration-tests:
name: Integration Tests - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
Expand All @@ -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
Expand All @@ -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:
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:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
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"
Expand All @@ -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'
Expand All @@ -148,3 +179,5 @@ jobs:
else
echo "Server terminated successfully"
fi
- name: Minimize uv cache
run: uv cache prune --ci
32 changes: 20 additions & 12 deletions .github/workflows/style-check-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:



env:
POETRY_VERSION: "1.8.2"


jobs:
lint:
Expand All @@ -19,17 +18,26 @@ jobs:
- "3.12"
steps:
- uses: actions/checkout@v4
- 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:
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:
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 install
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
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
- name: Run Ruff Check
run: poetry run ruff check --output-format=github .
run: uv run --only-dev ruff check --output-format=github .
- name: Minimize uv cache
run: uv cache prune --ci
Loading
Loading