Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217496/?format=api
{ "id": 2217496, "url": "http://patchwork.ozlabs.org/api/patches/2217496/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329182832.39824-1-vfazio@gmail.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260329182832.39824-1-vfazio@gmail.com>", "list_archive_url": null, "date": "2026-03-29T18:28:32", "name": "[libgpiod] bindings: python: drop python 3.9 support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ff6c99514a0e9ce27f6bd24aa1a3ba2c6f9e47e2", "submitter": { "id": 78694, "url": "http://patchwork.ozlabs.org/api/people/78694/?format=api", "name": "Vincent Fazio", "email": "vfazio@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329182832.39824-1-vfazio@gmail.com/mbox/", "series": [ { "id": 497935, "url": "http://patchwork.ozlabs.org/api/series/497935/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=497935", "date": "2026-03-29T18:28:32", "name": "[libgpiod] bindings: python: drop python 3.9 support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497935/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217496/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217496/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-gpio+bounces-34369-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-gpio@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=TMUdLhWv;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34369-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"TMUdLhWv\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.161.41", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkNDt6dsKz1y1P\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 05:28:46 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 4E896300D6AA\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 18:28:42 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BFDB438551C;\n\tSun, 29 Mar 2026 18:28:41 +0000 (UTC)", "from mail-oo1-f41.google.com (mail-oo1-f41.google.com\n [209.85.161.41])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 994952DEA93\n\tfor <linux-gpio@vger.kernel.org>; Sun, 29 Mar 2026 18:28:39 +0000 (UTC)", "by mail-oo1-f41.google.com with SMTP id\n 006d021491bc7-67e00a230adso2384301eaf.3\n for <linux-gpio@vger.kernel.org>;\n Sun, 29 Mar 2026 11:28:39 -0700 (PDT)", "from Zephyrus.localdomain ([131.93.209.211])\n by smtp.gmail.com with ESMTPSA id\n 006d021491bc7-67e231ea41dsm3549796eaf.15.2026.03.29.11.28.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 29 Mar 2026 11:28:37 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774808921; cv=none;\n b=MDZzXhWmBp7RVM4zO5y7nXk53/qsepUfw3qw8MD6Kl8pmtnPGK0km6FnDQr+AtUrRmcxp2VINQZTfmXEWKPbp7iSQ//qtad6qt6UMTzm5D6d972DsE0Hik0ACdk67/xMmn7HbzwMXd27ERaBPrlcNi1BYceWkdw9jBk/zpod6+k=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774808921; c=relaxed/simple;\n\tbh=WkFkH8fM+J/LnlXbLmAUr6qMVWX8cGdP1Xs8X/u5nxc=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=KYv8ng8re/XSwgePXvUPZgh1EeipeVytXzN4CqOw0mWarPq5q45twFNgZDjnuVM728dKuGit9RUuLRDSlX16+NgkyZOmK2hMwcgE5jLdbrA2kN18xGa1j6Fc5nsfZZ5nyWai+i4RYtUiZQAzgx2maSWzi4xQQ0ygIeRQIeDxWNM=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=TMUdLhWv; arc=none smtp.client-ip=209.85.161.41", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774808918; x=1775413718;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=Rg0uMy/jx2NSn6EVJetGifZ0Mlgvuk8yNhBJ8hBLp1o=;\n b=TMUdLhWvWuRen8zHfdp+30IMMfoida9lh+Gd0KMWDfny0GEkJaSVag47ogNx4ppNJy\n z8w1EFLThPKqC4k8rsiQouu5NLWKJP+ZXT84Xp1NGtYtb2ugs/ooyywlsM/fKssp4LNg\n 0EXMoSsbzbN7tegUi004sXdDWUgpxmzGNmFg6WqLYDco5AFVHvwocBWDymqugUP/iPqz\n Y1bkUA/hYmZ33m5igrY9b9pIf2EP3JDfYaxwWx0ugKXbkeMz2nYbMQHvS6WdRv+YJ1Cz\n SEsfRDSjaY50txvRIlau8PFK+fe7jtBVnXDqtTC0rHh1/+i8dR0u6ZHFx0ar1A2mh3eJ\n 6tqQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774808918; x=1775413718;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Rg0uMy/jx2NSn6EVJetGifZ0Mlgvuk8yNhBJ8hBLp1o=;\n b=hcF/bTZ15MQ8D7X07m6jlFyZDnXtVSj5owSJifYLtB8WbAUogoGgePhwqiigIGvo69\n jpOVx9No+eKRals4AwlAE8vstgmZwnpOsyRjWd+owmjqf/fLdvDE3k9QefrcGw/F9lxC\n a5FKC7vfPlX982RGWaBFueKezMbIgfOTH5fO7kcOy2KwcnBmt2izDQNGfaD5w7jb4lTy\n yvwq/hf5sY6PNCJXg0wijJqtLB3feLh5PUbMJ4XT1lGTwgNVaAtl0VMzx630s8cc28KH\n /FK698QIPDHvBWKuVlog7TA7+NF40YMwEVNWzXpMoSf2LaRL68StH6Dq7QgskAWAB9kS\n zmBg==", "X-Gm-Message-State": "AOJu0YzZFdwkJ3EwPd9HwzQsSH5gjL89Q9j3+uagTzjHURM83pnY5m0u\n\tm52bnAWmFO8Cw/xYnsolO4dTJa6/+GwU/+jmxBDsOEB6ZG++acMSHnuDK2WLeg==", "X-Gm-Gg": "ATEYQzyGAr5dhF9wVP97unm95yL8ZWuZntuJEPyBRlMUiK5VB191IU4akZ+rlgdvpGu\n\tQVOoTCVnjr7THC9NGso+eG69UMYnPlAtuH0U4rBJWDgzVzHQI0eJYCsN5CXG4WWiKASRmTic+SE\n\td3muqJmv/hbaAQ+hjHUMYT8pUZjhC++JAfTNhTQi0ip3s/fPZffv54VW9BE5M/eeMM+0RnS4+SU\n\tY2JkNOUOOc4lwc+g2Smx4tcKX2sPdoc4eE6soPtq53bcLP2l9jp6rkdq/s5OOZLkrJi9D0q+iDm\n\tptHF7tA9FMCh6XRgYuyNfxFIMp0u7mLMIhp8WuqDiKyYvCvBa7v3aTUFes2RTe/gtxds5G0blGU\n\tS0w8vuZxqpVh7lXCStTgdzmcdvfjl/oweD6ZPSx0KpKV9dl6uoB7rM/QWwgn8MmQfY6G+qF80v1\n\t3+xbIMdvF5LmDeGF4dAZttTisiYQbDdhlRoxLkXmLJrcPMwybGTY9/5MwJTV/PWA==", "X-Received": "by 2002:a05:6820:81c1:b0:67b:c368:1364 with SMTP id\n 006d021491bc7-67e1862686cmr5437622eaf.25.1774808918159;\n Sun, 29 Mar 2026 11:28:38 -0700 (PDT)", "From": "Vincent Fazio <vfazio@gmail.com>", "To": "linux-gpio@vger.kernel.org", "Cc": "Vincent Fazio <vfazio@gmail.com>", "Subject": "[libgpiod][PATCH] bindings: python: drop python 3.9 support", "Date": "Sun, 29 Mar 2026 13:28:32 -0500", "Message-ID": "<20260329182832.39824-1-vfazio@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "Precedence": "bulk", "X-Mailing-List": "linux-gpio@vger.kernel.org", "List-Id": "<linux-gpio.vger.kernel.org>", "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "* Update pyproject.toml to require Python 3.10+ for runtime\n* Update mypy's target version to 3.10 syntax\n* Drop ruff's target version as it's inferred by the project's\n requires-python value\n* Remove the linter settings that ignored UP007 & UP0045\n* Update type annotations to conform to active linter rules\n\nCloses: https://github.com/brgl/libgpiod/issues/151\nSigned-off-by: Vincent Fazio <vfazio@gmail.com>\n---\n bindings/python/gpiod/__init__.py | 9 +++---\n bindings/python/gpiod/_ext.pyi | 10 +++----\n bindings/python/gpiod/_internal.py | 10 +++----\n bindings/python/gpiod/chip.py | 36 ++++++++++-------------\n bindings/python/gpiod/line_request.py | 36 ++++++++++-------------\n bindings/python/pyproject.toml | 10 ++-----\n bindings/python/tests/gpiosim/chip.py | 9 +++---\n bindings/python/tests/helpers.py | 8 ++---\n bindings/python/tests/tests_edge_event.py | 5 ++--\n bindings/python/tests/tests_info_event.py | 3 +-\n configure.ac | 2 +-\n 11 files changed, 59 insertions(+), 79 deletions(-)", "diff": "diff --git a/bindings/python/gpiod/__init__.py b/bindings/python/gpiod/__init__.py\nindex 854e41f..be1b6b0 100644\n--- a/bindings/python/gpiod/__init__.py\n+++ b/bindings/python/gpiod/__init__.py\n@@ -8,7 +8,6 @@ This module wraps the native C API of libgpiod in a set of python classes.\n \"\"\"\n \n from collections.abc import Iterable\n-from typing import Optional, Union\n \n from . import (\n _ext,\n@@ -87,10 +86,10 @@ def is_gpiochip_device(path: str) -> bool:\n \n def request_lines(\n path: str,\n- config: dict[Union[Iterable[Union[int, str]], int, str], Optional[LineSettings]],\n- consumer: Optional[str] = None,\n- event_buffer_size: Optional[int] = None,\n- output_values: Optional[dict[Union[int, str], line.Value]] = None,\n+ config: dict[Iterable[int | str] | int | str, LineSettings | None],\n+ consumer: str | None = None,\n+ event_buffer_size: int | None = None,\n+ output_values: dict[int | str, line.Value] | None = None,\n ) -> LineRequest:\n \"\"\"\n Open a GPIO chip pointed to by 'path', request lines according to the\ndiff --git a/bindings/python/gpiod/_ext.pyi b/bindings/python/gpiod/_ext.pyi\nindex 31fd352..873c23f 100644\n--- a/bindings/python/gpiod/_ext.pyi\n+++ b/bindings/python/gpiod/_ext.pyi\n@@ -1,8 +1,6 @@\n # SPDX-License-Identifier: LGPL-2.1-or-later\n # SPDX-FileCopyrightText: 2024 Vincent Fazio <vfazio@gmail.com>\n \n-from typing import Optional\n-\n from .chip_info import ChipInfo\n from .edge_event import EdgeEvent\n from .info_event import InfoEvent\n@@ -32,7 +30,7 @@ class Request:\n def get_values(self, offsets: list[int], values: list[Value]) -> None: ...\n def set_values(self, values: dict[int, Value]) -> None: ...\n def reconfigure_lines(self, line_cfg: LineConfig) -> None: ...\n- def read_edge_events(self, max_events: Optional[int]) -> list[EdgeEvent]: ...\n+ def read_edge_events(self, max_events: int | None) -> list[EdgeEvent]: ...\n @property\n def chip_name(self) -> str: ...\n @property\n@@ -47,12 +45,12 @@ class Chip:\n def get_info(self) -> ChipInfo: ...\n def line_offset_from_id(self, id: str) -> int: ...\n def get_line_info(self, offset: int, watch: bool) -> LineInfo: ...\n- def get_line_name(self, offset: int) -> Optional[str]: ...\n+ def get_line_name(self, offset: int) -> str | None: ...\n def request_lines(\n self,\n line_cfg: LineConfig,\n- consumer: Optional[str],\n- event_buffer_size: Optional[int],\n+ consumer: str | None,\n+ event_buffer_size: int | None,\n ) -> Request: ...\n def read_info_event(self) -> InfoEvent: ...\n def close(self) -> None: ...\ndiff --git a/bindings/python/gpiod/_internal.py b/bindings/python/gpiod/_internal.py\nindex ee15796..b81f970 100644\n--- a/bindings/python/gpiod/_internal.py\n+++ b/bindings/python/gpiod/_internal.py\n@@ -5,7 +5,7 @@ from __future__ import annotations\n \n from datetime import timedelta\n from select import select\n-from typing import TYPE_CHECKING, Optional, Union\n+from typing import TYPE_CHECKING\n \n if TYPE_CHECKING:\n from collections.abc import Generator, Iterable\n@@ -15,8 +15,8 @@ if TYPE_CHECKING:\n __all__ = [\"poll_fd\", \"config_iter\"]\n \n \n-def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:\n- sec: Union[float, None]\n+def poll_fd(fd: int, timeout: timedelta | float | None = None) -> bool:\n+ sec: float | None\n if isinstance(timeout, timedelta):\n sec = timeout.total_seconds()\n else:\n@@ -27,8 +27,8 @@ def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:\n \n \n def config_iter(\n- config: dict[Union[Iterable[Union[int, str]], int, str], Optional[LineSettings]],\n-) -> Generator[tuple[Union[int, str], Optional[LineSettings]]]:\n+ config: dict[Iterable[int | str] | int | str, LineSettings | None],\n+) -> Generator[tuple[int | str, LineSettings | None]]:\n for key, settings in config.items():\n if isinstance(key, int) or isinstance(key, str):\n yield key, settings\ndiff --git a/bindings/python/gpiod/chip.py b/bindings/python/gpiod/chip.py\nindex a98fce6..8113fa9 100644\n--- a/bindings/python/gpiod/chip.py\n+++ b/bindings/python/gpiod/chip.py\n@@ -4,7 +4,7 @@\n from __future__ import annotations\n \n from errno import ENOENT\n-from typing import TYPE_CHECKING, Optional, Union, cast\n+from typing import TYPE_CHECKING, cast\n \n from . import _ext\n from ._internal import config_iter, poll_fd\n@@ -60,8 +60,8 @@ class Chip:\n path:\n Path to the GPIO character device file.\n \"\"\"\n- self._chip: Union[_ext.Chip, None] = _ext.Chip(path)\n- self._info: Union[ChipInfo, None] = None\n+ self._chip: _ext.Chip | None = _ext.Chip(path)\n+ self._info: ChipInfo | None = None\n \n def __bool__(self) -> bool:\n \"\"\"\n@@ -81,9 +81,9 @@ class Chip:\n \n def __exit__(\n self,\n- exc_type: Optional[type[BaseException]],\n- exc_value: Optional[BaseException],\n- traceback: Optional[TracebackType],\n+ exc_type: type[BaseException] | None,\n+ exc_value: BaseException | None,\n+ traceback: TracebackType | None,\n ) -> None:\n \"\"\"\n Controlled execution exit callback.\n@@ -117,7 +117,7 @@ class Chip:\n \n return self._info\n \n- def line_offset_from_id(self, id: Union[str, int]) -> int:\n+ def line_offset_from_id(self, id: str | int) -> int:\n \"\"\"\n Map a line's identifier to its offset within the chip.\n \n@@ -155,13 +155,13 @@ class Chip:\n \n return offset\n \n- def _get_line_info(self, line: Union[int, str], watch: bool) -> LineInfo:\n+ def _get_line_info(self, line: int | str, watch: bool) -> LineInfo:\n self._check_closed()\n return cast(\"_ext.Chip\", self._chip).get_line_info(\n self.line_offset_from_id(line), watch\n )\n \n- def get_line_info(self, line: Union[int, str]) -> LineInfo:\n+ def get_line_info(self, line: int | str) -> LineInfo:\n \"\"\"\n Get the snapshot of information about the line at given offset.\n \n@@ -174,7 +174,7 @@ class Chip:\n \"\"\"\n return self._get_line_info(line, watch=False)\n \n- def watch_line_info(self, line: Union[int, str]) -> LineInfo:\n+ def watch_line_info(self, line: int | str) -> LineInfo:\n \"\"\"\n Get the snapshot of information about the line at given offset and\n start watching it for future changes.\n@@ -188,7 +188,7 @@ class Chip:\n \"\"\"\n return self._get_line_info(line, watch=True)\n \n- def unwatch_line_info(self, line: Union[int, str]) -> None:\n+ def unwatch_line_info(self, line: int | str) -> None:\n \"\"\"\n Stop watching a line for status changes.\n \n@@ -201,9 +201,7 @@ class Chip:\n self.line_offset_from_id(line)\n )\n \n- def wait_info_event(\n- self, timeout: Optional[Union[timedelta, float]] = None\n- ) -> bool:\n+ def wait_info_event(self, timeout: timedelta | float | None = None) -> bool:\n \"\"\"\n Wait for line status change events on any of the watched lines on the\n chip.\n@@ -237,12 +235,10 @@ class Chip:\n \n def request_lines(\n self,\n- config: dict[\n- Union[Iterable[Union[int, str]], int, str], Optional[LineSettings]\n- ],\n- consumer: Optional[str] = None,\n- event_buffer_size: Optional[int] = None,\n- output_values: Optional[dict[Union[int, str], Value]] = None,\n+ config: dict[Iterable[int | str] | int | str, LineSettings | None],\n+ consumer: str | None = None,\n+ event_buffer_size: int | None = None,\n+ output_values: dict[int | str, Value] | None = None,\n ) -> LineRequest:\n \"\"\"\n Request a set of lines for exclusive usage.\ndiff --git a/bindings/python/gpiod/line_request.py b/bindings/python/gpiod/line_request.py\nindex deb48a7..0287791 100644\n--- a/bindings/python/gpiod/line_request.py\n+++ b/bindings/python/gpiod/line_request.py\n@@ -4,7 +4,7 @@\n from __future__ import annotations\n \n import warnings\n-from typing import TYPE_CHECKING, Optional, Union, cast\n+from typing import TYPE_CHECKING, cast\n \n from . import _ext\n from ._internal import config_iter, poll_fd\n@@ -33,11 +33,11 @@ class LineRequest:\n Note: LineRequest objects can only be instantiated by a Chip parent.\n LineRequest.__init__() is not part of stable API.\n \"\"\"\n- self._req: Union[_ext.Request, None] = req\n+ self._req: _ext.Request | None = req\n self._chip_name: str\n self._offsets: list[int]\n self._name_map: dict[str, int]\n- self._lines: list[Union[int, str]]\n+ self._lines: list[int | str]\n \n def __bool__(self) -> bool:\n \"\"\"\n@@ -57,9 +57,9 @@ class LineRequest:\n \n def __exit__(\n self,\n- exc_type: Optional[type[BaseException]],\n- exc_value: Optional[BaseException],\n- traceback: Optional[TracebackType],\n+ exc_type: type[BaseException] | None,\n+ exc_value: BaseException | None,\n+ traceback: TracebackType | None,\n ) -> None:\n \"\"\"\n Controlled execution exit callback.\n@@ -79,7 +79,7 @@ class LineRequest:\n cast(\"_ext.Request\", self._req).release()\n self._req = None\n \n- def get_value(self, line: Union[int, str]) -> Value:\n+ def get_value(self, line: int | str) -> Value:\n \"\"\"\n Get a single GPIO line value.\n \n@@ -92,16 +92,14 @@ class LineRequest:\n \"\"\"\n return self.get_values([line])[0]\n \n- def _line_to_offset(self, line: Union[int, str]) -> int:\n+ def _line_to_offset(self, line: int | str) -> int:\n if isinstance(line, int):\n return line\n if (_line := self._name_map.get(line)) is None:\n raise ValueError(f\"unknown line name: {line}\")\n return _line\n \n- def get_values(\n- self, lines: Optional[Iterable[Union[int, str]]] = None\n- ) -> list[Value]:\n+ def get_values(self, lines: Iterable[int | str] | None = None) -> list[Value]:\n \"\"\"\n Get values of a set of GPIO lines.\n \n@@ -124,7 +122,7 @@ class LineRequest:\n cast(\"_ext.Request\", self._req).get_values(offsets, buf)\n return buf\n \n- def set_value(self, line: Union[int, str], value: Value) -> None:\n+ def set_value(self, line: int | str, value: Value) -> None:\n \"\"\"\n Set the value of a single GPIO line.\n \n@@ -136,7 +134,7 @@ class LineRequest:\n \"\"\"\n self.set_values({line: value})\n \n- def set_values(self, values: dict[Union[int, str], Value]) -> None:\n+ def set_values(self, values: dict[int | str, Value]) -> None:\n \"\"\"\n Set the values of a subset of GPIO lines.\n \n@@ -152,9 +150,7 @@ class LineRequest:\n \n def reconfigure_lines(\n self,\n- config: dict[\n- Union[Iterable[Union[int, str]], int, str], Optional[LineSettings]\n- ],\n+ config: dict[Iterable[int | str] | int | str, LineSettings | None],\n ) -> None:\n \"\"\"\n Reconfigure requested lines.\n@@ -196,9 +192,7 @@ class LineRequest:\n \n cast(\"_ext.Request\", self._req).reconfigure_lines(line_cfg)\n \n- def wait_edge_events(\n- self, timeout: Optional[Union[timedelta, float]] = None\n- ) -> bool:\n+ def wait_edge_events(self, timeout: timedelta | float | None = None) -> bool:\n \"\"\"\n Wait for edge events on any of the requested lines.\n \n@@ -215,7 +209,7 @@ class LineRequest:\n \n return poll_fd(self.fd, timeout)\n \n- def read_edge_events(self, max_events: Optional[int] = None) -> list[EdgeEvent]:\n+ def read_edge_events(self, max_events: int | None = None) -> list[EdgeEvent]:\n \"\"\"\n Read a number of edge events from a line request.\n \n@@ -271,7 +265,7 @@ class LineRequest:\n return self._offsets\n \n @property\n- def lines(self) -> list[Union[int, str]]:\n+ def lines(self) -> list[int | str]:\n \"\"\"\n List of requested lines. Lines requested by name are listed as such.\n \"\"\"\ndiff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml\nindex 1c3549c..d919b88 100644\n--- a/bindings/python/pyproject.toml\n+++ b/bindings/python/pyproject.toml\n@@ -11,7 +11,7 @@ dynamic = [\"version\"]\n description = \"Python bindings for libgpiod\"\n readme = \"README.md\"\n license = \"LGPL-2.1-or-later\"\n-requires-python = \">=3.9.0\"\n+requires-python = \">=3.10\"\n authors = [\n {name = \"Bartosz Golaszewski\", email = \"brgl@bgdev.pl\"},\n ]\n@@ -22,7 +22,6 @@ classifiers = [\n \"Programming Language :: Python\",\n \"Programming Language :: Python :: 3\",\n \"Programming Language :: Python :: 3 :: Only\",\n- \"Programming Language :: Python :: 3.9\",\n \"Programming Language :: Python :: 3.10\",\n \"Programming Language :: Python :: 3.11\",\n \"Programming Language :: Python :: 3.12\",\n@@ -46,7 +45,7 @@ include = [\"gpiod\"]\n namespaces = false\n \n [tool.mypy]\n-python_version = \"3.9\"\n+python_version = \"3.10\"\n files = [\n \"gpiod/\",\n \"tests/\",\n@@ -57,7 +56,7 @@ module = \"gpiod.line.*\"\n strict_equality = false # Ignore Enum comparison-overlap: https://github.com/python/mypy/issues/17317\n \n [tool.ruff]\n-target-version = \"py39\"\n+target-version = \"py310\"\n include = [\n \"gpiod/**/*.py\",\n \"gpiod/**/*.pyi\",\n@@ -72,9 +71,6 @@ ignore=[\n \"B904\",\n # Never enforce line length violations. Let the formatter handle it: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules\n \"E501\",\n- # Ignore new Union (|) syntax until we require 3.10+\n- \"UP007\",\n- \"UP045\",\n ]\n \n [tool.ruff.lint.per-file-ignores]\ndiff --git a/bindings/python/tests/gpiosim/chip.py b/bindings/python/tests/gpiosim/chip.py\nindex 691bfe1..7fd0042 100644\n--- a/bindings/python/tests/gpiosim/chip.py\n+++ b/bindings/python/tests/gpiosim/chip.py\n@@ -2,7 +2,6 @@\n # SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>\n \n from enum import Enum\n-from typing import Optional\n \n from . import _ext\n \n@@ -27,10 +26,10 @@ class Chip:\n \n def __init__(\n self,\n- label: Optional[str] = None,\n- num_lines: Optional[int] = None,\n- line_names: Optional[dict[int, str]] = None,\n- hogs: Optional[dict[int, tuple[str, Direction]]] = None,\n+ label: str | None = None,\n+ num_lines: int | None = None,\n+ line_names: dict[int, str] | None = None,\n+ hogs: dict[int, tuple[str, Direction]] | None = None,\n ):\n self._chip = _ext.Chip()\n \ndiff --git a/bindings/python/tests/helpers.py b/bindings/python/tests/helpers.py\nindex ad272a1..4abd8b2 100644\n--- a/bindings/python/tests/helpers.py\n+++ b/bindings/python/tests/helpers.py\n@@ -4,7 +4,7 @@\n from __future__ import annotations\n \n import os\n-from typing import TYPE_CHECKING, Optional\n+from typing import TYPE_CHECKING\n \n if TYPE_CHECKING:\n from types import TracebackType\n@@ -20,8 +20,8 @@ class LinkGuard:\n \n def __exit__(\n self,\n- type: Optional[type[BaseException]],\n- val: Optional[BaseException],\n- tb: Optional[TracebackType],\n+ type: type[BaseException] | None,\n+ val: BaseException | None,\n+ tb: TracebackType | None,\n ) -> None:\n os.unlink(self.dst)\ndiff --git a/bindings/python/tests/tests_edge_event.py b/bindings/python/tests/tests_edge_event.py\nindex bf1685c..4efed2a 100644\n--- a/bindings/python/tests/tests_edge_event.py\n+++ b/bindings/python/tests/tests_edge_event.py\n@@ -6,7 +6,6 @@ from datetime import timedelta\n from functools import partial\n from select import select\n from threading import Thread\n-from typing import Optional\n from unittest import TestCase\n \n import gpiod\n@@ -56,7 +55,7 @@ class EdgeEventInvalidConfig(TestCase):\n class WaitingForEdgeEvents(TestCase):\n def setUp(self) -> None:\n self.sim = gpiosim.Chip(num_lines=8)\n- self.thread: Optional[Thread] = None\n+ self.thread: Thread | None = None\n \n def tearDown(self) -> None:\n if self.thread:\n@@ -208,7 +207,7 @@ class PollLineRequestObject(TestCase):\n self.request = gpiod.request_lines(\n self.sim.dev_path, {2: gpiod.LineSettings(edge_detection=Edge.BOTH)}\n )\n- self.thread: Optional[Thread] = None\n+ self.thread: Thread | None = None\n \n def tearDown(self) -> None:\n if self.thread:\ndiff --git a/bindings/python/tests/tests_info_event.py b/bindings/python/tests/tests_info_event.py\nindex 31dc952..e32ef19 100644\n--- a/bindings/python/tests/tests_info_event.py\n+++ b/bindings/python/tests/tests_info_event.py\n@@ -8,7 +8,6 @@ import time\n from dataclasses import FrozenInstanceError\n from functools import partial\n from select import select\n-from typing import Optional\n from unittest import TestCase\n \n import gpiod\n@@ -53,7 +52,7 @@ class WatchingInfoEventWorks(TestCase):\n def setUp(self) -> None:\n self.sim = gpiosim.Chip(num_lines=8, line_names={4: \"foobar\"})\n self.chip = gpiod.Chip(self.sim.dev_path)\n- self.thread: Optional[threading.Thread] = None\n+ self.thread: threading.Thread | None = None\n \n def tearDown(self) -> None:\n if self.thread:\ndiff --git a/configure.ac b/configure.ac\nindex 61a010f..c1bae2a 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -234,7 +234,7 @@ AM_CONDITIONAL([WITH_BINDINGS_PYTHON], [test \"x$with_bindings_python\" = xtrue])\n \n if test \"x$with_bindings_python\" = xtrue\n then\n-\tAM_PATH_PYTHON([3.9], [],\n+\tAM_PATH_PYTHON([3.10], [],\n \t\t[AC_MSG_ERROR([python3 not found - needed for python bindings])])\n fi\n \n", "prefixes": [ "libgpiod" ] }