diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3b6abc..d806391 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - { short: linux, name: ubuntu-latest } - { short: win, name: windows-latest } - { short: macos, name: macos-14 } - python-version: ["3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 57a0855..fb353af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ readme = "README.md" license = "BSD-3-Clause AND PSF-2.0" license-files = ["LICENSE.txt"] -requires-python = ">=3.12" +requires-python = ">=3.10" keywords = ["typing", "stub files", "docstings", "numpydoc"] classifiers = [ "Development Status :: 3 - Alpha", @@ -25,6 +25,8 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Code Generators", @@ -38,6 +40,7 @@ dependencies = [ "lark >=1.1.9", "black >=24.4.2", "isort >=5.13.2", + "typing_extensions >= 4.5.0" ] [project.optional-dependencies] diff --git a/src/docstub/_cache.py b/src/docstub/_cache.py index e7a9f31..4843a1d 100644 --- a/src/docstub/_cache.py +++ b/src/docstub/_cache.py @@ -1,10 +1,11 @@ import logging from functools import cached_property -from typing import Any, Protocol -logger = logging.getLogger(__name__) +from typing_extensions import Any, Protocol, TypeVar +logger = logging.getLogger(__name__) +T = TypeVar("T") CACHE_DIR_NAME = ".docstub_cache" @@ -92,7 +93,7 @@ def validate_cache(path): raise FileNotFoundError(f"expected '{path}' to contain a '.gitignore' file") -class FuncSerializer[T](Protocol): +class FuncSerializer(Protocol[T]): """Defines an interface to serialize and deserialize results of a function. This interface is used by `FileCache` to cache results of a diff --git a/tests/test_docs.py b/tests/test_docs.py index ea64f50..4b65884 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -70,7 +70,7 @@ def test_command_line_reference(command, name): with md_file.open("r") as io: md_content = io.read() - guard_name = f"cli-{name.replace(" ", "-")}" + guard_name = f"cli-{name.replace(' ', '-')}" regex = rf"(.*)" matches = re.findall(regex, md_content, flags=re.DOTALL) assert len(matches) == 1