summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-typeguard.spec165
-rw-r--r--sources2
3 files changed, 90 insertions, 78 deletions
diff --git a/.gitignore b/.gitignore
index 5883f5e..c1810cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/typeguard-2.13.3.tar.gz
+/typeguard-3.0.2.tar.gz
diff --git a/python-typeguard.spec b/python-typeguard.spec
index 711e706..250cecd 100644
--- a/python-typeguard.spec
+++ b/python-typeguard.spec
@@ -1,65 +1,70 @@
%global _empty_manifest_terminate_build 0
Name: python-typeguard
-Version: 2.13.3
+Version: 3.0.2
Release: 1
Summary: Run-time type checker for Python
License: MIT
URL: https://pypi.org/project/typeguard/
-Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3a/38/c61bfcf62a7b572b5e9363a802ff92559cb427ee963048e1442e3aef7490/typeguard-2.13.3.tar.gz
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/af/40/3398497c6e6951c92abaf933492d6633e7ac4df0bfc9d81f304b3f977f15/typeguard-3.0.2.tar.gz
BuildArch: noarch
+Requires: python3-importlib-metadata
+Requires: python3-typing-extensions
+Requires: python3-packaging
Requires: python3-sphinx-rtd-theme
Requires: python3-sphinx-autodoc-typehints
Requires: python3-pytest
-Requires: python3-typing-extensions
Requires: python3-mypy
%description
-.. image:: https://travis-ci.com/agronholm/typeguard.svg?branch=master
- :target: https://travis-ci.com/agronholm/typeguard
+.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
+ :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
:alt: Build Status
.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/agronholm/typeguard?branch=master
:alt: Code Coverage
.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
:target: https://typeguard.readthedocs.io/en/latest/?badge=latest
+ :alt: Documentation
This library provides run-time type checking for functions defined with
-`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type annotations.
+`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type
+annotations, and any arbitrary objects. It can be used together with static type
+checkers as an additional layer of type safety, to catch type violations that could only
+be detected at run time.
+
+Two principal ways to do type checking are provided:
+
+#. The ``check_type`` function:
-Four principal ways to do type checking are provided, each with its pros and cons:
+ * like ``isinstance()``, but supports arbitrary type annotations (within limits)
+ * can be used as a ``cast()`` replacement, but with actual checking of the value
+#. Code instrumentation:
-#. the ``check_argument_types()`` and ``check_return_type()`` functions:
+ * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
+ type checking code injected into them
+ * automatically checks function arguments, return values and assignments to annotated
+ local variables
+ * for generator functions (regular and async), checks yield and send values
+ * requires the original source code of the instrumented module(s) to be accessible
- * debugger friendly (except when running with the pydev debugger with the C extension installed)
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
-#. the ``@typechecked`` decorator:
+Two options are provided for code instrumentation:
- * automatically type checks yields and sends of returned generators (regular and async)
- * adds an extra frame to the call stack for every call to a decorated function
-#. the stack profiler hook (``with TypeChecker('packagename'):``) (deprecated):
+#. the ``@typechecked`` function:
- * emits warnings instead of raising ``TypeError``
- * requires very few modifications to the code
- * multiple TypeCheckers can be stacked/nested
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
- * may cause problems with badly behaving debuggers or profilers
- * cannot distinguish between an exception being raised and a ``None`` being returned
+ * can be applied to functions individually
#. the import hook (``typeguard.importhook.install_import_hook()``):
- * automatically annotates classes and functions with ``@typechecked`` on import
- * no code changes required in target modules
- * requires imports of modules you need to check to be deferred until after the import hook has
- been installed
+ * automatically instruments targeted modules on import
+ * no manual code changes required in the target modules
+ * requires the import hook to be installed before the targeted modules are imported
* may clash with other import hooks
-See the documentation_ for further instructions.
+See the documentation_ for further information.
.. _documentation: https://typeguard.readthedocs.io/en/latest/
-
-
%package -n python3-typeguard
Summary: Run-time type checker for Python
Provides: python-typeguard
@@ -67,102 +72,108 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-typeguard
-.. image:: https://travis-ci.com/agronholm/typeguard.svg?branch=master
- :target: https://travis-ci.com/agronholm/typeguard
+.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
+ :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
:alt: Build Status
.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/agronholm/typeguard?branch=master
:alt: Code Coverage
.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
:target: https://typeguard.readthedocs.io/en/latest/?badge=latest
+ :alt: Documentation
This library provides run-time type checking for functions defined with
-`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type annotations.
+`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type
+annotations, and any arbitrary objects. It can be used together with static type
+checkers as an additional layer of type safety, to catch type violations that could only
+be detected at run time.
+
+Two principal ways to do type checking are provided:
-Four principal ways to do type checking are provided, each with its pros and cons:
+#. The ``check_type`` function:
-#. the ``check_argument_types()`` and ``check_return_type()`` functions:
+ * like ``isinstance()``, but supports arbitrary type annotations (within limits)
+ * can be used as a ``cast()`` replacement, but with actual checking of the value
+#. Code instrumentation:
- * debugger friendly (except when running with the pydev debugger with the C extension installed)
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
-#. the ``@typechecked`` decorator:
+ * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
+ type checking code injected into them
+ * automatically checks function arguments, return values and assignments to annotated
+ local variables
+ * for generator functions (regular and async), checks yield and send values
+ * requires the original source code of the instrumented module(s) to be accessible
- * automatically type checks yields and sends of returned generators (regular and async)
- * adds an extra frame to the call stack for every call to a decorated function
-#. the stack profiler hook (``with TypeChecker('packagename'):``) (deprecated):
+Two options are provided for code instrumentation:
- * emits warnings instead of raising ``TypeError``
- * requires very few modifications to the code
- * multiple TypeCheckers can be stacked/nested
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
- * may cause problems with badly behaving debuggers or profilers
- * cannot distinguish between an exception being raised and a ``None`` being returned
+#. the ``@typechecked`` function:
+
+ * can be applied to functions individually
#. the import hook (``typeguard.importhook.install_import_hook()``):
- * automatically annotates classes and functions with ``@typechecked`` on import
- * no code changes required in target modules
- * requires imports of modules you need to check to be deferred until after the import hook has
- been installed
+ * automatically instruments targeted modules on import
+ * no manual code changes required in the target modules
+ * requires the import hook to be installed before the targeted modules are imported
* may clash with other import hooks
-See the documentation_ for further instructions.
+See the documentation_ for further information.
.. _documentation: https://typeguard.readthedocs.io/en/latest/
-
-
%package help
Summary: Development documents and examples for typeguard
Provides: python3-typeguard-doc
%description help
-.. image:: https://travis-ci.com/agronholm/typeguard.svg?branch=master
- :target: https://travis-ci.com/agronholm/typeguard
+.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
+ :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
:alt: Build Status
.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/agronholm/typeguard?branch=master
:alt: Code Coverage
.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
:target: https://typeguard.readthedocs.io/en/latest/?badge=latest
+ :alt: Documentation
This library provides run-time type checking for functions defined with
-`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type annotations.
+`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type
+annotations, and any arbitrary objects. It can be used together with static type
+checkers as an additional layer of type safety, to catch type violations that could only
+be detected at run time.
+
+Two principal ways to do type checking are provided:
-Four principal ways to do type checking are provided, each with its pros and cons:
+#. The ``check_type`` function:
-#. the ``check_argument_types()`` and ``check_return_type()`` functions:
+ * like ``isinstance()``, but supports arbitrary type annotations (within limits)
+ * can be used as a ``cast()`` replacement, but with actual checking of the value
+#. Code instrumentation:
- * debugger friendly (except when running with the pydev debugger with the C extension installed)
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
-#. the ``@typechecked`` decorator:
+ * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
+ type checking code injected into them
+ * automatically checks function arguments, return values and assignments to annotated
+ local variables
+ * for generator functions (regular and async), checks yield and send values
+ * requires the original source code of the instrumented module(s) to be accessible
- * automatically type checks yields and sends of returned generators (regular and async)
- * adds an extra frame to the call stack for every call to a decorated function
-#. the stack profiler hook (``with TypeChecker('packagename'):``) (deprecated):
+Two options are provided for code instrumentation:
- * emits warnings instead of raising ``TypeError``
- * requires very few modifications to the code
- * multiple TypeCheckers can be stacked/nested
- * does not work reliably with dynamically defined type hints (e.g. in nested functions)
- * may cause problems with badly behaving debuggers or profilers
- * cannot distinguish between an exception being raised and a ``None`` being returned
+#. the ``@typechecked`` function:
+
+ * can be applied to functions individually
#. the import hook (``typeguard.importhook.install_import_hook()``):
- * automatically annotates classes and functions with ``@typechecked`` on import
- * no code changes required in target modules
- * requires imports of modules you need to check to be deferred until after the import hook has
- been installed
+ * automatically instruments targeted modules on import
+ * no manual code changes required in the target modules
+ * requires the import hook to be installed before the targeted modules are imported
* may clash with other import hooks
-See the documentation_ for further instructions.
+See the documentation_ for further information.
.. _documentation: https://typeguard.readthedocs.io/en/latest/
-
-
%prep
-%autosetup -n typeguard-2.13.3
+%autosetup -n typeguard-3.0.2
%build
%py3_build
@@ -202,5 +213,5 @@ mv %{buildroot}/doclist.lst .
%{_docdir}/*
%changelog
-* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 2.13.3-1
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 3.0.2-1
- Package Spec generated
diff --git a/sources b/sources
index 9b98eb9..c2eb476 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-22d49971f62f3baa3525349b1e03723d typeguard-2.13.3.tar.gz
+390f71e833054b7acaab06a4ae55bb8a typeguard-3.0.2.tar.gz