chore(build): bump poetry from 1.x to 2.x (#12369)

This commit is contained in:
Bowen Liang 2025-01-22 13:38:24 +08:00 committed by GitHub
parent 3ee213ddca
commit c62b7cc679
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 889 additions and 26 deletions

View File

@ -8,7 +8,7 @@ inputs:
poetry-version: poetry-version:
description: Poetry version to set up description: Poetry version to set up
required: true required: true
default: '1.8.4' default: '2.0.1'
poetry-lockfile: poetry-lockfile:
description: Path to the Poetry lockfile to restore cache from description: Path to the Poetry lockfile to restore cache from
required: true required: true

View File

@ -42,25 +42,23 @@ jobs:
run: poetry install -C api --with dev run: poetry install -C api --with dev
- name: Check dependencies in pyproject.toml - name: Check dependencies in pyproject.toml
run: poetry run -C api bash dev/pytest/pytest_artifacts.sh run: poetry run -P api bash dev/pytest/pytest_artifacts.sh
- name: Run Unit tests - name: Run Unit tests
run: poetry run -C api bash dev/pytest/pytest_unit_tests.sh run: poetry run -P api bash dev/pytest/pytest_unit_tests.sh
- name: Run ModelRuntime - name: Run ModelRuntime
run: poetry run -C api bash dev/pytest/pytest_model_runtime.sh run: poetry run -P api bash dev/pytest/pytest_model_runtime.sh
- name: Run dify config tests - name: Run dify config tests
run: poetry run -C api python dev/pytest/pytest_config_tests.py run: poetry run -P api python dev/pytest/pytest_config_tests.py
- name: Run Tool - name: Run Tool
run: poetry run -C api bash dev/pytest/pytest_tools.sh run: poetry run -P api bash dev/pytest/pytest_tools.sh
- name: Run mypy - name: Run mypy
run: | run: |
pushd api poetry run -C api python -m mypy --install-types --non-interactive .
poetry run python -m mypy --install-types --non-interactive .
popd
- name: Set up dotenvs - name: Set up dotenvs
run: | run: |
@ -80,4 +78,4 @@ jobs:
ssrf_proxy ssrf_proxy
- name: Run Workflow - name: Run Workflow
run: poetry run -C api bash dev/pytest/pytest_workflow.sh run: poetry run -P api bash dev/pytest/pytest_workflow.sh

View File

@ -38,12 +38,12 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.any_changed == 'true'
run: | run: |
poetry run -C api ruff --version poetry run -C api ruff --version
poetry run -C api ruff check ./api poetry run -C api ruff check ./
poetry run -C api ruff format --check ./api poetry run -C api ruff format --check ./
- name: Dotenv check - name: Dotenv check
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.any_changed == 'true'
run: poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example run: poetry run -P api dotenv-linter ./api/.env.example ./web/.env.example
- name: Lint hints - name: Lint hints
if: failure() if: failure()

View File

@ -70,4 +70,4 @@ jobs:
tidb tidb
- name: Test Vector Stores - name: Test Vector Stores
run: poetry run -C api bash dev/pytest/pytest_vdb.sh run: poetry run -P api bash dev/pytest/pytest_vdb.sh

View File

@ -4,7 +4,7 @@ FROM python:3.12-slim-bookworm AS base
WORKDIR /app/api WORKDIR /app/api
# Install Poetry # Install Poetry
ENV POETRY_VERSION=1.8.4 ENV POETRY_VERSION=2.0.1
# if you located in China, you can use aliyun mirror to speed up # if you located in China, you can use aliyun mirror to speed up
# RUN pip install --no-cache-dir poetry==${POETRY_VERSION} -i https://mirrors.aliyun.com/pypi/simple/ # RUN pip install --no-cache-dir poetry==${POETRY_VERSION} -i https://mirrors.aliyun.com/pypi/simple/

View File

@ -79,5 +79,5 @@
2. Run the tests locally with mocked system environment variables in `tool.pytest_env` section in `pyproject.toml` 2. Run the tests locally with mocked system environment variables in `tool.pytest_env` section in `pyproject.toml`
```bash ```bash
poetry run -C api bash dev/pytest/pytest_all_tests.sh poetry run -P api bash dev/pytest/pytest_all_tests.sh
``` ```

872
api/poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
[project] [project]
name = "dify-api" name = "dify-api"
requires-python = ">=3.11,<3.13" requires-python = ">=3.11,<3.13"
dynamic = [ "dependencies" ]
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]

View File

@ -9,10 +9,10 @@ if ! command -v ruff &> /dev/null || ! command -v dotenv-linter &> /dev/null; th
fi fi
# run ruff linter # run ruff linter
poetry run -C api ruff check --fix ./api poetry run -C api ruff check --fix ./
# run ruff formatter # run ruff formatter
poetry run -C api ruff format ./api poetry run -C api ruff format ./
# run dotenv-linter linter # run dotenv-linter linter
poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example poetry run -P api dotenv-linter ./api/.env.example ./web/.env.example

View File

@ -12,7 +12,7 @@ if [ $? -ne 0 ]; then
# update poetry.lock # update poetry.lock
# refreshing lockfile only without updating locked versions # refreshing lockfile only without updating locked versions
echo "poetry.lock is outdated, refreshing without updating locked versions ..." echo "poetry.lock is outdated, refreshing without updating locked versions ..."
poetry lock -C api --no-update poetry lock -C api
else else
echo "poetry.lock is ready." echo "poetry.lock is ready."
fi fi