Skip to content

Commit

Permalink
build: Monthly maintenance (Aug 2024) (#230)
Browse files Browse the repository at this point in the history
Use Python 3.12.5 as dev version, as well as update dependabot config to
group dev & CI dependencies.

As well as integrate new `flake8-logging` plugin, but at same time hide
false-positive error about using exc_info outside of except block, as
default handler will be called right in `except` block within
`error_middleware`.
  • Loading branch information
playpauseandstop authored Aug 14, 2024
1 parent a28829e commit 8f51be7
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trim_trailing_whitespace = true
[{.babelrc,.compressrc,.eslintrc,.linguirc}]
indent_size = 2

[*.{css,cfg,html,ini,j2,js,json,md,service,toml,yaml,yml,xml}]
[*.{css,cfg,gql,html,ini,j2,js,json,jsx,md,service,toml,ts,tsx,yaml,yml,xml}]
indent_size = 2

[*.{nginx,nginx.j2,py,rst,sh}]
Expand Down
9 changes: 3 additions & 6 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ ban-relative-imports = true
classmethod-decorators =
classmethod
validator
extend-ignore = E501, PIE786
extend-select = TC, TC1
extend-ignore =
E501
PIE786
inline-quotes = double
max-complexity = 15
multiline-quotes = double
per-file-ignores =
*/models.py: TC
*/models/*.py: TC
type-checking-strict = true
2 changes: 1 addition & 1 deletion .github/actions/install_badabump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs:
steps:
- id: "python"
name: "Install Python"
uses: "actions/setup-python@v5.0.0"
uses: "actions/setup-python@v5.1.1"
with:
python-version-file: ".python-version"

Expand Down
6 changes: 3 additions & 3 deletions .github/actions/install_python_and_poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
poetry-version:
description: "Poetry version to use"
required: false
default: "1.7.1"
default: "1.8.3"

outputs:
python-path:
Expand All @@ -39,7 +39,7 @@ runs:
steps:
- id: "python"
name: "Install Python"
uses: "actions/setup-python@v5.0.0"
uses: "actions/setup-python@v5.1.1"
with:
python-version: "${{ inputs.python-version }}"
python-version-file: "${{ inputs.python-version-file }}"
Expand All @@ -49,7 +49,7 @@ runs:
run: "pipx install --python='${{ steps.python.outputs.python-path }}' poetry==${{ inputs.poetry-version }}"

- name: "Cache venv"
uses: "actions/[email protected].0"
uses: "actions/[email protected].2"
with:
path: "./.venv/"
key: "venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}${{ inputs.cache-key-suffix }}"
2 changes: 1 addition & 1 deletion .github/actions/run_pre_commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
shell: "bash"

- name: "Cache mypy"
uses: "actions/[email protected].0"
uses: "actions/[email protected].2"
with:
path: "./.mypy_cache/"
key: "mypy-${{ runner.os }}-${{ inputs.python-version }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/run_tox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
tox-version:
description: "Tox version to use"
required: false
default: "4.12.1"
default: "4.18.0"

tox-gh-actions-version:
description: "Tox GitHub Actions plugin version to use"
Expand Down Expand Up @@ -41,7 +41,7 @@ runs:
shell: "bash"

- name: "Cache tox"
uses: "actions/[email protected].0"
uses: "actions/[email protected].2"
with:
path: ".tox/"
key: "tox-${{ inputs.python-version }}"
Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ updates:
- "dependencies"
allow:
- dependency-type: "direct"
groups:
dev-dependencies:
dependency-type: "development"

- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -30,3 +33,6 @@ updates:
- "build"
- "ci"
- "dependencies"
groups:
ci-dependencies:
patterns: ["*"]
6 changes: 3 additions & 3 deletions .github/workflows/ci_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: "Twine version to use."
type: "string"
required: false
default: "4.0.2"
default: "5.1.1"

jobs:
package:
Expand All @@ -16,7 +16,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/[email protected].1"
- uses: "actions/[email protected].7"

- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
Expand All @@ -34,4 +34,4 @@ jobs:

- name: "Publish package"
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
uses: "pypa/gh-action-pypi-publish@v1.8.11"
uses: "pypa/gh-action-pypi-publish@v1.9.0"
2 changes: 1 addition & 1 deletion .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/[email protected].1"
- uses: "actions/[email protected].7"

- name: "Fetch git data"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_verify_docs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/[email protected].1"
- uses: "actions/[email protected].7"

- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/[email protected].1"
- uses: "actions/[email protected].7"
with:
ref: "main"

Expand All @@ -47,7 +47,7 @@ jobs:
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- name: "Create pull request with changed files"
uses: "peter-evans/create-pull-request@v6.0.0"
uses: "peter-evans/create-pull-request@v6.1.0"
with:
token: "${{ steps.token.outputs.token }}"
commit-message: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- uses: "actions/[email protected].1"
- uses: "actions/[email protected].7"
with:
ref: "main"
token: "${{ steps.token.outputs.token }}"
Expand Down
33 changes: 17 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
default_install_hook_types:
- "commit-msg"
- "pre-commit"
default_language_version:
python: &python_version "python3.12"
exclude: ^(archive|assets|migrations)/.*|.*/(migrations|test-data|vendor)/.*|.*\.svg$
minimum_pre_commit_version: "1.17.0"

repos:
- repo: "https://github.com/commitizen-tools/commitizen"
rev: "v3.14.1"
rev: "v3.29.0"
hooks:
- id: "commitizen"
# By default commitizen using `python3` language version, so
# needed to provide concrete version here as well
language_version: *python_version
stages: ["commit-msg"]

- repo: "https://github.com/Kludex/no-optional"
Expand All @@ -27,23 +27,23 @@ repos:
exclude: ^docs/.*$

- repo: "https://github.com/psf/black-pre-commit-mirror"
rev: "24.1.1"
rev: "24.8.0"
hooks:
- id: "black"
name: "Format code (black)"
exclude: ^docs/.*$

- repo: "https://github.com/asottile/blacken-docs"
rev: "1.16.0"
rev: "1.18.0"
hooks:
- id: "blacken-docs"
name: "Format docs (blacken-docs)"
args: ["-l", "64"]
additional_dependencies:
- "black==23.7.0"
- "black==24.8.0"

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.5.0"
rev: "v4.6.0"
hooks:
- id: "end-of-file-fixer"
- id: "trailing-whitespace"
Expand All @@ -61,24 +61,25 @@ repos:
- id: "rst-inline-touching-normal"

- repo: "https://github.com/PyCQA/flake8"
rev: "7.0.0"
rev: "7.1.1"
hooks:
- id: "flake8"
name: "Lint code (flake8)"
additional_dependencies: &flake8_additional_dependencies
- "flake8-bugbear==24.2.6"
- "flake8-builtins==2.2.0"
- "flake8-comprehensions==3.14.0"
- "flake8-bugbear==24.4.26"
- "flake8-builtins==2.5.0"
- "flake8-comprehensions==3.15.0"
- "flake8-implicit-str-concat==0.4.0"
- "flake8-isort==6.1.1"
- "flake8-logging==1.6.0"
- "flake8-mutable==1.2.0"
- "flake8-pie==0.16.0"
- "flake8-quotes==3.3.2"
- "flake8-quotes==3.4.0"
- "flake8-string-format==0.3.0"
- "flake8-tidy-imports==4.10.0"
- "flake8-variables-names==0.0.6"
- "flake8==7.0.0"
- "pep8-naming==0.13.3"
- "flake8==7.1.1"
- "pep8-naming==0.14.1"
exclude: ^docs/.*$

- repo: "https://github.com/asottile/yesqa"
Expand All @@ -100,7 +101,7 @@ repos:
exclude: ^(.*/)?(docs|migrations|tests)/.*$

- repo: "https://github.com/shellcheck-py/shellcheck-py"
rev: "v0.9.0.6"
rev: "v0.10.0.1"
hooks:
- id: "shellcheck"
name: "Lint scripts (shellcheck)"
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.2
3.12.5
2 changes: 1 addition & 1 deletion src/aiohttp_middlewares/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def default_error_handler(request: web.Request) -> web.Response:
.. versionadded:: 1.0.0
"""
with error_context(request) as context:
logger.error(context.message, exc_info=True)
logger.error(context.message, exc_info=True) # noqa: LOG014
return web.json_response(context.data, status=context.status)


Expand Down

0 comments on commit 8f51be7

Please sign in to comment.