diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0fa93cc..dfc641e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks @@ -13,6 +13,6 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.149 + rev: v0.0.252 hooks: - id: ruff diff --git a/pyproject.toml b/pyproject.toml index ca09af6..4f0a87c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,17 +39,18 @@ mypy = [ Home = "https://github.com/sbidoul/runboat" [tool.ruff] -fix = false +fix = true +target-version = "py310" select = [ - "E", "F", "U", "N", "S", "C", "B", "A", "I", "T", "Q", "YTT", "BLE", "C", "RUF", "M" -] -ignore = [ - "B008", - "BLE001", - "N805", - "N818", - "S101", - "U007", + "F", # pyflakes + "E", # pycodestyle + "W", # pycodestyle + "C90", # mccabe + "I", # isort + "UP", # pyupgrade + "T10", # flake8-debugger + "PLE", # pylint errors + "RUF", ] [tool.ruff.mccabe] diff --git a/src/runboat/controller.py b/src/runboat/controller.py index 225c7f4..2248fd4 100644 --- a/src/runboat/controller.py +++ b/src/runboat/controller.py @@ -1,7 +1,7 @@ import asyncio import logging -from collections.abc import Awaitable -from typing import Any, Callable +from collections.abc import Awaitable, Callable +from typing import Any from . import k8s from .db import BuildsDb diff --git a/src/runboat/k8s.py b/src/runboat/k8s.py index e21cc5f..afead27 100644 --- a/src/runboat/k8s.py +++ b/src/runboat/k8s.py @@ -4,12 +4,12 @@ import os import shutil import subprocess import tempfile -from collections.abc import Generator +from collections.abc import Callable, Generator from contextlib import contextmanager from enum import Enum from importlib import resources from pathlib import Path -from typing import Any, Callable, TypedDict, cast +from typing import Any, TypedDict, cast import urllib3 from jinja2 import Template @@ -212,7 +212,7 @@ async def _kubectl(args: list[str]) -> None: ) return_code = await proc.wait() if return_code != 0: - raise subprocess.CalledProcessError(return_code, ["kubectl"] + args) + raise subprocess.CalledProcessError(return_code, ["kubectl", *args]) async def deploy(kubefiles_path: Path | None, deployment_vars: DeploymentVars) -> None: diff --git a/src/runboat/utils.py b/src/runboat/utils.py index c17a6c4..8c7f360 100644 --- a/src/runboat/utils.py +++ b/src/runboat/utils.py @@ -1,10 +1,10 @@ import asyncio import functools import re -from collections.abc import AsyncGenerator, Awaitable, Generator, Iterator +from collections.abc import AsyncGenerator, Awaitable, Callable, Generator, Iterator from concurrent.futures.thread import ThreadPoolExecutor from functools import wraps -from typing import Any, Callable, ParamSpec, TypeVar +from typing import Any, ParamSpec, TypeVar _pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="sync_to_async")