Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-retrying for openSUSE:Factory checked in at 2022-12-07 17:34:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-retrying (Old) and /work/SRC/openSUSE:Factory/.python-retrying.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-retrying" Wed Dec 7 17:34:52 2022 rev:6 rq:1040738 version:1.3.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-retrying/python-retrying.changes 2019-01-08 12:30:26.188144065 +0100 +++ /work/SRC/openSUSE:Factory/.python-retrying.new.1835/python-retrying.changes 2022-12-07 17:36:12.200945963 +0100 @@ -1,0 +2,8 @@ +Tue Dec 6 15:30:28 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 1.3.4 + * Added Greg Roodt as maintainer + * Formatted code with black + * Updated repository references + +------------------------------------------------------------------- Old: ---- retrying-1.3.3.tar.gz New: ---- retrying-1.3.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-retrying.spec ++++++ --- /var/tmp/diff_new_pack.i2emxt/_old 2022-12-07 17:36:12.604948176 +0100 +++ /var/tmp/diff_new_pack.i2emxt/_new 2022-12-07 17:36:12.608948197 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-retrying # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-retrying -Version: 1.3.3 +Version: 1.3.4 Release: 0 Summary: Retrying library for Python License: Apache-2.0 ++++++ retrying-1.3.3.tar.gz -> retrying-1.3.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/AUTHORS.rst new/retrying-1.3.4/AUTHORS.rst --- old/retrying-1.3.3/AUTHORS.rst 2014-12-15 01:50:05.000000000 +0100 +++ new/retrying-1.3.4/AUTHORS.rst 2022-11-25 10:54:32.000000000 +0100 @@ -1,13 +1,19 @@ -Retrying is written and maintained by Ray Holder and +Retrying is maintained by Greg Roodt and various contributors: -Development Lead +Lead Maintainer +```````````````` + +- Greg Roodt + + +Original Author ```````````````` - Ray Holder -Patches and Suggestions +Contributors ``````````````````````` - Anthony McClosky @@ -30,4 +36,5 @@ - Monty Taylor - Maxym Shalenyi - Jonathan Herriott -- Job Evers \ No newline at end of file +- Job Evers +- Cyrus Durgin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/HISTORY.rst new/retrying-1.3.4/HISTORY.rst --- old/retrying-1.3.3/HISTORY.rst 2014-12-15 02:06:19.000000000 +0100 +++ new/retrying-1.3.4/HISTORY.rst 2022-11-25 10:54:32.000000000 +0100 @@ -2,6 +2,12 @@ History ------- +1.3.4 (2022-09-03) +++++++++++++++++++ +- Added Greg Roodt as maintainer +- Formatted code with black +- Updated repository references + 1.3.3 (2014-12-14) ++++++++++++++++++ - Add minimum six version of 1.7.0 since anything less will break things diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/PKG-INFO new/retrying-1.3.4/PKG-INFO --- old/retrying-1.3.3/PKG-INFO 2014-12-15 02:17:02.000000000 +0100 +++ new/retrying-1.3.4/PKG-INFO 2022-11-25 10:56:44.095301600 +0100 @@ -1,234 +1,216 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: retrying -Version: 1.3.3 +Version: 1.3.4 Summary: Retrying -Home-page: https://github.com/rholder/retrying -Author: Ray Holder -Author-email: UNKNOWN +Home-page: https://github.com/groodt/retrying +Author: Greg Roodt License: Apache 2.0 -Description: Retrying - ========================= - .. image:: https://travis-ci.org/rholder/retrying.png?branch=master - :target: https://travis-ci.org/rholder/retrying - - .. image:: https://badge.fury.io/py/retrying.png - :target: https://pypi.python.org/pypi/retrying - - .. image:: https://pypip.in/d/retrying/badge.png - :target: https://pypi.python.org/pypi/retrying - - Retrying is an Apache 2.0 licensed general-purpose retrying library, written in - Python, to simplify the task of adding retry behavior to just about anything. - - - The simplest use case is retrying a flaky function whenever an Exception occurs - until a value is returned. - - .. code-block:: python - - import random - from retrying import retry - - @retry - def do_something_unreliable(): - if random.randint(0, 10) > 1: - raise IOError("Broken sauce, everything is hosed!!!111one") - else: - return "Awesome sauce!" - - print do_something_unreliable() - - - Features - -------- - - - Generic Decorator API - - Specify stop condition (i.e. limit by number of attempts) - - Specify wait condition (i.e. exponential backoff sleeping between attempts) - - Customize retrying on Exceptions - - Customize retrying on expected returned result - - - Installation - ------------ - - To install retrying, simply: - - .. code-block:: bash - - $ pip install retrying - - Or, if you absolutely must: - - .. code-block:: bash - - $ easy_install retrying - - But, you might regret that later. - - - Examples - ---------- - - As you saw above, the default behavior is to retry forever without waiting. - - .. code-block:: python - - @retry - def never_give_up_never_surrender(): - print "Retry forever ignoring Exceptions, don't wait between retries" - - - Let's be a little less persistent and set some boundaries, such as the number of attempts before giving up. - - .. code-block:: python - - @retry(stop_max_attempt_number=7) - def stop_after_7_attempts(): - print "Stopping after 7 attempts" - - We don't have all day, so let's set a boundary for how long we should be retrying stuff. - - .. code-block:: python - - @retry(stop_max_delay=10000) - def stop_after_10_s(): - print "Stopping after 10 seconds" - - Most things don't like to be polled as fast as possible, so let's just wait 2 seconds between retries. - - .. code-block:: python - - @retry(wait_fixed=2000) - def wait_2_s(): - print "Wait 2 second between retries" - - - Some things perform best with a bit of randomness injected. - - .. code-block:: python - - @retry(wait_random_min=1000, wait_random_max=2000) - def wait_random_1_to_2_s(): - print "Randomly wait 1 to 2 seconds between retries" - - Then again, it's hard to beat exponential backoff when retrying distributed services and other remote endpoints. - - .. code-block:: python - - @retry(wait_exponential_multiplier=1000, wait_exponential_max=10000) - def wait_exponential_1000(): - print "Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" - - - We have a few options for dealing with retries that raise specific or general exceptions, as in the cases here. - - .. code-block:: python - - def retry_if_io_error(exception): - """Return True if we should retry (in this case when it's an IOError), False otherwise""" - return isinstance(exception, IOError) - - @retry(retry_on_exception=retry_if_io_error) - def might_io_error(): - print "Retry forever with no wait if an IOError occurs, raise any other errors" - - @retry(retry_on_exception=retry_if_io_error, wrap_exception=True) - def only_raise_retry_error_when_not_io_error(): - print "Retry forever with no wait if an IOError occurs, raise any other errors wrapped in RetryError" - - We can also use the result of the function to alter the behavior of retrying. - - .. code-block:: python - - def retry_if_result_none(result): - """Return True if we should retry (in this case when result is None), False otherwise""" - return result is None - - @retry(retry_on_result=retry_if_result_none) - def might_return_none(): - print "Retry forever ignoring Exceptions with no wait if return value is None" - - - Any combination of stop, wait, etc. is also supported to give you the freedom to mix and match. - - Contribute - ---------- - - #. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. - #. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it). - #. Write a test which shows that the bug was fixed or that the feature works as expected. - #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. - - .. _`the repository`: http://github.com/rholder/retrying - .. _AUTHORS: https://github.com/rholder/retrying/blob/master/AUTHORS.rst - - - .. :changelog: - - History - ------- - 1.3.3 (2014-12-14) - ++++++++++++++++++ - - Add minimum six version of 1.7.0 since anything less will break things - - 1.3.2 (2014-11-09) - ++++++++++++++++++ - - Ensure we wrap the decorated functions to prevent information loss - - Allow a jitter value to be passed in - - 1.3.1 (2014-09-30) - ++++++++++++++++++ - - Add requirements.txt to MANIFEST.in to fix pip installs - - 1.3.0 (2014-09-30) - ++++++++++++++++++ - - Add upstream six dependency, remove embedded six functionality - - 1.2.3 (2014-08-25) - ++++++++++++++++++ - - Add support for custom wait and stop functions - - 1.2.2 (2014-06-20) - ++++++++++++++++++ - - Bug fix to not raise a RetryError on failure when exceptions aren't being wrapped - - 1.2.1 (2014-05-05) - ++++++++++++++++++ - - Bug fix for explicitly passing in a wait type - - 1.2.0 (2014-05-04) - ++++++++++++++++++ - - Remove the need for explicit specification of stop/wait types when they can be inferred - - Add a little checking for exception propagation - - 1.1.0 (2014-03-31) - ++++++++++++++++++ - - Added proper exception propagation through reraising with Python 2.6, 2.7, and 3.2 compatibility - - Update test suite for behavior changes - - 1.0.1 (2013-03-20) - ++++++++++++++++++ - - Fixed a bug where classes not extending from the Python exception hierarchy could slip through - - Update test suite for custom Python exceptions - - 1.0.0 (2013-01-21) - ++++++++++++++++++ - - First stable, tested version now exists - - Apache 2.0 license applied - - Sanitizing some setup.py and test suite running - - Added Travis CI support - Keywords: decorator decorators retry retrying exception exponential backoff -Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Natural Language :: English Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Internet Classifier: Topic :: Utilities +License-File: LICENSE +License-File: NOTICE +License-File: AUTHORS.rst + +Retrying +========================= +Retrying is an Apache 2.0 licensed general-purpose retrying library, written in +Python, to simplify the task of adding retry behavior to just about anything. + + +The simplest use case is retrying a flaky function whenever an Exception occurs +until a value is returned. + +.. code-block:: python + + import random + from retrying import retry + + @retry + def do_something_unreliable(): + if random.randint(0, 10) > 1: + raise IOError("Broken sauce, everything is hosed!!!111one") + else: + return "Awesome sauce!" + + print do_something_unreliable() + + +Features +-------- + +- Generic Decorator API +- Specify stop condition (i.e. limit by number of attempts) +- Specify wait condition (i.e. exponential backoff sleeping between attempts) +- Customize retrying on Exceptions +- Customize retrying on expected returned result + + +Examples +---------- + +As you saw above, the default behavior is to retry forever without waiting. + +.. code-block:: python + + @retry + def never_give_up_never_surrender(): + print "Retry forever ignoring Exceptions, don't wait between retries" + + +Let's be a little less persistent and set some boundaries, such as the number of attempts before giving up. + +.. code-block:: python + + @retry(stop_max_attempt_number=7) + def stop_after_7_attempts(): + print "Stopping after 7 attempts" + +We don't have all day, so let's set a boundary for how long we should be retrying stuff. + +.. code-block:: python + + @retry(stop_max_delay=10000) + def stop_after_10_s(): + print "Stopping after 10 seconds" + +Most things don't like to be polled as fast as possible, so let's just wait 2 seconds between retries. + +.. code-block:: python + + @retry(wait_fixed=2000) + def wait_2_s(): + print "Wait 2 second between retries" + + +Some things perform best with a bit of randomness injected. + +.. code-block:: python + + @retry(wait_random_min=1000, wait_random_max=2000) + def wait_random_1_to_2_s(): + print "Randomly wait 1 to 2 seconds between retries" + +Then again, it's hard to beat exponential backoff when retrying distributed services and other remote endpoints. + +.. code-block:: python + + @retry(wait_exponential_multiplier=1000, wait_exponential_max=10000) + def wait_exponential_1000(): + print "Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" + + +We have a few options for dealing with retries that raise specific or general exceptions, as in the cases here. + +.. code-block:: python + + def retry_if_io_error(exception): + """Return True if we should retry (in this case when it's an IOError), False otherwise""" + return isinstance(exception, IOError) + + @retry(retry_on_exception=retry_if_io_error) + def might_io_error(): + print "Retry forever with no wait if an IOError occurs, raise any other errors" + + @retry(retry_on_exception=retry_if_io_error, wrap_exception=True) + def only_raise_retry_error_when_not_io_error(): + print "Retry forever with no wait if an IOError occurs, raise any other errors wrapped in RetryError" + +We can also use the result of the function to alter the behavior of retrying. + +.. code-block:: python + + def retry_if_result_none(result): + """Return True if we should retry (in this case when result is None), False otherwise""" + return result is None + + @retry(retry_on_result=retry_if_result_none) + def might_return_none(): + print "Retry forever ignoring Exceptions with no wait if return value is None" + + +Any combination of stop, wait, etc. is also supported to give you the freedom to mix and match. + +Contribute +---------- + +#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. +#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it). +#. Write a test which shows that the bug was fixed or that the feature works as expected. +#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. + +.. _`the repository`: http://github.com/groodt/retrying +.. _AUTHORS: https://github.com/groodt/retrying/blob/master/AUTHORS.rst + + +.. :changelog: + +History +------- +1.3.4 (2022-09-03) +++++++++++++++++++ +- Added Greg Roodt as maintainer +- Formatted code with black +- Updated repository references + +1.3.3 (2014-12-14) +++++++++++++++++++ +- Add minimum six version of 1.7.0 since anything less will break things + +1.3.2 (2014-11-09) +++++++++++++++++++ +- Ensure we wrap the decorated functions to prevent information loss +- Allow a jitter value to be passed in + +1.3.1 (2014-09-30) +++++++++++++++++++ +- Add requirements.txt to MANIFEST.in to fix pip installs + +1.3.0 (2014-09-30) +++++++++++++++++++ +- Add upstream six dependency, remove embedded six functionality + +1.2.3 (2014-08-25) +++++++++++++++++++ +- Add support for custom wait and stop functions + +1.2.2 (2014-06-20) +++++++++++++++++++ +- Bug fix to not raise a RetryError on failure when exceptions aren't being wrapped + +1.2.1 (2014-05-05) +++++++++++++++++++ +- Bug fix for explicitly passing in a wait type + +1.2.0 (2014-05-04) +++++++++++++++++++ +- Remove the need for explicit specification of stop/wait types when they can be inferred +- Add a little checking for exception propagation + +1.1.0 (2014-03-31) +++++++++++++++++++ +- Added proper exception propagation through reraising with Python 2.6, 2.7, and 3.2 compatibility +- Update test suite for behavior changes + +1.0.1 (2013-03-20) +++++++++++++++++++ +- Fixed a bug where classes not extending from the Python exception hierarchy could slip through +- Update test suite for custom Python exceptions + +1.0.0 (2013-01-21) +++++++++++++++++++ +- First stable, tested version now exists +- Apache 2.0 license applied +- Sanitizing some setup.py and test suite running +- Added Travis CI support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/README.rst new/retrying-1.3.4/README.rst --- old/retrying-1.3.3/README.rst 2014-08-26 02:36:52.000000000 +0200 +++ new/retrying-1.3.4/README.rst 2022-11-25 10:54:32.000000000 +0100 @@ -1,14 +1,5 @@ Retrying ========================= -.. image:: https://travis-ci.org/rholder/retrying.png?branch=master - :target: https://travis-ci.org/rholder/retrying - -.. image:: https://badge.fury.io/py/retrying.png - :target: https://pypi.python.org/pypi/retrying - -.. image:: https://pypip.in/d/retrying/badge.png - :target: https://pypi.python.org/pypi/retrying - Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything. @@ -41,24 +32,6 @@ - Customize retrying on expected returned result -Installation ------------- - -To install retrying, simply: - -.. code-block:: bash - - $ pip install retrying - -Or, if you absolutely must: - -.. code-block:: bash - - $ easy_install retrying - -But, you might regret that later. - - Examples ---------- @@ -152,5 +125,5 @@ #. Write a test which shows that the bug was fixed or that the feature works as expected. #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. -.. _`the repository`: http://github.com/rholder/retrying -.. _AUTHORS: https://github.com/rholder/retrying/blob/master/AUTHORS.rst +.. _`the repository`: http://github.com/groodt/retrying +.. _AUTHORS: https://github.com/groodt/retrying/blob/master/AUTHORS.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/retrying.egg-info/PKG-INFO new/retrying-1.3.4/retrying.egg-info/PKG-INFO --- old/retrying-1.3.3/retrying.egg-info/PKG-INFO 2014-12-15 02:17:02.000000000 +0100 +++ new/retrying-1.3.4/retrying.egg-info/PKG-INFO 2022-11-25 10:56:44.000000000 +0100 @@ -1,234 +1,216 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: retrying -Version: 1.3.3 +Version: 1.3.4 Summary: Retrying -Home-page: https://github.com/rholder/retrying -Author: Ray Holder -Author-email: UNKNOWN +Home-page: https://github.com/groodt/retrying +Author: Greg Roodt License: Apache 2.0 -Description: Retrying - ========================= - .. image:: https://travis-ci.org/rholder/retrying.png?branch=master - :target: https://travis-ci.org/rholder/retrying - - .. image:: https://badge.fury.io/py/retrying.png - :target: https://pypi.python.org/pypi/retrying - - .. image:: https://pypip.in/d/retrying/badge.png - :target: https://pypi.python.org/pypi/retrying - - Retrying is an Apache 2.0 licensed general-purpose retrying library, written in - Python, to simplify the task of adding retry behavior to just about anything. - - - The simplest use case is retrying a flaky function whenever an Exception occurs - until a value is returned. - - .. code-block:: python - - import random - from retrying import retry - - @retry - def do_something_unreliable(): - if random.randint(0, 10) > 1: - raise IOError("Broken sauce, everything is hosed!!!111one") - else: - return "Awesome sauce!" - - print do_something_unreliable() - - - Features - -------- - - - Generic Decorator API - - Specify stop condition (i.e. limit by number of attempts) - - Specify wait condition (i.e. exponential backoff sleeping between attempts) - - Customize retrying on Exceptions - - Customize retrying on expected returned result - - - Installation - ------------ - - To install retrying, simply: - - .. code-block:: bash - - $ pip install retrying - - Or, if you absolutely must: - - .. code-block:: bash - - $ easy_install retrying - - But, you might regret that later. - - - Examples - ---------- - - As you saw above, the default behavior is to retry forever without waiting. - - .. code-block:: python - - @retry - def never_give_up_never_surrender(): - print "Retry forever ignoring Exceptions, don't wait between retries" - - - Let's be a little less persistent and set some boundaries, such as the number of attempts before giving up. - - .. code-block:: python - - @retry(stop_max_attempt_number=7) - def stop_after_7_attempts(): - print "Stopping after 7 attempts" - - We don't have all day, so let's set a boundary for how long we should be retrying stuff. - - .. code-block:: python - - @retry(stop_max_delay=10000) - def stop_after_10_s(): - print "Stopping after 10 seconds" - - Most things don't like to be polled as fast as possible, so let's just wait 2 seconds between retries. - - .. code-block:: python - - @retry(wait_fixed=2000) - def wait_2_s(): - print "Wait 2 second between retries" - - - Some things perform best with a bit of randomness injected. - - .. code-block:: python - - @retry(wait_random_min=1000, wait_random_max=2000) - def wait_random_1_to_2_s(): - print "Randomly wait 1 to 2 seconds between retries" - - Then again, it's hard to beat exponential backoff when retrying distributed services and other remote endpoints. - - .. code-block:: python - - @retry(wait_exponential_multiplier=1000, wait_exponential_max=10000) - def wait_exponential_1000(): - print "Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" - - - We have a few options for dealing with retries that raise specific or general exceptions, as in the cases here. - - .. code-block:: python - - def retry_if_io_error(exception): - """Return True if we should retry (in this case when it's an IOError), False otherwise""" - return isinstance(exception, IOError) - - @retry(retry_on_exception=retry_if_io_error) - def might_io_error(): - print "Retry forever with no wait if an IOError occurs, raise any other errors" - - @retry(retry_on_exception=retry_if_io_error, wrap_exception=True) - def only_raise_retry_error_when_not_io_error(): - print "Retry forever with no wait if an IOError occurs, raise any other errors wrapped in RetryError" - - We can also use the result of the function to alter the behavior of retrying. - - .. code-block:: python - - def retry_if_result_none(result): - """Return True if we should retry (in this case when result is None), False otherwise""" - return result is None - - @retry(retry_on_result=retry_if_result_none) - def might_return_none(): - print "Retry forever ignoring Exceptions with no wait if return value is None" - - - Any combination of stop, wait, etc. is also supported to give you the freedom to mix and match. - - Contribute - ---------- - - #. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. - #. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it). - #. Write a test which shows that the bug was fixed or that the feature works as expected. - #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. - - .. _`the repository`: http://github.com/rholder/retrying - .. _AUTHORS: https://github.com/rholder/retrying/blob/master/AUTHORS.rst - - - .. :changelog: - - History - ------- - 1.3.3 (2014-12-14) - ++++++++++++++++++ - - Add minimum six version of 1.7.0 since anything less will break things - - 1.3.2 (2014-11-09) - ++++++++++++++++++ - - Ensure we wrap the decorated functions to prevent information loss - - Allow a jitter value to be passed in - - 1.3.1 (2014-09-30) - ++++++++++++++++++ - - Add requirements.txt to MANIFEST.in to fix pip installs - - 1.3.0 (2014-09-30) - ++++++++++++++++++ - - Add upstream six dependency, remove embedded six functionality - - 1.2.3 (2014-08-25) - ++++++++++++++++++ - - Add support for custom wait and stop functions - - 1.2.2 (2014-06-20) - ++++++++++++++++++ - - Bug fix to not raise a RetryError on failure when exceptions aren't being wrapped - - 1.2.1 (2014-05-05) - ++++++++++++++++++ - - Bug fix for explicitly passing in a wait type - - 1.2.0 (2014-05-04) - ++++++++++++++++++ - - Remove the need for explicit specification of stop/wait types when they can be inferred - - Add a little checking for exception propagation - - 1.1.0 (2014-03-31) - ++++++++++++++++++ - - Added proper exception propagation through reraising with Python 2.6, 2.7, and 3.2 compatibility - - Update test suite for behavior changes - - 1.0.1 (2013-03-20) - ++++++++++++++++++ - - Fixed a bug where classes not extending from the Python exception hierarchy could slip through - - Update test suite for custom Python exceptions - - 1.0.0 (2013-01-21) - ++++++++++++++++++ - - First stable, tested version now exists - - Apache 2.0 license applied - - Sanitizing some setup.py and test suite running - - Added Travis CI support - Keywords: decorator decorators retry retrying exception exponential backoff -Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Natural Language :: English Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Internet Classifier: Topic :: Utilities +License-File: LICENSE +License-File: NOTICE +License-File: AUTHORS.rst + +Retrying +========================= +Retrying is an Apache 2.0 licensed general-purpose retrying library, written in +Python, to simplify the task of adding retry behavior to just about anything. + + +The simplest use case is retrying a flaky function whenever an Exception occurs +until a value is returned. + +.. code-block:: python + + import random + from retrying import retry + + @retry + def do_something_unreliable(): + if random.randint(0, 10) > 1: + raise IOError("Broken sauce, everything is hosed!!!111one") + else: + return "Awesome sauce!" + + print do_something_unreliable() + + +Features +-------- + +- Generic Decorator API +- Specify stop condition (i.e. limit by number of attempts) +- Specify wait condition (i.e. exponential backoff sleeping between attempts) +- Customize retrying on Exceptions +- Customize retrying on expected returned result + + +Examples +---------- + +As you saw above, the default behavior is to retry forever without waiting. + +.. code-block:: python + + @retry + def never_give_up_never_surrender(): + print "Retry forever ignoring Exceptions, don't wait between retries" + + +Let's be a little less persistent and set some boundaries, such as the number of attempts before giving up. + +.. code-block:: python + + @retry(stop_max_attempt_number=7) + def stop_after_7_attempts(): + print "Stopping after 7 attempts" + +We don't have all day, so let's set a boundary for how long we should be retrying stuff. + +.. code-block:: python + + @retry(stop_max_delay=10000) + def stop_after_10_s(): + print "Stopping after 10 seconds" + +Most things don't like to be polled as fast as possible, so let's just wait 2 seconds between retries. + +.. code-block:: python + + @retry(wait_fixed=2000) + def wait_2_s(): + print "Wait 2 second between retries" + + +Some things perform best with a bit of randomness injected. + +.. code-block:: python + + @retry(wait_random_min=1000, wait_random_max=2000) + def wait_random_1_to_2_s(): + print "Randomly wait 1 to 2 seconds between retries" + +Then again, it's hard to beat exponential backoff when retrying distributed services and other remote endpoints. + +.. code-block:: python + + @retry(wait_exponential_multiplier=1000, wait_exponential_max=10000) + def wait_exponential_1000(): + print "Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" + + +We have a few options for dealing with retries that raise specific or general exceptions, as in the cases here. + +.. code-block:: python + + def retry_if_io_error(exception): + """Return True if we should retry (in this case when it's an IOError), False otherwise""" + return isinstance(exception, IOError) + + @retry(retry_on_exception=retry_if_io_error) + def might_io_error(): + print "Retry forever with no wait if an IOError occurs, raise any other errors" + + @retry(retry_on_exception=retry_if_io_error, wrap_exception=True) + def only_raise_retry_error_when_not_io_error(): + print "Retry forever with no wait if an IOError occurs, raise any other errors wrapped in RetryError" + +We can also use the result of the function to alter the behavior of retrying. + +.. code-block:: python + + def retry_if_result_none(result): + """Return True if we should retry (in this case when result is None), False otherwise""" + return result is None + + @retry(retry_on_result=retry_if_result_none) + def might_return_none(): + print "Retry forever ignoring Exceptions with no wait if return value is None" + + +Any combination of stop, wait, etc. is also supported to give you the freedom to mix and match. + +Contribute +---------- + +#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. +#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it). +#. Write a test which shows that the bug was fixed or that the feature works as expected. +#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. + +.. _`the repository`: http://github.com/groodt/retrying +.. _AUTHORS: https://github.com/groodt/retrying/blob/master/AUTHORS.rst + + +.. :changelog: + +History +------- +1.3.4 (2022-09-03) +++++++++++++++++++ +- Added Greg Roodt as maintainer +- Formatted code with black +- Updated repository references + +1.3.3 (2014-12-14) +++++++++++++++++++ +- Add minimum six version of 1.7.0 since anything less will break things + +1.3.2 (2014-11-09) +++++++++++++++++++ +- Ensure we wrap the decorated functions to prevent information loss +- Allow a jitter value to be passed in + +1.3.1 (2014-09-30) +++++++++++++++++++ +- Add requirements.txt to MANIFEST.in to fix pip installs + +1.3.0 (2014-09-30) +++++++++++++++++++ +- Add upstream six dependency, remove embedded six functionality + +1.2.3 (2014-08-25) +++++++++++++++++++ +- Add support for custom wait and stop functions + +1.2.2 (2014-06-20) +++++++++++++++++++ +- Bug fix to not raise a RetryError on failure when exceptions aren't being wrapped + +1.2.1 (2014-05-05) +++++++++++++++++++ +- Bug fix for explicitly passing in a wait type + +1.2.0 (2014-05-04) +++++++++++++++++++ +- Remove the need for explicit specification of stop/wait types when they can be inferred +- Add a little checking for exception propagation + +1.1.0 (2014-03-31) +++++++++++++++++++ +- Added proper exception propagation through reraising with Python 2.6, 2.7, and 3.2 compatibility +- Update test suite for behavior changes + +1.0.1 (2013-03-20) +++++++++++++++++++ +- Fixed a bug where classes not extending from the Python exception hierarchy could slip through +- Update test suite for custom Python exceptions + +1.0.0 (2013-01-21) +++++++++++++++++++ +- First stable, tested version now exists +- Apache 2.0 license applied +- Sanitizing some setup.py and test suite running +- Added Travis CI support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/retrying.egg-info/requires.txt new/retrying-1.3.4/retrying.egg-info/requires.txt --- old/retrying-1.3.3/retrying.egg-info/requires.txt 2014-12-15 02:17:02.000000000 +0100 +++ new/retrying-1.3.4/retrying.egg-info/requires.txt 2022-11-25 10:56:44.000000000 +0100 @@ -1 +1 @@ -six>=1.7.0 \ No newline at end of file +six>=1.7.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/retrying.py new/retrying-1.3.4/retrying.py --- old/retrying-1.3.3/retrying.py 2014-11-10 05:25:32.000000000 +0100 +++ new/retrying-1.3.4/retrying.py 2022-11-25 10:54:32.000000000 +0100 @@ -1,16 +1,16 @@ -## Copyright 2013-2014 Ray Holder -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. +# Copyright 2013-2014 Ray Holder +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import random import six @@ -23,6 +23,13 @@ MAX_WAIT = 1073741823 +def _retry_if_exception_of_type(retryable_types): + def _retry_if_exception_these_types(exception): + return isinstance(exception, retryable_types) + + return _retry_if_exception_these_types + + def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @@ -31,8 +38,8 @@ """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and callable(dargs[0]): - def wrap_simple(f): + def wrap_simple(f): @six.wraps(f) def wrapped_f(*args, **kw): return Retrying().call(f, *args, **kw) @@ -42,8 +49,8 @@ return wrap_simple(dargs[0]) else: - def wrap(f): + def wrap(f): @six.wraps(f) def wrapped_f(*args, **kw): return Retrying(*dargs, **dkw).call(f, *args, **kw) @@ -54,32 +61,55 @@ class Retrying(object): - - def __init__(self, - stop=None, wait=None, - stop_max_attempt_number=None, - stop_max_delay=None, - wait_fixed=None, - wait_random_min=None, wait_random_max=None, - wait_incrementing_start=None, wait_incrementing_increment=None, - wait_exponential_multiplier=None, wait_exponential_max=None, - retry_on_exception=None, - retry_on_result=None, - wrap_exception=False, - stop_func=None, - wait_func=None, - wait_jitter_max=None): - - self._stop_max_attempt_number = 5 if stop_max_attempt_number is None else stop_max_attempt_number + def __init__( + self, + stop=None, + wait=None, + stop_max_attempt_number=None, + stop_max_delay=None, + wait_fixed=None, + wait_random_min=None, + wait_random_max=None, + wait_incrementing_start=None, + wait_incrementing_increment=None, + wait_incrementing_max=None, + wait_exponential_multiplier=None, + wait_exponential_max=None, + retry_on_exception=None, + retry_on_result=None, + wrap_exception=False, + stop_func=None, + wait_func=None, + wait_jitter_max=None, + before_attempts=None, + after_attempts=None, + ): + + self._stop_max_attempt_number = ( + 5 if stop_max_attempt_number is None else stop_max_attempt_number + ) self._stop_max_delay = 100 if stop_max_delay is None else stop_max_delay self._wait_fixed = 1000 if wait_fixed is None else wait_fixed self._wait_random_min = 0 if wait_random_min is None else wait_random_min self._wait_random_max = 1000 if wait_random_max is None else wait_random_max - self._wait_incrementing_start = 0 if wait_incrementing_start is None else wait_incrementing_start - self._wait_incrementing_increment = 100 if wait_incrementing_increment is None else wait_incrementing_increment - self._wait_exponential_multiplier = 1 if wait_exponential_multiplier is None else wait_exponential_multiplier - self._wait_exponential_max = MAX_WAIT if wait_exponential_max is None else wait_exponential_max + self._wait_incrementing_start = ( + 0 if wait_incrementing_start is None else wait_incrementing_start + ) + self._wait_incrementing_increment = ( + 100 if wait_incrementing_increment is None else wait_incrementing_increment + ) + self._wait_exponential_multiplier = ( + 1 if wait_exponential_multiplier is None else wait_exponential_multiplier + ) + self._wait_exponential_max = ( + MAX_WAIT if wait_exponential_max is None else wait_exponential_max + ) + self._wait_incrementing_max = ( + MAX_WAIT if wait_incrementing_max is None else wait_incrementing_max + ) self._wait_jitter_max = 0 if wait_jitter_max is None else wait_jitter_max + self._before_attempts = before_attempts + self._after_attempts = after_attempts # TODO add chaining of stop behaviors # stop behavior @@ -94,7 +124,9 @@ self.stop = stop_func elif stop is None: - self.stop = lambda attempts, delay: any(f(attempts, delay) for f in stop_funcs) + self.stop = lambda attempts, delay: any( + f(attempts, delay) for f in stop_funcs + ) else: self.stop = getattr(self, stop) @@ -108,7 +140,10 @@ if wait_random_min is not None or wait_random_max is not None: wait_funcs.append(self.random_sleep) - if wait_incrementing_start is not None or wait_incrementing_increment is not None: + if ( + wait_incrementing_start is not None + or wait_incrementing_increment is not None + ): wait_funcs.append(self.incrementing_sleep) if wait_exponential_multiplier is not None or wait_exponential_max is not None: @@ -118,7 +153,9 @@ self.wait = wait_func elif wait is None: - self.wait = lambda attempts, delay: max(f(attempts, delay) for f in wait_funcs) + self.wait = lambda attempts, delay: max( + f(attempts, delay) for f in wait_funcs + ) else: self.wait = getattr(self, wait) @@ -127,9 +164,13 @@ if retry_on_exception is None: self._retry_on_exception = self.always_reject else: + # this allows for providing a tuple of exception types that + # should be allowed to retry on, and avoids having to create + # a callback that does the same thing + if isinstance(retry_on_exception, (tuple)): + retry_on_exception = _retry_if_exception_of_type(retry_on_exception) self._retry_on_exception = retry_on_exception - # TODO simplify retrying by Exception types # retry on result filter if retry_on_result is None: self._retry_on_result = self.never_reject @@ -146,7 +187,8 @@ """Stop after the time from the first attempt >= stop_max_delay.""" return delay_since_first_attempt_ms >= self._stop_max_delay - def no_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): + @staticmethod + def no_sleep(previous_attempt_number, delay_since_first_attempt_ms): """Don't sleep at all before retrying.""" return 0 @@ -163,13 +205,17 @@ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ - result = self._wait_incrementing_start + (self._wait_incrementing_increment * (previous_attempt_number - 1)) + result = self._wait_incrementing_start + ( + self._wait_incrementing_increment * (previous_attempt_number - 1) + ) + if result > self._wait_incrementing_max: + result = self._wait_incrementing_max if result < 0: result = 0 return result def exponential_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): - exp = 2 ** previous_attempt_number + exp = 2**previous_attempt_number result = self._wait_exponential_multiplier * exp if result > self._wait_exponential_max: result = self._wait_exponential_max @@ -177,10 +223,12 @@ result = 0 return result - def never_reject(self, result): + @staticmethod + def never_reject(result): return False - def always_reject(self, result): + @staticmethod + def always_reject(result): return True def should_reject(self, attempt): @@ -196,6 +244,9 @@ start_time = int(round(time.time() * 1000)) attempt_number = 1 while True: + if self._before_attempts: + self._before_attempts(attempt_number) + try: attempt = Attempt(fn(*args, **kwargs), attempt_number, False) except: @@ -205,6 +256,9 @@ if not self.should_reject(attempt): return attempt.get(self._wrap_exception) + if self._after_attempts: + self._after_attempts(attempt_number) + delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time if self.stop(attempt_number, delay_since_first_attempt_ms): if not self._wrap_exception and attempt.has_exception: @@ -250,7 +304,9 @@ def __repr__(self): if self.has_exception: - return "Attempts: {0}, Error:\n{1}".format(self.attempt_number, "".join(traceback.format_tb(self.value[2]))) + return "Attempts: {0}, Error:\n{1}".format( + self.attempt_number, "".join(traceback.format_tb(self.value[2])) + ) else: return "Attempts: {0}, Value: {1}".format(self.attempt_number, self.value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/setup.cfg new/retrying-1.3.4/setup.cfg --- old/retrying-1.3.3/setup.cfg 2014-12-15 02:17:02.000000000 +0100 +++ new/retrying-1.3.4/setup.cfg 2022-11-25 10:56:44.095518800 +0100 @@ -1,5 +1,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/retrying-1.3.3/setup.py new/retrying-1.3.4/setup.py --- old/retrying-1.3.3/setup.py 2014-12-15 02:05:39.000000000 +0100 +++ new/retrying-1.3.4/setup.py 2022-11-25 10:54:32.000000000 +0100 @@ -1,57 +1,45 @@ #!/usr/bin/env python - -import os -import sys - try: from setuptools import setup except ImportError: from distutils.core import setup -settings = dict() - -# Publish Helper. -if sys.argv[-1] == 'publish': - os.system('python setup.py sdist upload') - sys.exit() - CLASSIFIERS = [ - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Topic :: Internet', - 'Topic :: Utilities', + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Internet", + "Topic :: Utilities", ] -with open('README.rst') as file_readme: +with open("README.rst") as file_readme: readme = file_readme.read() -with open('HISTORY.rst') as file_history: +with open("HISTORY.rst") as file_history: history = file_history.read() -with open('requirements.txt') as file_requirements: +with open("requirements.txt") as file_requirements: requirements = file_requirements.read().splitlines() -settings.update( - name='retrying', - version='1.3.3', - description='Retrying', - long_description=readme + '\n\n' + history, - author='Ray Holder', - license='Apache 2.0', - url='https://github.com/rholder/retrying', +setup( + name="retrying", + version="1.3.4", + description="Retrying", + long_description=readme + "\n\n" + history, + author="Greg Roodt", + license="Apache 2.0", + url="https://github.com/groodt/retrying", classifiers=CLASSIFIERS, keywords="decorator decorators retry retrying exception exponential backoff", - py_modules= ['retrying'], + py_modules=["retrying"], test_suite="test_retrying", install_requires=requirements, ) - - -setup(**settings)