diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f167597..ef9347d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +0.16.3 (2023-01-03) +------------------- + +- Fix broken ``Protocol`` import due to absent ``typing_extensions`` + on Python <3.10. + 0.16.2 (2022-12-29) ------------------- diff --git a/docs/advanced.rst b/docs/advanced.rst index d41af64..4f45f83 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -18,7 +18,7 @@ Use the following configuration: repos: - repo: https://github.com/ariebovenberg/slotscheck - rev: v0.16.2 + rev: v0.16.3 hooks: - id: slotscheck # If your Python files are not importable from the project root, diff --git a/pyproject.toml b/pyproject.toml index 2d85baf..bc52e09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "slotscheck" -version = "0.16.2" +version = "0.16.3" description = "Ensure your __slots__ are working properly." authors = ["Arie Bovenberg "] license = "MIT" diff --git a/src/slotscheck/cli.py b/src/slotscheck/cli.py index 2c38494..de641d2 100644 --- a/src/slotscheck/cli.py +++ b/src/slotscheck/cli.py @@ -19,7 +19,6 @@ ) import click -from typing_extensions import Protocol from . import config from .checks import ( @@ -52,6 +51,11 @@ walk_classes, ) +try: + from typing import Protocol +except ImportError: # pragma: no cover + from typing_extensions import Protocol # type: ignore[assignment] + @click.command("slotscheck") @click.argument( diff --git a/tests/examples/module_not_ok/foo.py b/tests/examples/module_not_ok/foo.py index 8598383..0f93089 100644 --- a/tests/examples/module_not_ok/foo.py +++ b/tests/examples/module_not_ok/foo.py @@ -1,4 +1,8 @@ -from typing_extensions import Protocol + +try: + from typing import Protocol +except ImportError: + from typing_extensions import Protocol class A: