From 9cfc2ea16472e074c64a46d43b4e47113ef22fda Mon Sep 17 00:00:00 2001 From: Temrjan Date: Tue, 24 Mar 2026 13:41:49 +0500 Subject: [PATCH] fix: update template CI to use uv and ruff instead of poetry and black The generated project CI workflow still used Poetry for dependency management and Black for formatting, while pyproject.toml and .pre-commit-config.yaml already use uv and ruff. Changes: - Replace Poetry with uv (astral-sh/setup-uv@v6 + uv sync) - Replace Black with ruff-format in lint matrix - Update Python version from 3.11 to 3.12 (minimum per pyproject.toml) - Update actions/setup-python from v5 to v6 - Replace Black with ruff format in alembic post_write_hooks Closes #243 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../.github/workflows/tests.yml | 20 +++++++++---------- .../{{cookiecutter.project_name}}/alembic.ini | 13 ++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml b/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml index a9c8603..caee399 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml +++ b/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml @@ -7,23 +7,22 @@ jobs: strategy: matrix: cmd: - - black + - ruff-format - ruff - mypy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install poetry - run: pipx install poetry - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: '3.11' - cache: 'poetry' + python-version: '3.12' + - name: Set up UV + uses: astral-sh/setup-uv@v6 - name: Install deps - run: poetry install + run: uv sync - name: Run lint check - run: poetry run pre-commit run -a {{ '${{' }} matrix.cmd {{ '}}' }} + run: uv run pre-commit run -a {{ '${{' }} matrix.cmd {{ '}}' }} pytest: runs-on: ubuntu-latest steps: @@ -31,13 +30,12 @@ jobs: - name: Create .env run: touch .env - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: '3.11' + python-version: '3.12' - name: Update docker-compose uses: KengoTODA/actions-setup-docker-compose@v1 with: version: "2.28.0" - name: run tests run: docker-compose run --rm api pytest -vv - diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/alembic.ini b/fastapi_template/template/{{cookiecutter.project_name}}/alembic.ini index dc44727..0974229 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/alembic.ini +++ b/fastapi_template/template/{{cookiecutter.project_name}}/alembic.ini @@ -7,14 +7,15 @@ output_encoding = utf-8 [post_write_hooks] -hooks = black,ruff +hooks = ruff_format,ruff_check -black.type = console_scripts -black.entrypoint = black +ruff_format.type = exec +ruff_format.executable = ruff +ruff_format.options = format REVISION_SCRIPT_FILENAME -ruff.type = exec -ruff.executable = ruff -ruff.options = check --fix REVISION_SCRIPT_FILENAME --ignore N999 +ruff_check.type = exec +ruff_check.executable = ruff +ruff_check.options = check --fix REVISION_SCRIPT_FILENAME --ignore N999 # Logging configuration [loggers]