Skip to content

Commit

Permalink
build: Monthly maintenance (Aug 2024) (#395)
Browse files Browse the repository at this point in the history
Update Python dev version to 3.11.9, pre-commit hooks, GHA versions, and
dependabot config.

First step in resurrecting project a bit and ensure it works well with
latest attrs, environ-config, and pyrsistent.

**As well as drop Python 3.7 support.**
  • Loading branch information
playpauseandstop authored Aug 14, 2024
1 parent cd201e1 commit d59db81
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 266 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@v4.6.1"
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.5.0"
default: "1.8.3"

outputs:
python-path:
Expand All @@ -39,7 +39,7 @@ runs:
steps:
- id: "python"
name: "Install Python"
uses: "actions/setup-python@v4.6.1"
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/cache@v3.3.1"
uses: "actions/cache@v4.0.2"
with:
path: "./.venv/"
key: "venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}${{ inputs.cache-key-suffix }}"
4 changes: 2 additions & 2 deletions .github/actions/run_pre_commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ runs:
shell: "bash"

- name: "Cache mypy"
uses: "actions/cache@v3.3.1"
uses: "actions/cache@v4.0.2"
with:
path: "./.mypy_cache/"
key: "mypy-${{ runner.os }}-${{ inputs.python-version }}"

- name: "Run pre-commit"
uses: "pre-commit/[email protected].0"
uses: "pre-commit/[email protected].1"
6 changes: 3 additions & 3 deletions .github/actions/run_tox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ inputs:
tox-version:
description: "Tox version to use"
required: false
default: "4.5.2"
default: "4.18.0"

tox-gh-actions-version:
description: "Tox GitHub Actions plugin version to use"
required: false
default: "3.1.1"
default: "3.2.0"

use-coveralls:
description: "Send coverage to Coveralls"
Expand All @@ -41,7 +41,7 @@ runs:
shell: "bash"

- name: "Cache tox"
uses: "actions/cache@v3.3.1"
uses: "actions/cache@v4.0.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: ["*"]
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: "${{ matrix.os }}"

steps:
- uses: "actions/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"

- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
Expand All @@ -53,7 +53,7 @@ jobs:
test:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- cache-key-suffix: "-main-dev"

Expand All @@ -73,7 +73,7 @@ jobs:
options: "--entrypoint redis-server"

steps:
- uses: "actions/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"

- name: "Install system packages"
run: "sudo apt-get update -yqq && sudo apt-get install -yq locales-all"
Expand Down Expand Up @@ -115,10 +115,10 @@ jobs:
package:
needs: ["test"]

permissions:
id-token: "write"

uses: "./.github/workflows/ci_package.yml"
secrets:
pypi-user: "${{ secrets.PYPI_USERNAME }}"
pypi-password: "${{ secrets.PYPI_PASSWORD }}"

release:
needs: ["package"]
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/ci_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@ on:
description: "Twine version to use."
type: "string"
required: false
default: "4.0.2"

secrets:
pypi-user:
description: "PyPI username to use."
required: true

pypi-password:
description: "PyPI password (token) to use."
required: true
default: "5.1.1"

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

steps:
- uses: "actions/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"

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

- name: "Publish package"
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
uses: "pypa/[email protected]"
with:
user: "${{ secrets.pypi-user }}"
password: "${{ secrets.pypi-password }}"
uses: "pypa/[email protected]"
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/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.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/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"

- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
Expand Down
6 changes: 3 additions & 3 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/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"
with:
ref: "main"

Expand All @@ -41,13 +41,13 @@ jobs:
run: "badabump --ci ${{ github.event.inputs.args }}"

- id: "token"
uses: "tibdex/github-app-token@v1.8.0"
uses: "tibdex/github-app-token@v2.1.0"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- name: "Create pull request with changed files"
uses: "peter-evans/create-pull-request@v5.0.1"
uses: "peter-evans/create-pull-request@v6.1.0"
with:
token: "${{ steps.token.outputs.token }}"
commit-message: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

steps:
- id: "token"
uses: "tibdex/github-app-token@v1.8.0"
uses: "tibdex/github-app-token@v2.1.0"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- uses: "actions/checkout@v3.5.2"
- uses: "actions/checkout@v4.1.7"
with:
ref: "main"
token: "${{ steps.token.outputs.token }}"
Expand Down
46 changes: 24 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
default_install_hook_types:
- "commit-msg"
- "pre-commit"
default_language_version:
python: &python_version "python3.11"
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: "3.2.2"
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 @@ -19,30 +20,30 @@ repos:
name: "Format code (no-optional)"

- repo: "https://github.com/PyCQA/isort"
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: "isort"
name: "Format code (isort)"
exclude: ^docs/.*$

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

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

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

- repo: "https://github.com/PyCQA/flake8"
rev: "6.0.0"
rev: "7.1.1"
hooks:
- id: "flake8"
name: "Lint code (flake8)"
additional_dependencies: &flake8_additional_dependencies
- "flake8-bugbear==23.5.9"
- "flake8-builtins==2.1.0"
- "flake8-comprehensions==3.12.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.0.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.8.0"
- "flake8-variables-names==0.0.5"
- "flake8==6.0.0"
- "pep8-naming==0.13.3"
- "flake8-tidy-imports==4.10.0"
- "flake8-variables-names==0.0.6"
- "flake8==7.1.1"
- "pep8-naming==0.14.1"
exclude: ^docs/.*$

- repo: "https://github.com/asottile/yesqa"
rev: "v1.4.0"
rev: "v1.5.0"
hooks:
- id: "yesqa"
name: "Lint code (yesqa)"
Expand All @@ -99,7 +101,7 @@ repos:
exclude: ^(.*/)?(docs|migrations|tests)/.*$

- repo: "https://github.com/shellcheck-py/shellcheck-py"
rev: "v0.9.0.2"
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.11.3
3.11.9
8 changes: 3 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ approach.
As well as bunch other utilities to build effective server applications with
`Python`_ 3 & `aiohttp.web`_.

* Works on `Python`_ 3.7+
* Works on `Python`_ 3.8+
* Works with `aiohttp.web`_ 3.8.1+
* BSD licensed
* Source, issues, and pull requests `on GitHub
Expand All @@ -62,7 +62,6 @@ Example below, illustrates on how to handle operation ``hello_world`` from
.. code-block:: python
from pathlib import Path
from typing import List
from aiohttp import web
from rororo import (
Expand All @@ -87,7 +86,7 @@ Example below, illustrates on how to handle operation ``hello_world`` from
)
def create_app(argv: List[str] = None) -> web.Application:
def create_app(argv: list[str] = None) -> web.Application:
return setup_openapi(
web.Application(),
Path(__file__).parent / "openapi.yaml",
Expand Down Expand Up @@ -126,8 +125,7 @@ In snippet below, *rororo* expects that OpenAPI 3 schema contains operation ID
@operations.register
class UserView(web.View):
async def get(self) -> web.Response:
...
async def get(self) -> web.Response: ...
.. _`class based views`: https://docs.aiohttp.org/en/stable/web_quickstart.html#aiohttp-web-class-based-views
Expand Down
Loading

0 comments on commit d59db81

Please sign in to comment.