From 7895a40d27f6ee79ce948b7893638d8628710fd5f0fe9f6561abf6f2b3089780 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 20 Nov 2024 17:29:24 +0000 Subject: [PATCH] - update to 4.4.1: * Dropped Python 3.8 support * Changed the signature of typeguard_ignore() to be compatible with typing.no_type_check() (PR by @jolaf) * Avoid creating reference cycles when type checking uniontypes and classes * Fixed checking of variable assignments involving tuple unpacking * Fixed TypeError when checking a class against type[Self] * Fixed checking of protocols on the class level (against type[SomeProtocol]) * Fixed Self checks in instance/class methods that have positional-only arguments * Fixed explicit checks of PEP 604 unions against types.UnionType * Fixed checks against annotations wrapped in NotRequired not being run unless the NotRequired is a forward reference * Fixed the pytest_ignore_collect hook in the pytest plugin blocking default pytest collection ignoring behavior by returning None instead of False (PR by @mgorny) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-typeguard?expand=0&rev=16 --- .gitattributes | 23 +++ .gitignore | 1 + python-typeguard.changes | 284 ++++++++++++++++++++++++++++++++++++++ python-typeguard.spec | 61 ++++++++ typeguard-4.3.0-gh.tar.gz | 3 + typeguard-4.4.0-gh.tar.gz | 3 + typeguard-4.4.1-gh.tar.gz | 3 + 7 files changed, 378 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-typeguard.changes create mode 100644 python-typeguard.spec create mode 100644 typeguard-4.3.0-gh.tar.gz create mode 100644 typeguard-4.4.0-gh.tar.gz create mode 100644 typeguard-4.4.1-gh.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-typeguard.changes b/python-typeguard.changes new file mode 100644 index 0000000..cf389a3 --- /dev/null +++ b/python-typeguard.changes @@ -0,0 +1,284 @@ +------------------------------------------------------------------- +Wed Nov 20 17:29:21 UTC 2024 - Dirk Müller + +- update to 4.4.1: + * Dropped Python 3.8 support + * Changed the signature of typeguard_ignore() to be compatible + with typing.no_type_check() (PR by @jolaf) + * Avoid creating reference cycles when type checking uniontypes + and classes + * Fixed checking of variable assignments involving tuple + unpacking + * Fixed TypeError when checking a class against type[Self] + * Fixed checking of protocols on the class level (against + type[SomeProtocol]) + * Fixed Self checks in instance/class methods that have + positional-only arguments + * Fixed explicit checks of PEP 604 unions against + types.UnionType + * Fixed checks against annotations wrapped in NotRequired not + being run unless the NotRequired is a forward reference + * Fixed the pytest_ignore_collect hook in the pytest plugin + blocking default pytest collection ignoring behavior by + returning None instead of False (PR by @mgorny) + +------------------------------------------------------------------- +Wed Oct 30 19:48:05 UTC 2024 - Dirk Müller + +- update to 4.4.0: + * Added proper checking for method signatures in protocol + checks + * Fixed basic support for intersection protocols + * Fixed protocol checks running against the class of an + instance and not the instance itself (this produced wrong + results for non-method member checks) + +------------------------------------------------------------------- +Sat Jun 8 13:05:55 UTC 2024 - Dirk Müller + +- update to 4.3.0: + * Added support for checking against static protocols + * Fixed some compatibility problems when running on Python 3.13 + * Fixed test suite incompatibility with pytest 8.2 + * Fixed pytest plugin crashing on pytest version older than + v7.0.0 (even if it's just present) + * Fixed missing typing_extensions dependency for Python 3.12 + * Fixed deprecation warning in the test suite on Python 3.13 + * Added support for specifying options for the pytest plugin + via pytest config files + * Avoid creating reference cycles when type checking unions (PR + by Shantanu) + * Fixed Optional[...] being removed from the AST if it was + located within a subscript + * Fixed TypedDict from typing_extensions not being recognized + as one + * Fixed typing types (dict[str, int], List[str], etc.) not + passing checks against type or Type + * Fixed detection of optional fields (NotRequired[...]) in + TypedDict when using forward references + * Fixed mapping checks against Django's MultiValueDict + +------------------------------------------------------------------- +Mon Dec 4 11:32:09 UTC 2023 - Dirk Müller + +- update to 4.1.5: + * Fixed ``Callable`` erroneously rejecting a callable that has + the requested amount of positional arguments but they have + defaults + * Fixed a regression introduced in v4.1.4 where the elements of + ``Literal`` got quotes removed from them by the AST transformer + * Fixed ``AttributeError`` where the transformer removed + elements from a PEP 604 union + * Fixed ``AttributeError: 'Subscript' object has no attribute + 'slice'`` when encountering an annotation with a subscript + containing an ignored type + * Fixed type checking not being skipped when the target is a + union (PEP 604 or ``typing.Union``) where one of the elements + is an ignored type (shadowed by an argument, variable + assignment or an ``if TYPE_CHECKING`` import) + * Dropped Python 3.7 support + * Fixed ``@typechecked`` optimization causing compilation of + instrumented code to fail when any block was left empty by the + AST transformer (eg ``if`` or ``try`` / ``except`` blocks) + * Fixed placement of injected typeguard imports with respect to + ``__future__`` imports and module docstrings + * Fixed ``Any`` being removed from a subscript that still + contains other elements + * Fixed ``suppress_type_checks()`` causing annotated variable + assignments to always assign ``None`` + * Added support for passing a tuple as ``expected_type`` to + ``check_type()``, making it more of a drop-in replacement for + ``isinstance()`` + * Fixed regression where ``Literal`` inside a ``Union`` had + quotes stripped from its contents, thus typically causing + ``NameError`` to be raised when run + * Fixed handling of ``typing_extensions.Literal`` on Python 3.8 + and 3.9 when ``typing_extensions>=4.6.0`` is installed + * Fixed ``NameError`` when generated type checking code + references an imported name from a method + * Fixed docstrings disappearing from instrumented functions + * Fixed ``@typechecked`` failing to instrument functions when + there are more than one function within the same scope + * Fixed ``frozenset`` not being checked + +------------------------------------------------------------------- +Sun May 14 16:35:53 UTC 2023 - Dirk Müller + +- update to 4.0.0: + * Fixed ``@typechecked`` optimization causing compilation of + instrumented code to fail when an ``if`` block was left + empty by the AST transformer + * Fixed the AST transformer trying to parse the second argument + of ``typing.Annotated`` as a forward reference + * Added ``InstrumentationWarning`` to the public API + * Changed ``@typechecked`` to skip instrumentation in optimized + mode, as in typeguard 2.x + * Avoid type checks where the types in question are shadowed by + local variables + * Fixed instrumentation using ``typing.Optional`` without a + subscript when the subscript value was erased due to + being an ignored import + * Fixed ``TypeError: isinstance() arg 2 must be a type or tuple + of types`` when instrumented code tries to check a value + against a naked (``str``, not ``ForwardRef``) + * forward reference + * Fixed instrumentation using the wrong "self" type in the + ``__new__()`` method + * Fixed imports guarded by ``if TYPE_CHECKING:`` when used with + subscripts + * (``SomeType[...]``) being replaced with ``Any[...]`` instead + of just ``Any`` + * Fixed instrumentation inadvertently mutating a function's + annotations on Python 3.7 and 3.8 + * Fixed ``Concatenate[...]`` in ``Callable`` parameters causing + ``TypeError`` to be raised + * Fixed type checks for ``*args`` or ``**kwargs`` not being + suppressed when their types are unusable + (guarded by ``if TYPE_CHECKING:`` or otherwise) + * Fixed ``TypeError`` when checking against a generic + ``NewType`` + * Don't try to check types shadowed by argument names (e.g. + * ``def foo(x: type, type: str): ...``) + * Don't check against unions where one of the elements is + * Fixed ``typing.Literal`` subscript contents being evaluated + as forward references + * Fixed resolution of forward references in type aliases + * The ``.pyc`` files now use a version-based optimization + suffix in the file names so as not to cause the + interpreter to load potentially faulty/incompatible cached + bytecode generated by older versions + * Fixed typed variable positional and keyword arguments causing + compilation errors on Python 3.7 and 3.8 + * Fixed compilation error when a type annotation contains a + type guarded by ``if TYPE_CHECKING:`` + * **BACKWARD INCOMPATIBLE** ``check_type()`` no longer uses the + global configuration. + * It now uses the default configuration values, unless + overridden with an explicit ``config`` argument. + * **BACKWARD INCOMPATIBLE** Removed ``CallMemo`` from the API + * **BACKWARD INCOMPATIBLE** Required checkers to use the + configuration from ``memo.config``, rather than the global + configuration + * Added keyword arguments to ``@typechecked``, allowing users + to override settings on a per-function basis + * Added support for using ``suppress_type_checks()`` as a + decorator + * Added support for type checking against nonlocal classes + defined within the same + * parent function as the instrumented function + * Changed instrumentation to statically copy the function + annotations to avoid having to + * look up the function object at run time + * Improved support for avoiding type checks against imports + declared in ``if TYPE_CHECKING:`` blocks + * Fixed ``check_type`` not returning the passed value when + checking against ``Any``, or when type checking is being + suppressed + * Fixed ``suppress_type_checks()`` not ending the suppression + if the context block raises an exception + * Fixed checking non-dictionary objects against a ``TypedDict`` + annotation + +------------------------------------------------------------------- +Fri May 5 09:24:37 UTC 2023 - Dirk Müller + +- update to 3.0.2: + * Improved warnings by ensuring that they target user code and + not Typeguard internal code + * Fixed ``warn_on_error()`` not showing where the type + violation actually occurred + * Fixed local assignment to ``*args`` or ``**kwargs`` being + type checked incorrectly + * Fixed ``TypeError`` on ``check_type(..., None)`` + * Fixed unpacking assignment not working with a starred + variable (``x, *y = ...``) in + * the target tuple + * Fixed variable multi-assignment (``a = b = c = ...``) being + type checked incorrectly + * Improved the documentation + * Fixed assignment unpacking (``a, b = ...``) being checked + incorrectly + * Fixed ``@typechecked`` attempting to instrument wrapper + decorators such as + * ``@contextmanager`` when applied to a class + * Fixed ``py.typed`` missing from the wheel when not building + from a git checkout + * Dropped the ``argname``, ``memo``, ``globals`` and + ``locals`` arguments from ``check_type()`` + * Removed the ``check_argument_types()`` and ``check_return_type()`` + functions (use ``@typechecked`` instead) + * Moved ``install_import_hook`` to be directly importable from + the ``typeguard`` module + * Changed the checking of collections + (list, set, dict, sequence, mapping) to only check the + first item by default. To get the old behavior, + set ``typeguard.config.collection_check_strategy`` to + ``CollectionCheckStrategy.ALL_ITEMS`` + * Type checking failures now raise + typeguard.TypeCheckError instead of TypeError + * Dropped Python 3.5 and 3.6 support + * Dropped the deprecated profiler hook (``TypeChecker``) + * Added a configuration system + * Added support for custom type checking functions + * Added support for PEP 604 union types (``X | Y``) on all + Python versions + * Added support for generic built-in collection types + (``list[int]`` et al) on all + * Python versions + * Added support for checking arbitrary Mapping types + * Added support for the Self type + * Added support for ``typing.Never`` (and + ``typing_extensions.Never``) + * Added support for ``Never`` and ``NoReturn`` in argument + annotations + * Added support for ``LiteralString`` + * Added support for ``TypeGuard`` + * Added support for the subclassable ``Any`` on Python 3.11 and + ``typing_extensions`` + * Added the possibility to have the import hook instrument all + packages + * Added the ``suppress_type_checks()`` context manager function + for temporarily disabling type checks + * Changed ``check_type()`` to return the passed value, so it + can be used (to an extent) in place of ``typing.cast()``, + but with run-time type checking + * Replaced custom implementation of ``is_typeddict()`` with the + implementation from ``typing_extensions`` v4.1.0 + * Emit ``InstrumentationWarning`` instead of raising + ``RuntimeError`` from the pytest plugin if modules in the + target package have already been imported + * Fixed ``TypeError`` when checking against ``TypedDict`` when + the value has mixed types among the extra keys (PR by biolds) + * Fixed incompatibility with ``typing_extensions`` v4.1+ on + Python 3.10 (PR by David C.) + * Fixed checking of ``Tuple[()]`` on Python 3.11 and + ``tuple[()]`` on Python 3.9+ + * Fixed integers 0 and 1 passing for ``Literal[False]`` and + ``Literal[True]``, respectively + * Fixed type checking of annotated variable positional and + keyword arguments (``*args`` and ``**kwargs``) + * Fixed checks against ``unittest.Mock`` and derivatives being + done in the wrong place + +------------------------------------------------------------------- +Fri Apr 21 12:38:04 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:45:38 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Tue Oct 11 16:36:44 UTC 2022 - Yogalakshmi Arunachalam + +- Update to version 2.13.3 + * Fixed TypeError when using typeguard within exec() (where __module__ is None) (PR by Andy Jones) + * Fixed TypedDict causing TypeError: TypedDict does not support instance and class checks on Python 3.8 with standard library (not typing_extensions) typed dicts + +------------------------------------------------------------------- +Tue Jun 29 06:29:13 UTC 2020 - Steve Kowalik + +- Initial version + diff --git a/python-typeguard.spec b/python-typeguard.spec new file mode 100644 index 0000000..7ede498 --- /dev/null +++ b/python-typeguard.spec @@ -0,0 +1,61 @@ +# +# spec file for package python-typeguard +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-typeguard +Version: 4.4.1 +Release: 0 +Summary: Library for runtime checking of Python types +License: MIT +URL: https://github.com/agronholm/typeguard +Source0: https://github.com/agronholm/typeguard/archive/refs/tags/%{version}.tar.gz#/typeguard-%{version}-gh.tar.gz +BuildRequires: %{python_module mypy} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module typing-extensions >= 4.10.0} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +Requires: python-importlib-metadata >= 3.6 +Requires: python-typing-extensions >= 4.10.0 +%python_subpackages + +%description +This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. + +%prep +%setup -q -n typeguard-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%license LICENSE +%{python_sitelib}/typeguard +%{python_sitelib}/typeguard-*.dist-info/ + +%changelog diff --git a/typeguard-4.3.0-gh.tar.gz b/typeguard-4.3.0-gh.tar.gz new file mode 100644 index 0000000..9094cda --- /dev/null +++ b/typeguard-4.3.0-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:738026158f85d6c1e7b6d9ce6daafacb3d680fe65bc61c6bb2a9f8c4588a1932 +size 69514 diff --git a/typeguard-4.4.0-gh.tar.gz b/typeguard-4.4.0-gh.tar.gz new file mode 100644 index 0000000..924ce71 --- /dev/null +++ b/typeguard-4.4.0-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5c6131b45df990cb9e20fc38279c92e73181a844f250c0e2a24714a08225457 +size 70646 diff --git a/typeguard-4.4.1-gh.tar.gz b/typeguard-4.4.1-gh.tar.gz new file mode 100644 index 0000000..1a5e2c0 --- /dev/null +++ b/typeguard-4.4.1-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:562e7bbf300649b416a6dd8654cc2f6d7be6aa6c9a67354dfcfd137a6f5901b3 +size 71269