diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dc7b564..f68b43f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb5c501..a660851 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,67 +1,28 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - - id: debug-statements - - id: trailing-whitespace - - id: check-merge-conflict - - id: check-executables-have-shebangs - id: check-ast - - id: check-byte-order-marker - id: check-json + - id: check-merge-conflict - id: check-symlinks + - id: check-toml - id: check-vcs-permalinks - id: check-xml - id: check-yaml + - id: debug-statements + - id: detect-aws-credentials + args: ["--allow-missing-credentials"] - id: detect-private-key + - id: end-of-file-fixer + - id: fix-byte-order-marker - id: forbid-new-submodules - id: no-commit-to-branch - args: [-b, main] - - - repo: local - hooks: - - id: check-datetime-now - name: check_datetime_nowpyenv - description: Prefer datetime.utcnow() - language: pygrep - entry: 'datetime\.now\(\)' - types: [python] - - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: ["--exclude=docs/*", "--ignore=E501"] - - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.10.0 - hooks: - - id: python-check-mock-methods - - - repo: https://github.com/psf/black - rev: 23.11.0 - hooks: - - id: black - - - repo: https://github.com/PyCQA/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - args: [--add-ignore=D1, -e] - - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - args: [--py38-plus] + - id: trailing-whitespace - - repo: https://github.com/olist/hulks.git - rev: 0.4.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 hooks: - - id: check-logger - - id: check-mutable-defaults + - id: ruff + args: [--fix] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 81e7be4..d62e0e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -26,24 +25,13 @@ classifiers = [ "Programming Language :: Python :: 3.13", "Topic :: System :: Distributed Computing", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = ["aiobotocore>=2.0.0,<3.0.0", "taskgroup ; python_version < '3.11'"] [project.urls] Download = "https://github.com/olist/olist-loafer/releases" Repository = "https://github.com/olist/olist-loafer/" -[tool.black] -line-length = 110 -target-version = ["py38", "py39", "py310", "py311", "py312"] - -[tool.isort] -profile = "black" -line_length = 110 -known_localfolder = ["loafer", "tests"] -sections = ["FUTURE", "STDLIB", "THIRDPARTY", "LOCALFOLDER"] -default_section = "THIRDPARTY" - [tool.hatch.build.targets.sdist] exclude = ["/.devcontainer", "/.github", "/docs"] @@ -74,7 +62,7 @@ cov = [ ] [[tool.hatch.envs.all.matrix]] -python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] +python = ["3.9", "3.10", "3.11", "3.12", "3.13"] [tool.hatch.envs.types] dependencies = [ @@ -85,6 +73,7 @@ check = "mypy --install-types --non-interactive {args:src/loafer tests}" [tool.hatch.envs.hatch-static-analysis] config-path = "ruff_defaults.toml" +dependencies = ["ruff==0.6.9"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/ruff_defaults.toml b/ruff_defaults.toml index 07911f0..a00869e 100644 --- a/ruff_defaults.toml +++ b/ruff_defaults.toml @@ -15,8 +15,6 @@ select = [ "ARG004", "ARG005", "ASYNC100", - "ASYNC101", - "ASYNC102", "B002", "B003", "B004", @@ -49,6 +47,7 @@ select = [ "B032", "B033", "B034", + "B035", "B904", "B905", "BLE001", @@ -83,7 +82,6 @@ select = [ "E101", "E401", "E402", - "E501", "E701", "E702", "E703", @@ -98,7 +96,6 @@ select = [ "E742", "E743", "E902", - "E999", "EM101", "EM102", "EM103", @@ -173,6 +170,10 @@ select = [ "INT002", "INT003", "ISC003", + "LOG001", + "LOG002", + "LOG007", + "LOG009", "N801", "N802", "N803", @@ -193,8 +194,6 @@ select = [ "PERF102", "PERF401", "PERF402", - "PGH001", - "PGH002", "PGH005", "PIE790", "PIE794", @@ -216,6 +215,7 @@ select = [ "PLE0116", "PLE0117", "PLE0118", + "PLE0237", "PLE0241", "PLE0302", "PLE0307", @@ -239,7 +239,7 @@ select = [ "PLR0133", "PLR0206", "PLR0402", - "PLR1701", + "SIM101", "PLR1711", "PLR1714", "PLR1722", @@ -330,6 +330,7 @@ select = [ "PYI054", "PYI055", "PYI056", + "PYI058", "RET503", "RET504", "RET505", @@ -346,13 +347,15 @@ select = [ "RUF008", "RUF009", "RUF010", - "RUF011", "RUF012", "RUF013", "RUF015", "RUF016", + "RUF017", + "RUF018", + "RUF019", + "RUF020", "RUF100", - "RUF200", "S101", "S102", "S103", @@ -364,6 +367,8 @@ select = [ "S110", "S112", "S113", + "S201", + "S202", "S301", "S302", "S303", @@ -387,7 +392,12 @@ select = [ "S323", "S324", "S501", + "S502", + "S503", + "S504", + "S505", "S506", + "S507", "S508", "S509", "S601", @@ -398,8 +408,10 @@ select = [ "S607", "S608", "S609", + "S611", "S612", "S701", + "S702", "SIM101", "SIM102", "SIM103", @@ -409,6 +421,7 @@ select = [ "SIM109", "SIM110", "SIM112", + "SIM113", "SIM114", "SIM115", "SIM116", @@ -426,6 +439,7 @@ select = [ "SIM223", "SIM300", "SIM910", + "SIM911", "SLF001", "SLOT000", "SLOT001", @@ -438,6 +452,7 @@ select = [ "TCH003", "TCH004", "TCH005", + "TCH010", "TD004", "TD005", "TD006", @@ -445,10 +460,14 @@ select = [ "TID251", "TID252", "TID253", + "ASYNC100", + "ASYNC105", + "ASYNC109", + "ASYNC110", + "ASYNC115", "TRY002", "TRY003", "TRY004", - "TRY200", "TRY201", "TRY300", "TRY301", @@ -479,7 +498,6 @@ select = [ "UP024", "UP025", "UP026", - "UP027", "UP028", "UP029", "UP030", @@ -493,6 +511,7 @@ select = [ "UP038", "UP039", "UP040", + "UP041", "W291", "W292", "W293", diff --git a/src/loafer/dispatchers.py b/src/loafer/dispatchers.py index cb4aebe..d4ffcf4 100644 --- a/src/loafer/dispatchers.py +++ b/src/loafer/dispatchers.py @@ -3,12 +3,14 @@ import asyncio import logging import sys -from typing import TYPE_CHECKING, Any, Sequence +from typing import TYPE_CHECKING, Any from .compat import TaskGroup from .exceptions import DeleteMessage if TYPE_CHECKING: + from collections.abc import Sequence + from .routes import Route logger = logging.getLogger(__name__) diff --git a/src/loafer/ext/aws/bases.py b/src/loafer/ext/aws/bases.py index f0b18ce..85a8c43 100644 --- a/src/loafer/ext/aws/bases.py +++ b/src/loafer/ext/aws/bases.py @@ -12,14 +12,14 @@ class _BotoClient: def __init__(self, **client_options): self._client_options = { - "api_version": client_options.get("api_version", None), - "aws_access_key_id": client_options.get("aws_access_key_id", None), - "aws_secret_access_key": client_options.get("aws_secret_access_key", None), - "aws_session_token": client_options.get("aws_session_token", None), - "endpoint_url": client_options.get("endpoint_url", None), - "region_name": client_options.get("region_name", None), + "api_version": client_options.get("api_version"), + "aws_access_key_id": client_options.get("aws_access_key_id"), + "aws_secret_access_key": client_options.get("aws_secret_access_key"), + "aws_session_token": client_options.get("aws_session_token"), + "endpoint_url": client_options.get("endpoint_url"), + "region_name": client_options.get("region_name"), "use_ssl": client_options.get("use_ssl", True), - "verify": client_options.get("verify", None), + "verify": client_options.get("verify"), } def get_client(self): diff --git a/src/loafer/managers.py b/src/loafer/managers.py index ffe5d75..4100e51 100644 --- a/src/loafer/managers.py +++ b/src/loafer/managers.py @@ -3,12 +3,14 @@ import asyncio import logging import os -from typing import TYPE_CHECKING, Sequence +from typing import TYPE_CHECKING from .dispatchers import LoaferDispatcher from .runners import LoaferRunner if TYPE_CHECKING: + from collections.abc import Sequence + from .routes import Route logger = logging.getLogger(__name__)