From c496efc34d5bf917a4f1f46b3e1ebbe51fc76c6e Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 7 Jan 2026 23:09:00 +0100 Subject: [PATCH 1/4] CI: Prepare environment for running `ty` --- .github/workflows/tests.yml | 5 ++++- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e87ff71..9dcc41a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: "macos-latest", # ARM ] python-version: [ - "3.7", + "3.8", "3.14", ] @@ -55,6 +55,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 + id: python with: python-version: ${{ matrix.python-version }} architecture: x64 @@ -73,6 +74,8 @@ jobs: pip install --prefer-binary --editable=.[develop,test] - name: Run linters and software tests + env: + VIRTUAL_ENV: ${{ steps.python.outputs.python-path }} run: | poe check diff --git a/pyproject.toml b/pyproject.toml index ce33e66..cec7774 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ authors = [ { name = "Christian Haudum", email = "developer@christianhaudum.at" }, { name = "Andreas Motl", email = "andreas.motl@crate.io" }, ] -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "Development Status :: 4 - Beta", "Environment :: Plugins", From 78ee31fafc7d5bd26a445bedea7141169fc1d33b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 7 Jan 2026 22:00:06 +0100 Subject: [PATCH 2/4] Maintenance: Switch type checker from `mypy` to `ty` --- CHANGES.rst | 1 + pyproject.toml | 18 ++---------------- pytest_cratedb/plugin.py | 14 +++++++------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9ad80d4..06d8ad1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog for pytest-cratedb Unreleased ========== +- Maintenance: Switched type checker from ``mypy`` to ``ty`` 2026/01/05 v0.4.1 ================= diff --git a/pyproject.toml b/pyproject.toml index cec7774..c34aa59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,10 +77,10 @@ dependencies = [ "pytest<10", ] optional-dependencies.develop = [ - "mypy<1.20", "poethepoet<1", "pyproject-fmt<3", "ruff<0.15", + "ty", "validate-pyproject<1", ] optional-dependencies.release = [ @@ -177,20 +177,6 @@ show_missing = true exclude_lines = [ ] -[tool.mypy] -packages = [ - "pytest_cratedb", -] -exclude = [ -] -check_untyped_defs = true -explicit_package_bases = true -ignore_missing_imports = true -implicit_optional = true -install_types = true -namespace_packages = true -non_interactive = true - [tool.versioningit.vcs] method = "git" default-tag = "0.0.0" @@ -218,7 +204,7 @@ lint = [ { cmd = "ruff format --check ." }, { cmd = "ruff check ." }, { cmd = "validate-pyproject pyproject.toml" }, - { cmd = "mypy" }, + { cmd = "ty check" }, ] release = [ diff --git a/pytest_cratedb/plugin.py b/pytest_cratedb/plugin.py index 8ab3031..ed1657a 100644 --- a/pytest_cratedb/plugin.py +++ b/pytest_cratedb/plugin.py @@ -1,10 +1,10 @@ +import datetime as dt import logging import random import shutil import string import tempfile -from datetime import datetime -from typing import Callable, Generator, Optional +from typing import Callable, Dict, Generator, Optional import pytest from cr8.run_crate import CrateNode, get_crate @@ -29,11 +29,11 @@ def __init__(self, name: str, version: str, **settings) -> None: def __repr__(self) -> str: return f"" - def __enter__(self): + def __enter__(self) -> "CrateLayer": self._start() return self - def __exit__(self, exception_type, exception_value, traceback): + def __exit__(self, exception_type, exception_value, traceback) -> None: self._stop() def _start(self) -> None: @@ -62,7 +62,7 @@ def dsn(self) -> Optional[str]: return self.node.http_url @property - def addresses(self): + def addresses(self) -> Dict[str, str]: return self.node.addresses @@ -78,7 +78,7 @@ class CratePlugin: # noinspection SpellCheckingInspection @staticmethod - def pytest_addoption(parser): + def pytest_addoption(parser) -> None: """ Adds custom options to the ``pytest`` command. https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_addoption @@ -106,7 +106,7 @@ def layer_factory(name: str, version: str, **settings): @pytest.fixture(scope="session") def crate(self, crate_layer, crate_version) -> CrateLayerGenerator: ident = "".join(random.sample(string.ascii_letters, 8)) - date = datetime.utcnow().strftime("%Y%m%d%H%M") + date = dt.datetime.now(dt.timezone.utc).strftime("%Y%m%d%H%M") yield from crate_layer(f"pytest-cratedb-{date}-{ident}", crate_version) @pytest.fixture From 6f0f51994341b8d39d250a5cebe296d5a8cc26f6 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 7 Jan 2026 22:00:24 +0100 Subject: [PATCH 3/4] Maintenance: Add `py.typed` marker file, signalling typing support --- CHANGES.rst | 1 + pytest_cratedb/py.typed | 0 2 files changed, 1 insertion(+) create mode 100644 pytest_cratedb/py.typed diff --git a/CHANGES.rst b/CHANGES.rst index 06d8ad1..e334e87 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ Changelog for pytest-cratedb Unreleased ========== - Maintenance: Switched type checker from ``mypy`` to ``ty`` +- Maintenance: Added ``py.typed`` marker file, signalling typing support 2026/01/05 v0.4.1 ================= diff --git a/pytest_cratedb/py.typed b/pytest_cratedb/py.typed new file mode 100644 index 0000000..e69de29 From 1bedfdac67fddaa91f9edbd3084e176c3e9d3344 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 7 Jan 2026 23:13:19 +0100 Subject: [PATCH 4/4] CI: Fix path to Python --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9dcc41a..29ac1ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,7 +75,7 @@ jobs: - name: Run linters and software tests env: - VIRTUAL_ENV: ${{ steps.python.outputs.python-path }} + VIRTUAL_ENV: ${{ env.pythonLocation }} run: | poe check