From a2a876c1fca9f77219d70a0a6f611735afa2146c Mon Sep 17 00:00:00 2001 From: Igor Davydenko Date: Thu, 23 Feb 2023 22:57:18 +0100 Subject: [PATCH] build: Bump dev Python version to 3.11.2 (#151) As well as bump pre-commit hooks and GitHub actions. Also use `black==23.1.0` for formatting code. --- .github/actions/install_badabump/action.yml | 2 +- .../install_python_and_poetry/action.yml | 4 ++-- .github/actions/run_pre_commit/action.yml | 2 +- .github/actions/run_tox/action.yml | 6 +++--- .github/workflows/ci_package.yml | 2 +- .github/workflows/ci_verify_docs_build.yml | 2 +- .github/workflows/release_pr.yml | 2 +- .github/workflows/release_tag.yml | 2 +- .pre-commit-config.yaml | 18 +++++++++--------- .python-version | 2 +- python.mk | 2 +- src/aiohttp_middlewares/error.py | 1 + 12 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/actions/install_badabump/action.yml b/.github/actions/install_badabump/action.yml index f6b20f0..32fc523 100644 --- a/.github/actions/install_badabump/action.yml +++ b/.github/actions/install_badabump/action.yml @@ -12,7 +12,7 @@ runs: steps: - id: "python" name: "Install Python" - uses: "actions/setup-python@v4.4.0" + uses: "actions/setup-python@v4.5.0" with: python-version-file: ".python-version" diff --git a/.github/actions/install_python_and_poetry/action.yml b/.github/actions/install_python_and_poetry/action.yml index e9fc765..cfb9d74 100644 --- a/.github/actions/install_python_and_poetry/action.yml +++ b/.github/actions/install_python_and_poetry/action.yml @@ -39,7 +39,7 @@ runs: steps: - id: "python" name: "Install Python" - uses: "actions/setup-python@v4.4.0" + uses: "actions/setup-python@v4.5.0" with: python-version: "${{ inputs.python-version }}" python-version-file: "${{ inputs.python-version-file }}" @@ -49,7 +49,7 @@ runs: run: "pipx install --python='${{ steps.python.outputs.python-path }}' poetry==${{ inputs.poetry-version }}" - name: "Cache venv" - uses: "actions/cache@v3.2.2" + uses: "actions/cache@v3.2.6" with: path: "./.venv/" key: "venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}${{ inputs.cache-key-suffix }}" diff --git a/.github/actions/run_pre_commit/action.yml b/.github/actions/run_pre_commit/action.yml index cee8452..947cb77 100644 --- a/.github/actions/run_pre_commit/action.yml +++ b/.github/actions/run_pre_commit/action.yml @@ -14,7 +14,7 @@ runs: shell: "bash" - name: "Cache mypy" - uses: "actions/cache@v3.2.2" + uses: "actions/cache@v3.2.6" with: path: "./.mypy_cache/" key: "mypy-${{ runner.os }}-${{ inputs.python-version }}" diff --git a/.github/actions/run_tox/action.yml b/.github/actions/run_tox/action.yml index 5f0d678..fa5c4bf 100644 --- a/.github/actions/run_tox/action.yml +++ b/.github/actions/run_tox/action.yml @@ -13,7 +13,7 @@ inputs: tox-version: description: "Tox version to use" required: false - default: "4.1.3" + default: "4.4.6" tox-gh-actions-version: description: "Tox GitHub Actions plugin version to use" @@ -41,9 +41,9 @@ runs: shell: "bash" - name: "Cache tox" - uses: "actions/cache@v3.2.2" + uses: "actions/cache@v3.2.6" with: - path: "./.tox/" + path: ".tox/" key: "tox-${{ inputs.python-version }}" - name: "Run tox" diff --git a/.github/workflows/ci_package.yml b/.github/workflows/ci_package.yml index 0a64254..d297f8d 100644 --- a/.github/workflows/ci_package.yml +++ b/.github/workflows/ci_package.yml @@ -39,7 +39,7 @@ jobs: run: "pipx install --python='${{ steps.python_and_poetry.outputs.python-path }}' twine==${{ inputs.twine-version }}" - name: "Check package" - run: "twine check ./dist/*" + run: "twine check dist/*" - name: "Publish package" if: "${{ startsWith(github.ref, 'refs/tags/') }}" diff --git a/.github/workflows/ci_verify_docs_build.yml b/.github/workflows/ci_verify_docs_build.yml index fdfee73..c0d09bc 100644 --- a/.github/workflows/ci_verify_docs_build.yml +++ b/.github/workflows/ci_verify_docs_build.yml @@ -26,4 +26,4 @@ jobs: run: "poetry install --only main,docs" - name: "Build docs" - run: "poetry run python3 -m sphinx -b html ./docs/ ./docs/_build/" + run: "poetry run python3 -m sphinx -b html docs/ docs/_build/" diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 983798a..95095c8 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -41,7 +41,7 @@ jobs: run: "badabump --ci ${{ github.event.inputs.args }}" - id: "token" - uses: "tibdex/github-app-token@v1.7.0" + uses: "tibdex/github-app-token@v1.8.0" with: app_id: "${{ secrets.BADABUMP_APP_ID }}" private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}" diff --git a/.github/workflows/release_tag.yml b/.github/workflows/release_tag.yml index 81c9e42..d66efd0 100644 --- a/.github/workflows/release_tag.yml +++ b/.github/workflows/release_tag.yml @@ -20,7 +20,7 @@ jobs: steps: - id: "token" - uses: "tibdex/github-app-token@v1.7.0" + uses: "tibdex/github-app-token@v1.8.0" with: app_id: "${{ secrets.BADABUMP_APP_ID }}" private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 39c9aaa..18e9c20 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,10 +4,10 @@ exclude: ^(archive|assets|migrations)/.*|.*/(migrations|test-data|vendor)/.*|.*\ minimum_pre_commit_version: "1.17.0" repos: - repo: "https://github.com/commitizen-tools/commitizen" - rev: "v2.39.1" + rev: "v2.42.0" hooks: - id: "commitizen" - # By default commitizen using `python3` instead `python` language, so + # By default commitizen using `python3` language version, so # needed to provide concrete version here as well language_version: *python_version stages: ["commit-msg"] @@ -19,27 +19,27 @@ repos: name: "Format code (no-optional)" - repo: "https://github.com/PyCQA/isort" - rev: "5.11.4" + rev: "5.12.0" hooks: - id: "isort" name: "Format code (isort)" exclude: ^docs/.*$ - repo: "https://github.com/psf/black" - rev: "22.12.0" + rev: "23.1.0" hooks: - id: "black" name: "Format code (black)" exclude: ^docs/.*$ - repo: "https://github.com/asottile/blacken-docs" - rev: "v1.12.1" + rev: "1.13.0" hooks: - id: "blacken-docs" name: "Format docs (blacken-docs)" args: ["-l", "64"] additional_dependencies: - - "black==22.10.0" + - "black==23.1.0" - repo: "https://github.com/pre-commit/pre-commit-hooks" rev: "v4.4.0" @@ -51,7 +51,7 @@ repos: - id: "check-yaml" - repo: "https://github.com/pre-commit/pygrep-hooks" - rev: "v1.9.0" + rev: "v1.10.0" hooks: - id: "python-check-blanket-noqa" - id: "python-check-blanket-type-ignore" @@ -65,7 +65,7 @@ repos: - id: "flake8" name: "Lint code (flake8)" additional_dependencies: &flake8_additional_dependencies - - "flake8-bugbear==22.12.6" + - "flake8-bugbear==23.2.13" - "flake8-builtins==2.1.0" - "flake8-comprehensions==3.10.1" - "flake8-isort==6.0.0" @@ -91,7 +91,7 @@ repos: hooks: - id: "mypy" name: "Lint code (mypy)" - entry: "./.venv/bin/mypy" + entry: ".venv/bin/mypy" language: "python" "types": ["python"] require_serial: true diff --git a/.python-version b/.python-version index 371cfe3..1e33456 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.11.1 +3.11.2 diff --git a/python.mk b/python.mk index 45d9509..a410fa6 100644 --- a/python.mk +++ b/python.mk @@ -5,7 +5,7 @@ VENV_DIR = .venv PYTHON_BIN = $(VENV_DIR)/bin/python3 STAGE ?= dev -DOTENV ?= $(shell if [ -f ./dotenv.sh ]; then echo "./dotenv.sh "; fi) +DOTENV ?= $(shell if [ -f dotenv.sh ]; then echo "./dotenv.sh"; fi) POETRY ?= $(DOTENV) poetry POETRY_INSTALL_ARGS ?= PRE_COMMIT ?= pre-commit diff --git a/src/aiohttp_middlewares/error.py b/src/aiohttp_middlewares/error.py index d8509b6..4da2615 100644 --- a/src/aiohttp_middlewares/error.py +++ b/src/aiohttp_middlewares/error.py @@ -51,6 +51,7 @@ error_middleware, ) + # Error handler for API requests async def api_error(request: web.Request) -> web.Response: with error_context(request) as context: