diff --git a/.github/actions/setup-poetry/action.yml b/.github/actions/setup-poetry/action.yml index 2e76676f37792a..a15eb25327ab2b 100644 --- a/.github/actions/setup-poetry/action.yml +++ b/.github/actions/setup-poetry/action.yml @@ -8,7 +8,7 @@ inputs: poetry-version: description: Poetry version to set up required: true - default: '1.8.4' + default: '2.0.1' poetry-lockfile: description: Path to the Poetry lockfile to restore cache from required: true diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml index fd98db24b961b4..98075c97cd19fd 100644 --- a/.github/workflows/api-tests.yml +++ b/.github/workflows/api-tests.yml @@ -42,25 +42,23 @@ jobs: run: poetry install -C api --with dev - 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 - 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 - 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 - 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 - 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 run: | - pushd api - poetry run python -m mypy --install-types --non-interactive . - popd + poetry run -C api python -m mypy --install-types --non-interactive . - name: Set up dotenvs run: | @@ -80,4 +78,4 @@ jobs: ssrf_proxy - 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 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 12213380bdcf52..c80037195a4c97 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -38,12 +38,12 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' run: | poetry run -C api ruff --version - poetry run -C api ruff check ./api - poetry run -C api ruff format --check ./api + poetry run -C api ruff check ./ + poetry run -C api ruff format --check ./ - name: Dotenv check 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 if: failure() diff --git a/.github/workflows/vdb-tests.yml b/.github/workflows/vdb-tests.yml index 146bee95f21c5f..fab0b8c426a94e 100644 --- a/.github/workflows/vdb-tests.yml +++ b/.github/workflows/vdb-tests.yml @@ -70,4 +70,4 @@ jobs: tidb - 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 diff --git a/api/Dockerfile b/api/Dockerfile index df676f19261133..fd3532e32d2bf1 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -4,7 +4,7 @@ FROM python:3.12-slim-bookworm AS base WORKDIR /app/api # 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 # RUN pip install --no-cache-dir poetry==${POETRY_VERSION} -i https://mirrors.aliyun.com/pypi/simple/ diff --git a/api/README.md b/api/README.md index 461dac4759c6c4..6e9f2e8fbb2d57 100644 --- a/api/README.md +++ b/api/README.md @@ -79,5 +79,5 @@ 2. Run the tests locally with mocked system environment variables in `tool.pytest_env` section in `pyproject.toml` ```bash - poetry run -C api bash dev/pytest/pytest_all_tests.sh + poetry run -P api bash dev/pytest/pytest_all_tests.sh ``` diff --git a/api/pyproject.toml b/api/pyproject.toml index f8c6f599d182b0..ea3dd34475ff2b 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -1,9 +1,10 @@ [project] name = "dify-api" requires-python = ">=3.11,<3.13" +dynamic = [ "dependencies" ] [build-system] -requires = ["poetry-core"] +requires = ["poetry-core>=2.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry] diff --git a/dev/reformat b/dev/reformat index 94a7f3e6febe50..82f96b8e8f1178 100755 --- a/dev/reformat +++ b/dev/reformat @@ -9,10 +9,10 @@ if ! command -v ruff &> /dev/null || ! command -v dotenv-linter &> /dev/null; th fi # run ruff linter -poetry run -C api ruff check --fix ./api +poetry run -C api ruff check --fix ./ # run ruff formatter -poetry run -C api ruff format ./api +poetry run -C api ruff format ./ # 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 diff --git a/dev/sync-poetry b/dev/sync-poetry index 23d5d79e900aa3..766382da0120c3 100755 --- a/dev/sync-poetry +++ b/dev/sync-poetry @@ -12,7 +12,7 @@ if [ $? -ne 0 ]; then # update poetry.lock # refreshing lockfile only 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 echo "poetry.lock is ready." fi