From 0eda710f83f1e079beff7287b7f3567bf98faa24 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Fri, 7 Feb 2025 15:57:27 +0200 Subject: [PATCH 1/3] Only import from typing_extensions if needed TypeAlias was included in the typing module in Python 3.10. Self was included in the typing module in Python 3.11. --- src/libtmux/server.py | 6 +++++- src/libtmux/test.py | 9 +++++++-- tests/legacy_api/test_version.py | 7 ++++++- tests/test_version.py | 7 ++++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/libtmux/server.py b/src/libtmux/server.py index 511329470..e022965ab 100644 --- a/src/libtmux/server.py +++ b/src/libtmux/server.py @@ -35,9 +35,13 @@ ) if t.TYPE_CHECKING: + import sys import types - from typing_extensions import TypeAlias + if sys.version_info >= (3, 10): + from typing import TypeAlias + else: + from typing_extensions import TypeAlias DashLiteral: TypeAlias = t.Literal["-"] diff --git a/src/libtmux/test.py b/src/libtmux/test.py index 4c5f32efd..2bbaa2e53 100644 --- a/src/libtmux/test.py +++ b/src/libtmux/test.py @@ -15,15 +15,20 @@ logger = logging.getLogger(__name__) if t.TYPE_CHECKING: + import sys import types from collections.abc import Callable, Generator - from typing_extensions import Self - from libtmux.server import Server from libtmux.session import Session from libtmux.window import Window + if sys.version_info >= (3, 11): + from typing import Self + else: + from typing_extensions import Self + + TEST_SESSION_PREFIX = "libtmux_" RETRY_TIMEOUT_SECONDS = int(os.getenv("RETRY_TIMEOUT_SECONDS", 8)) RETRY_INTERVAL_SECONDS = float(os.getenv("RETRY_INTERVAL_SECONDS", 0.05)) diff --git a/tests/legacy_api/test_version.py b/tests/legacy_api/test_version.py index d968f20a2..f702a2c81 100644 --- a/tests/legacy_api/test_version.py +++ b/tests/legacy_api/test_version.py @@ -11,10 +11,15 @@ from libtmux._compat import LooseVersion if t.TYPE_CHECKING: + import sys from collections.abc import Callable from _pytest.python_api import RaisesContext - from typing_extensions import TypeAlias + + if sys.version_info >= (3, 10): + from typing import TypeAlias + else: + from typing_extensions import TypeAlias VersionCompareOp: TypeAlias = Callable[ [t.Any, t.Any], diff --git a/tests/test_version.py b/tests/test_version.py index d968f20a2..f702a2c81 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -11,10 +11,15 @@ from libtmux._compat import LooseVersion if t.TYPE_CHECKING: + import sys from collections.abc import Callable from _pytest.python_api import RaisesContext - from typing_extensions import TypeAlias + + if sys.version_info >= (3, 10): + from typing import TypeAlias + else: + from typing_extensions import TypeAlias VersionCompareOp: TypeAlias = Callable[ [t.Any, t.Any], From b0d6c59fd825dde1a927e3723b5a310cd7382729 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 17 Feb 2025 06:20:58 -0600 Subject: [PATCH 2/3] docs(CHANGES) Note fix from #563 --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 8a92e1423..56c94e031 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,10 @@ $ pip install --user --upgrade --pre libtmux - _Future release notes will be placed here_ +### Packaging + +- Types: Only import `typing_extensions` when necessary, via #563, @ppentchev! + ## libtmux 0.44.0 (2025-02-16) ### New Features From 9097aced0e6c5bb8022dc3cb2ce2932581afe307 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 17 Feb 2025 06:21:26 -0600 Subject: [PATCH 3/3] Tag v0.44.1 (`typing-extensions` import fix) --- CHANGES | 2 ++ pyproject.toml | 2 +- src/libtmux/__about__.py | 2 +- uv.lock | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 56c94e031..e0015f54c 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,8 @@ $ pip install --user --upgrade --pre libtmux - _Future release notes will be placed here_ +## libtmux 0.44.1 (2025-02-17) + ### Packaging - Types: Only import `typing_extensions` when necessary, via #563, @ppentchev! diff --git a/pyproject.toml b/pyproject.toml index 2e09cff1d..b9f1d21a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "libtmux" -version = "0.44.0" +version = "0.44.1" description = "Typed library that provides an ORM wrapper for tmux, a terminal multiplexer." requires-python = ">=3.9,<4.0" authors = [ diff --git a/src/libtmux/__about__.py b/src/libtmux/__about__.py index 9dd8864ed..61aa08170 100644 --- a/src/libtmux/__about__.py +++ b/src/libtmux/__about__.py @@ -4,7 +4,7 @@ __title__ = "libtmux" __package_name__ = "libtmux" -__version__ = "0.44.0" +__version__ = "0.44.1" __description__ = "Typed scripting library / ORM / API wrapper for tmux" __email__ = "tony@git-pull.com" __author__ = "Tony Narlock" diff --git a/uv.lock b/uv.lock index f839e1591..decf874e9 100644 --- a/uv.lock +++ b/uv.lock @@ -378,7 +378,7 @@ wheels = [ [[package]] name = "libtmux" -version = "0.44.0" +version = "0.44.1" source = { editable = "." } [package.dev-dependencies]