From 2a013bbd69ca4d5f670ab339e336794379f0e5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 30 Jun 2024 10:23:54 +0200 Subject: [PATCH 1/3] Upgrade dependencies --- requirements-mypy.txt | 2 +- requirements-test.txt | 12 +++---- requirements.txt | 80 +++++++++++++++++++++++++------------------ 3 files changed, 53 insertions(+), 41 deletions(-) diff --git a/requirements-mypy.txt b/requirements-mypy.txt index cf50908..c69fce2 100644 --- a/requirements-mypy.txt +++ b/requirements-mypy.txt @@ -1,4 +1,4 @@ # frozen requirements generated by pip-deepfreeze -mypy==1.7.0 +mypy==1.10.1 mypy-extensions==1.0.0 types-urllib3==1.26.25.14 diff --git a/requirements-test.txt b/requirements-test.txt index 5da0b0d..1a0fafe 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,9 +1,9 @@ # frozen requirements generated by pip-deepfreeze -coverage==7.3.2 +coverage==7.5.4 iniconfig==2.0.0 -pluggy==1.3.0 -pytest==7.4.3 -pytest-asyncio==0.21.1 -pytest-cov==4.1.0 +pluggy==1.5.0 +pytest==8.2.2 +pytest-asyncio==0.23.7 +pytest-cov==5.0.0 pytest-dotenv==0.5.2 -pytest-mock==3.12.0 +pytest-mock==3.14.0 diff --git a/requirements.txt b/requirements.txt index b8a6fd6..5cb363f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,43 +1,55 @@ # frozen requirements generated by pip-deepfreeze -annotated-types==0.6.0 -ansi2html==1.8.0 -anyio==3.7.1 -cachetools==5.3.2 -certifi==2023.11.17 +annotated-types==0.7.0 +ansi2html==1.9.2 +anyio==4.4.0 +cachetools==5.3.3 +certifi==2024.6.2 charset-normalizer==3.3.2 click==8.1.7 -fastapi==0.104.1 -google-auth==2.23.4 -gunicorn==21.2.0 +dnspython==2.6.1 +email-validator==2.2.0 +fastapi==0.111.0 +fastapi-cli==0.0.4 +google-auth==2.30.0 +gunicorn==22.0.0 h11==0.14.0 -httpcore==1.0.2 -httpx==0.25.1 -idna==3.4 -Jinja2==3.1.2 -kubernetes==28.1.0 +httpcore==1.0.5 +httptools==0.6.1 +httpx==0.27.0 +idna==3.7 +jinja2==3.1.4 +kubernetes==30.1.0 markdown-it-py==3.0.0 -MarkupSafe==2.1.3 +markupsafe==2.1.5 mdurl==0.1.2 oauthlib==3.2.2 -packaging==23.2 -pyasn1==0.5.0 -pyasn1-modules==0.3.0 -pydantic==2.5.1 -pydantic-settings==2.1.0 -pydantic_core==2.14.3 -Pygments==2.17.1 -python-dateutil==2.8.2 -python-dotenv==1.0.0 -PyYAML==6.0.1 -requests==2.31.0 -requests-oauthlib==1.3.1 -rich==13.7.0 +orjson==3.10.5 +packaging==24.1 +pyasn1==0.6.0 +pyasn1-modules==0.4.0 +pydantic==2.7.4 +pydantic-core==2.18.4 +pydantic-settings==2.3.4 +pygments==2.18.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +python-multipart==0.0.9 +pyyaml==6.0.1 +requests==2.32.3 +requests-oauthlib==2.0.0 +rich==13.7.1 rsa==4.9 +shellingham==1.5.4 six==1.16.0 -sniffio==1.3.0 -sse-starlette==1.6.5 -starlette==0.27.0 -typing_extensions==4.8.0 -urllib3==1.26.18 -uvicorn==0.24.0.post1 -websocket-client==1.6.4 +sniffio==1.3.1 +sse-starlette==2.1.2 +starlette==0.37.2 +typer==0.12.3 +typing-extensions==4.12.2 +ujson==5.10.0 +urllib3==2.2.2 +uvicorn==0.30.1 +uvloop==0.19.0 +watchfiles==0.22.0 +websocket-client==1.8.0 +websockets==12.0 From 4b94618f34c1eaa06150eaee9b561d134c038026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 30 Jun 2024 10:25:24 +0200 Subject: [PATCH 2/3] Pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- src/runboat/__init__.py | 1 + src/runboat/db.py | 3 +-- src/runboat/k8s.py | 7 ++++--- src/runboat/settings.py | 6 +++--- src/runboat/utils.py | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b172055..a57d465 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,14 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.1.6 + rev: v0.5.0 hooks: - id: ruff - id: ruff-format diff --git a/src/runboat/__init__.py b/src/runboat/__init__.py index 0faaaed..ded49ca 100644 --- a/src/runboat/__init__.py +++ b/src/runboat/__init__.py @@ -1,2 +1,3 @@ """A simple Odoo runbot lookalike using kubernetes.""" + __version__ = "0.2" diff --git a/src/runboat/db.py b/src/runboat/db.py index f83a32f..bc984e8 100644 --- a/src/runboat/db.py +++ b/src/runboat/db.py @@ -19,8 +19,7 @@ class SortOrder(Enum): class BuildListener(Protocol): - def on_build_event(self, event: BuildEvent, build: Build) -> None: - ... + def on_build_event(self, event: BuildEvent, build: Build) -> None: ... class BuildsDb: diff --git a/src/runboat/k8s.py b/src/runboat/k8s.py index b24dde0..9d95633 100644 --- a/src/runboat/k8s.py +++ b/src/runboat/k8s.py @@ -193,9 +193,10 @@ def _get_kubefiles_path(kubefiles_path: Path | None) -> Generator[Path, None, No def _render_kubefiles( kubefiles_path: Path | None, deployment_vars: DeploymentVars ) -> Generator[Path, None, None]: - with _get_kubefiles_path( - kubefiles_path - ) as kubefiles_path, tempfile.TemporaryDirectory() as tmp_dir: + with ( + _get_kubefiles_path(kubefiles_path) as kubefiles_path, + tempfile.TemporaryDirectory() as tmp_dir, + ): tmp_path = Path(tmp_dir) _logger.debug("kubefiles path: %s", kubefiles_path) # TODO async copytree, or make this whole _render_kubefiles run_in_executor diff --git a/src/runboat/settings.py b/src/runboat/settings.py index a561838..7a743b0 100644 --- a/src/runboat/settings.py +++ b/src/runboat/settings.py @@ -59,13 +59,13 @@ class Settings(BaseSettings): # The wildcard domain where the builds will be reacheable. build_domain: str # A dictionary of environment variables to set in the build container and jobs. - build_env: dict[str, str] = {} # noqa: RUF012 + build_env: dict[str, str] = {} # A dictionary of secret environment variables to set in the build container and # jobs. - build_secret_env: dict[str, str] = {} # noqa: RUF012 + build_secret_env: dict[str, str] = {} # A dictionary of variables to be set in the jinja rendering context for the # kubefiles. - build_template_vars: dict[str, str] = {} # noqa: RUF012 + build_template_vars: dict[str, str] = {} # The path of the default kubefiles to be used. build_default_kubefiles_path: Annotated[ Path | None, BeforeValidator(validate_path) diff --git a/src/runboat/utils.py b/src/runboat/utils.py index 8c7f360..361c283 100644 --- a/src/runboat/utils.py +++ b/src/runboat/utils.py @@ -28,7 +28,7 @@ def sync_to_async(func: Callable[P, R]) -> Callable[P, Awaitable[R]]: def sync_to_async_iterator( - iterator_func: Callable[P, Generator[R, None, None]] + iterator_func: Callable[P, Generator[R, None, None]], ) -> Callable[P, AsyncGenerator[R, None]]: @sync_to_async def async_next(iterator: Iterator[R]) -> R: From 321d65b9c993957d5865197945984ed6c8e4b210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 30 Jun 2024 10:28:29 +0200 Subject: [PATCH 3/3] Modernize ruff config --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 545d8b1..3ca4cba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,8 @@ Home = "https://github.com/sbidoul/runboat" [tool.ruff] fix = true target-version = "py310" + +[tool.ruff.lint] select = [ "F", # pyflakes "E", # pycodestyle @@ -59,10 +61,10 @@ select = [ "RUF", ] -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 15 -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["runboat"] # pytest