commit: 93e2b9b11f75ae40fa3b20d81a11f9bfe836daf3 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Thu Oct 2 03:14:27 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Thu Oct 2 03:31:38 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93e2b9b1
dev-python/typing-inspection: Remove old Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-python/typing-inspection/Manifest | 1 - .../files/typing-inspection-0.4.0-py314.patch | 155 --------------------- .../typing-inspection-0.4.0-r1.ebuild | 30 ---- .../typing-inspection-0.4.0.ebuild | 25 ---- 4 files changed, 211 deletions(-) diff --git a/dev-python/typing-inspection/Manifest b/dev-python/typing-inspection/Manifest index 01e593440e01..8684ba61cd27 100644 --- a/dev-python/typing-inspection/Manifest +++ b/dev-python/typing-inspection/Manifest @@ -1,2 +1 @@ -DIST typing_inspection-0.4.0.tar.gz 76222 BLAKE2B 08e509950b6d71d5036d91293c6773467f0d7a09ea21a54692341eb980aee6f91b364039070bc49680f4b201fa6bc8d8211d889f9fafdc2341762559354e4e0d SHA512 95e725e7db7609406f8a63dda46ac7559adf13ef5d63e44a43966977163ff69825df465fb741d288e63ee01240dc3fe8b1314b0cd5030f2d5b08d24a739b7b02 DIST typing_inspection-0.4.1.tar.gz 75726 BLAKE2B c0672fc3ec44921ccddd32ec614a1261606ab8c44984d890e9252b587b886189952fa578d936a621bdc78f0ad9086df7bc67280b08fb69745b0d3c4977752d75 SHA512 57be9e86b2e1d787eeda8366e0c4ffe07e87ff6a32f06e401d70d092661c663cfb989b77a1e02fa333a427b6dc32ba00118761c3aa9b30e27d0d71ef03fc1695 diff --git a/dev-python/typing-inspection/files/typing-inspection-0.4.0-py314.patch b/dev-python/typing-inspection/files/typing-inspection-0.4.0-py314.patch deleted file mode 100644 index fd6b76be9162..000000000000 --- a/dev-python/typing-inspection/files/typing-inspection-0.4.0-py314.patch +++ /dev/null @@ -1,155 +0,0 @@ -From aec589d8abf26aa010c971666386b7edeb760852 Mon Sep 17 00:00:00 2001 -From: Viicos <[email protected]> -Date: Sat, 22 Mar 2025 13:33:54 +0100 -Subject: [PATCH] Fix compatibility with latest Python 3.14 release - -Adapt documentation and tests related to the `typing.Union` -changes ---- - docs/usage.md | 8 +-- - src/typing_inspection/introspection.py | 70 ++++++++++++++++++++++ - tests/typing_objects/test_member_checks.py | 8 ++- - 3 files changed, 81 insertions(+), 5 deletions(-) - -diff --git a/docs/usage.md b/docs/usage.md -index c9ece27..7a538c6 100644 ---- a/docs/usage.md -+++ b/docs/usage.md -@@ -4,18 +4,18 @@ The library is divided into two submodules: - - - [`typing_inspection.typing_objects`][]: provides functions to check if a variable is a [`typing`][] object: - ```python -- from typing_extensions import Union, get_origin -+ from typing_extensions import Literal, get_origin - -- from typing_inspection.typing_objects import is_union -+ from typing_inspection.typing_objects import is_literal - -- is_union(get_origin(Union[int, str])) # True -+ is_literal(get_origin(Literal[1, 2])) # True - ``` - - !!! note - You might be tempted to use a simple identity check: - - ```pycon -- >>> get_origin(Union[int, str]) is typing.Union -+ >>> get_origin(Literal[1, 2]) is typing.Literal - ``` - - However, [`typing_extensions`][] might provide a different version of the [`typing`][] objects. Instead, -diff --git a/src/typing_inspection/introspection.py b/src/typing_inspection/introspection.py -index 43cce1e..4f92527 100644 ---- a/src/typing_inspection/introspection.py -+++ b/src/typing_inspection/introspection.py -@@ -23,6 +23,40 @@ - 'is_union_origin', - ) - -+if sys.version_info >= (3, 14): -+ -+ def is_union_origin(obj: Any, /) -> bool: -+ """Return whether the provided origin is the union form. -+ -+ ```pycon -+ >>> is_union_origin(typing.Union) -+ True -+ >>> is_union_origin(get_origin(int | str)) -+ True -+ >>> is_union_origin(types.UnionType) -+ True -+ ``` -+ -+ !!! note -+ Starting in Python 3.14, the [`typing.Union`][] special form [was changed](https://github.com/python/cpython/pull/105511) -+ to be an alias to [`types.UnionType`][]. As such, it is recommended to not use this function -+ anymore (provided that you only support Python 3.14 or greater), and instead perform -+ the check directly: -+ -+ ```python -+ import types -+ from typing import Union, get_origin -+ -+ typ = Union[int, str] -+ origin = get_origin(typ) -+ if origin is types.UnionType: -+ ... -+ ``` -+ """ -+ return obj is types.UnionType -+ return typing_objects.is_union(obj) or obj is types.UnionType -+ -+ - if sys.version_info >= (3, 10): - - def is_union_origin(obj: Any, /) -> bool: -@@ -33,7 +67,25 @@ def is_union_origin(obj: Any, /) -> bool: - True - >>> is_union_origin(get_origin(int | str)) - True -+ >>> is_union_origin(types.UnionType) -+ True - ``` -+ -+ !!! note -+ Starting in Python 3.14, the [`typing.Union`][] special form [was changed](https://github.com/python/cpython/pull/105511) -+ to be an alias to [`types.UnionType`][]. As such, it is recommended to not use this function -+ anymore (provided that you only support Python 3.14 or greater), and instead perform -+ the check directly: -+ -+ ```python -+ import types -+ from typing import Union, get_origin -+ -+ typ = Union[int, str] -+ origin = get_origin(typ) -+ if origin is types.UnionType: -+ ... -+ ``` - """ - return typing_objects.is_union(obj) or obj is types.UnionType - -@@ -47,7 +99,25 @@ def is_union_origin(obj: Any, /) -> bool: - True - >>> is_union_origin(get_origin(int | str)) - True -+ >>> is_union_origin(types.UnionType) -+ True - ``` -+ -+ !!! note -+ Starting in Python 3.14, the [`typing.Union`][] special form [was changed](https://github.com/python/cpython/pull/105511) -+ to be an alias to [`types.UnionType`][]. As such, it is recommended to not use this function -+ anymore (provided that you only support Python 3.14 or greater), and instead perform -+ the check directly: -+ -+ ```python -+ import types -+ from typing import Union, get_origin -+ -+ typ = Union[int, str] -+ origin = get_origin(typ) -+ if origin is types.UnionType: -+ ... -+ ``` - """ - return typing_objects.is_union(obj) - -diff --git a/tests/typing_objects/test_member_checks.py b/tests/typing_objects/test_member_checks.py -index 86d9761..2cc5df0 100644 ---- a/tests/typing_objects/test_member_checks.py -+++ b/tests/typing_objects/test_member_checks.py -@@ -189,6 +189,12 @@ def test_is_deprecated(deprecated: deprecated) -> None: - # Misc. tests: - - [email protected](sys.version_info < (3, 10), reason='`types.UnionType` is only available in Python 3.10.') [email protected]( -+ sys.version_info < (3, 10) or sys.version_info >= (3, 14), -+ reason=( -+ '`types.UnionType` is only available in Python 3.10. ' -+ 'In Python 3.14, `typing.Union` is an alias for `types.UnionType`.' -+ ), -+) - def test_is_union_does_not_match_uniontype() -> None: - assert not typing_objects.is_union(types.UnionType) diff --git a/dev-python/typing-inspection/typing-inspection-0.4.0-r1.ebuild b/dev-python/typing-inspection/typing-inspection-0.4.0-r1.ebuild deleted file mode 100644 index 102acc25ab04..000000000000 --- a/dev-python/typing-inspection/typing-inspection-0.4.0-r1.ebuild +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=hatchling -PYTHON_COMPAT=( pypy3_11 python3_{11..14} ) - -inherit distutils-r1 pypi - -DESCRIPTION="Runtime typing introspection tools" -HOMEPAGE=" - https://github.com/pydantic/typing-inspection/ - https://pypi.org/project/typing-inspection/ -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" - -RDEPEND=" - >=dev-python/typing-extensions-4.12.0[${PYTHON_USEDEP}] -" - -distutils_enable_tests pytest - -PATCHES=( - # https://github.com/pydantic/typing-inspection/pull/37 - "${FILESDIR}/${P}-py314.patch" -) diff --git a/dev-python/typing-inspection/typing-inspection-0.4.0.ebuild b/dev-python/typing-inspection/typing-inspection-0.4.0.ebuild deleted file mode 100644 index 7e6772148926..000000000000 --- a/dev-python/typing-inspection/typing-inspection-0.4.0.ebuild +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=hatchling -PYTHON_COMPAT=( pypy3 pypy3_11 python3_{10..13} ) - -inherit distutils-r1 pypi - -DESCRIPTION="Runtime typing introspection tools" -HOMEPAGE=" - https://github.com/pydantic/typing-inspection/ - https://pypi.org/project/typing-inspection/ -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv ~s390 ~sparc x86" - -RDEPEND=" - >=dev-python/typing-extensions-4.12.0[${PYTHON_USEDEP}] -" - -distutils_enable_tests pytest
