diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e87ff71..29ac1ec 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: ${{ env.pythonLocation }} run: | poe check diff --git a/CHANGES.rst b/CHANGES.rst index 9ad80d4..e334e87 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ 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/pyproject.toml b/pyproject.toml index ce33e66..c34aa59 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", @@ -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 diff --git a/pytest_cratedb/py.typed b/pytest_cratedb/py.typed new file mode 100644 index 0000000..e69de29