diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 155dc75..486234a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.13", "3.14", "3.15"] runs-on: ["ubuntu-latest", "macos-latest", "windows-latest"] steps: @@ -64,7 +64,7 @@ jobs: - uses: "actions/setup-python@v7" with: - python-version: "3.12" + python-version: "3.13" allow-prereleases: true - name: "Install docs packages" diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c9aefc2..2692182 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,7 +6,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.13" nodejs: "16" jobs: post_install: diff --git a/docs/conf.py b/docs/conf.py index a55d6cd..ad382db 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -83,6 +83,7 @@ # There is no other context except that warning ("py:class", "list[dict[str"), ("py:class", "botocore.client.S3"), + ("py:class", "botocore.client.BaseClient"), ("py:class", "fastapi.responses.StreamingResponse"), ] diff --git a/pyproject.toml b/pyproject.toml index 6d82711..a20442f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ version = "0.4.2" description = "Defines OGDC recipe API(s) and submits recipes to OGDC for execution" readme = "README.md" license.file = "LICENSE" -requires-python = ">=3.11" +requires-python = ">=3.13" classifiers = [ "Development Status :: 1 - Planning", "Intended Audience :: Science/Research", @@ -21,8 +21,8 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Scientific/Engineering", "Typing :: Typed", ] @@ -52,7 +52,7 @@ dependencies = [ # NOTE: "test" and "dev" are duplicated; why do we need both? test = [ - "mypy ~=1.10.0", + "mypy ~=1.15", "pytest >=6", "pytest-cov >=3", "pytest-order", @@ -130,6 +130,11 @@ filterwarnings = [ "ignore:Using `httpx` with `starlette.testclient` is deprecated:DeprecationWarning", # AnyIO deprecation alias "ignore:The anyio\\.abc\\.BlockingPortal alias is deprecated:DeprecationWarning", + # d1_common (dataone.libclient) uses a non-raw regex string (`b"^\s*$\n"`). + # Harmless SyntaxWarning, but "error" above escalates it to a SyntaxError at + # import time on Python >=3.14. Leading ".*" because 3.14 reworded the message. + # Remove once fixed upstream in d1_python. + "ignore:.*invalid escape sequence:SyntaxWarning", ] log_cli_level = "INFO" testpaths = [ @@ -149,7 +154,7 @@ report.exclude_also = [ [tool.mypy] files = ["src", "tests"] -python_version = "3.11" +python_version = "3.13" warn_unused_configs = true strict = true enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] @@ -174,16 +179,14 @@ module = [ "boto3", "botocore.exceptions", "botocore", - "botocore.config", - "botocore.response", - "botocore.stub", + "botocore.*", ] ignore_missing_imports = true [tool.ruff] src = ["src"] -target-version = "py311" +target-version = "py313" [tool.ruff.lint] extend-select = [ @@ -226,7 +229,7 @@ isort.required-imports = ["from __future__ import annotations"] [tool.ruff.lint.per-file-ignores] "tests/**" = ["T20"] "noxfile.py" = ["T20"] -"**/recipe_config.py" = ["UP007"] +"**/recipe_config.py" = ["UP007", "UP040"] [tool.hatch.metadata] allow-direct-references = true diff --git a/src/ogdc_runner/__main__.py b/src/ogdc_runner/__main__.py index efe1077..0fd52e7 100644 --- a/src/ogdc_runner/__main__.py +++ b/src/ogdc_runner/__main__.py @@ -354,7 +354,6 @@ def validate_all_recipes(recipes_location: str, ref: str) -> None: def _download_output_for_workflow( config: Config, workflow_name: str, output_dir: Path ) -> None: - headers = {} if config.access_mode != ACCESS_MODE_OPEN: headers["Authorization"] = f"Bearer {_get_api_token(config)}" diff --git a/src/ogdc_runner/argo.py b/src/ogdc_runner/argo.py index dcf3c80..42851e3 100644 --- a/src/ogdc_runner/argo.py +++ b/src/ogdc_runner/argo.py @@ -447,7 +447,7 @@ def OgdcWorkflow( name: str, archive_workflow: bool, **kwargs: Any, -) -> Generator[Workflow, None, None]: +) -> Generator[Workflow]: """Contexts manager that yields an argo workflow with configuration driven by `recipe_config`. kwargs: diff --git a/src/ogdc_runner/models/recipe_config.py b/src/ogdc_runner/models/recipe_config.py index 1ed25f8..81e7b7d 100644 --- a/src/ogdc_runner/models/recipe_config.py +++ b/src/ogdc_runner/models/recipe_config.py @@ -480,7 +480,7 @@ class RecipeConfig(RecipeMeta): # This is where the rest of the config was set from. recipe_directory: Path - @computed_field # type: ignore[misc] + @computed_field # type: ignore[prop-decorator] @cached_property def id(self) -> str: k8s_name = self.name.lower().replace(" ", "-") diff --git a/src/ogdc_runner/publish.py b/src/ogdc_runner/publish.py index 3be6bba..ae74380 100644 --- a/src/ogdc_runner/publish.py +++ b/src/ogdc_runner/publish.py @@ -6,7 +6,7 @@ from functools import cache import boto3 -import botocore +from botocore.client import BaseClient from botocore.config import Config from botocore.exceptions import ClientError from hera.workflows import ( @@ -288,7 +288,7 @@ def get_s3_bucket() -> str: @cache -def get_s3_client() -> botocore.client.S3: +def get_s3_client() -> BaseClient: """Return an S3 client configured from the `S3_*` environment variables.""" s3_secret_access_key_id = os.environ.get("S3_SECRET_KEY_ID") s3_secret_access_key = os.environ.get("S3_SECRET_KEY_KEY") diff --git a/src/ogdc_runner/recipe.py b/src/ogdc_runner/recipe.py index 32aac1a..cb98560 100644 --- a/src/ogdc_runner/recipe.py +++ b/src/ogdc_runner/recipe.py @@ -33,7 +33,7 @@ def stage_ogdc_recipe(recipe_location: str): # type: ignore[no-untyped-def] @contextmanager -def clone_recipes_repo(repo_url: str, ref: str = "main") -> Generator[Path, None, None]: +def clone_recipes_repo(repo_url: str, ref: str = "main") -> Generator[Path]: """Clone a git repository at a specific ref. Args: diff --git a/src/ogdc_runner/service/db.py b/src/ogdc_runner/service/db.py index b52abe3..ab379bb 100644 --- a/src/ogdc_runner/service/db.py +++ b/src/ogdc_runner/service/db.py @@ -42,7 +42,7 @@ def get_engine() -> sqlalchemy.engine.base.Engine: # Create a FastAPI dependency on the database session. -def _get_session() -> Generator[Session, None, None]: +def _get_session() -> Generator[Session]: """Yield a database session for FastAPI routes.""" with Session(get_engine()) as session: yield session diff --git a/src/ogdc_runner/workflow/viz_workflow.py b/src/ogdc_runner/workflow/viz_workflow.py index 21beba6..4a7fb59 100644 --- a/src/ogdc_runner/workflow/viz_workflow.py +++ b/src/ogdc_runner/workflow/viz_workflow.py @@ -4,7 +4,7 @@ import logging import os from collections.abc import Callable -from typing import Any, TypeAlias, cast +from typing import Any, cast from hera.workflows import ( DAG, @@ -52,8 +52,8 @@ # ruff: noqa: PLC0415 logger = logging.getLogger(__name__) -WorkflowTask: TypeAlias = Any -WorkflowScript: TypeAlias = Callable[..., WorkflowTask] +WorkflowTask = Any +WorkflowScript = Callable[..., WorkflowTask] # Viz worker container image. Override via VIZ_WORKFLOW_IMAGE env var. VIZ_WORKFLOW_IMAGE: str = os.environ.get(