From 931ae546649c7c1dde2173e9e19e377f4ca21b8a Mon Sep 17 00:00:00 2001 From: Aidar Garikhanov Date: Fri, 2 May 2025 20:13:12 +0300 Subject: [PATCH 1/2] Update dependencies --- .../.pre-commit-config.yaml | 8 +++++--- .../pyproject.toml | 18 +++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.pre-commit-config.yaml b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.pre-commit-config.yaml index 2b03e85..aa811de 100644 --- a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.pre-commit-config.yaml +++ b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-json - id: check-toml - id: check-xml - id: check-yaml - id: check-added-large-files - args: [--maxkb=10000] + args: [ --maxkb=10000 ] - id: check-case-conflict - id: check-merge-conflict - id: check-executables-have-shebangs @@ -20,8 +20,10 @@ repos: - id: fix-byte-order-marker - id: mixed-line-ending - id: trailing-whitespace + - id: pretty-format-json + args: [ --autofix, --no-ensure-ascii ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.5 + rev: v0.11.8 hooks: - id: ruff-format diff --git a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml index 7695823..71bd139 100644 --- a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml +++ b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/pyproject.toml @@ -13,17 +13,17 @@ pydantic = "^2.6.4" {%- endif %} [tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/ -mypy = "^1.11.1" -pre-commit = "^3.8.0" -pytest = "^8.3.2" +mypy = "^1.15.0" +pre-commit = "^4.2.0" +pytest = "^8.3.5" pytest-cov = "^5.0.0" -coverage = "^7.6.0" -typeguard = "^4.3.0" -ruff = "^0.5.5" -safety = "^3.2.4" -deptry = "^0.18.0" +coverage = "^7.8.0" +typeguard = "^4.4.2" +ruff = "^0.11.8" +safety = "^3.4.0" +deptry = "^0.23.0" {%- if cookiecutter.git_platform == 'gitlab' %} -mypy-gitlab-code-quality = "^1.1.0" +mypy-gitlab-code-quality = "^1.3.0" {%- endif %} [tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file From be92b7f43cd11717add8d0aa6ac8a07c945498f3 Mon Sep 17 00:00:00 2001 From: Aidar Garikhanov Date: Fri, 2 May 2025 22:01:22 +0300 Subject: [PATCH 2/2] Add ruff github action with inline annotations --- .../workflows/{{ cookiecutter.package_name }}.yml | 13 +++++++++++-- .../Makefile | 11 ++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.github/workflows/{{ cookiecutter.package_name }}.yml b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.github/workflows/{{ cookiecutter.package_name }}.yml index b8ec2b1..184e788 100644 --- a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.github/workflows/{{ cookiecutter.package_name }}.yml +++ b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/.github/workflows/{{ cookiecutter.package_name }}.yml @@ -39,8 +39,17 @@ jobs: if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - - name: Run linters - run: make lint + - name: Check dependencies + run: make check-dependencies + + - name: Check codestyle + run: make check-codestyle + + - name: ruff + run: make check-ruff-github + + - name: mypy + run: make check-mypy test: runs-on: ubuntu-latest diff --git a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/Makefile b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/Makefile index 30122fd..0862f3f 100644 --- a/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/Makefile +++ b/{{ cookiecutter.project_name.lower().replace(' ', '-') }}/Makefile @@ -61,14 +61,19 @@ check-dependencies: check-poetry check-deptry .PHONY: check-ruff check-ruff: poetry run ruff check $(CODE) --no-fix +.PHONY: check-codestyle +check-codestyle: + poetry run ruff format $(CODE) --check {% if cookiecutter.git_platform == 'gitlab' %} .PHONY: check-ruff-gitlab check-ruff-gitlab: poetry run ruff check $(CODE) --output-format=gitlab > ruff-report.json {% endif %} -.PHONY: check-codestyle -check-codestyle: - poetry run ruff format $(CODE) --check +{% if cookiecutter.git_platform == 'github' %} +.PHONY: check-ruff-github +check-ruff-github: + poetry run ruff check $(CODE) --no-fix --output-format=github +{% endif %} .PHONY: check-mypy check-mypy: