tenacity 8.2.2__tar.gz → 8.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tenacity-8.3.0/.github/dependabot.yml +10 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/.github/workflows/ci.yaml +7 -10
- {tenacity-8.2.2 → tenacity-8.3.0}/.github/workflows/deploy.yaml +7 -6
- tenacity-8.3.0/.mergify.yml +41 -0
- {tenacity-8.2.2/tenacity.egg-info → tenacity-8.3.0}/PKG-INFO +4 -4
- {tenacity-8.2.2 → tenacity-8.3.0}/README.rst +20 -44
- {tenacity-8.2.2 → tenacity-8.3.0}/doc/source/api.rst +3 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/doc/source/index.rst +20 -44
- {tenacity-8.2.2 → tenacity-8.3.0}/pyproject.toml +5 -5
- tenacity-8.3.0/releasenotes/notes/Fix-tests-for-typeguard-3.x-6eebfea546b6207e.yaml +3 -0
- tenacity-8.3.0/releasenotes/notes/add-stop-before-delay-a775f88ac872c923.yaml +7 -0
- tenacity-8.3.0/releasenotes/notes/add-test-extra-55e869261b03e56d.yaml +3 -0
- tenacity-8.3.0/releasenotes/notes/added_a_link_to_documentation-eefaf8f074b539f8.yaml +5 -0
- tenacity-8.3.0/releasenotes/notes/dependabot-for-github-actions-4d2464f3c0928463.yaml +5 -0
- tenacity-8.3.0/releasenotes/notes/remove-py36-876c0416cf279d15.yaml +4 -0
- tenacity-8.3.0/releasenotes/notes/some-slug-for-preserve-defaults-86682846dfa18005.yaml +4 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/setup.cfg +5 -3
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/__init__.py +137 -39
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/_asyncio.py +59 -5
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/_utils.py +15 -2
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/before.py +3 -1
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/before_sleep.py +2 -1
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/retry.py +6 -2
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/stop.py +28 -1
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/tornadoweb.py +5 -1
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/wait.py +9 -3
- {tenacity-8.2.2 → tenacity-8.3.0/tenacity.egg-info}/PKG-INFO +4 -4
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity.egg-info/SOURCES.txt +10 -1
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity.egg-info/requires.txt +4 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tests/test_after.py +29 -6
- {tenacity-8.2.2 → tenacity-8.3.0}/tests/test_asyncio.py +48 -6
- {tenacity-8.2.2 → tenacity-8.3.0}/tests/test_tenacity.py +201 -53
- {tenacity-8.2.2 → tenacity-8.3.0}/tests/test_tornado.py +2 -2
- tenacity-8.3.0/tests/test_utils.py +41 -0
- tenacity-8.3.0/tox.ini +33 -0
- tenacity-8.2.2/.mergify.yml +0 -65
- tenacity-8.2.2/tox.ini +0 -57
- {tenacity-8.2.2 → tenacity-8.3.0}/.editorconfig +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/.gitignore +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/.readthedocs.yml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/LICENSE +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/doc/source/changelog.rst +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/doc/source/conf.py +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/Use--for-formatting-and-validate-using-black-39ec9d57d4691778.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/add-reno-d1ab5710f272650a.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/add-retry_except_exception_type-31b31da1924d55f4.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/add_omitted_modules_to_import_all-2ab282f20a2c22f7.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/add_retry_if_exception_cause_type-d16b918ace4ae0ad.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/after_log-50f4d73b24ce9203.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/allow-mocking-of-nap-sleep-6679c50e702446f1.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/annotate_code-197b93130df14042.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/before_sleep_log-improvements-d8149274dfb37d7c.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/clarify-reraise-option-6829667eacf4f599.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/do_not_package_tests-fe5ac61940b0a5ed.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/drop-deprecated-python-versions-69a05cb2e0f1034c.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/drop_deprecated-7ea90b212509b082.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/export-convenience-symbols-981d9611c8b754f3.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/fix-async-loop-with-result-f68e913ccb425aca.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/fix-wait-typing-b26eecdb6cc0a1de.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/fix_async-52b6594c8e75c4bc.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/make-logger-more-compatible-5da1ddf1bab77047.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/no-async-iter-6132a42e52348a75.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/pr320-py3-only-wheel-tag.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/py36_plus-c425fb3aa17c6682.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/retrycallstate-repr-94947f7b00ee15e1.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/sphinx_define_error-642c9cd5c165d39a.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/support-timedelta-wait-unit-type-5ba1e9fc0fe45523.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/timedelta-for-stop-ef6bf71b88ce9988.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/releasenotes/notes/wait_exponential_jitter-6ffc81dddcbaa6d3.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/reno.yaml +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/setup.py +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/after.py +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/nap.py +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity/py.typed +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity.egg-info/dependency_links.txt +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tenacity.egg-info/top_level.txt +0 -0
- {tenacity-8.2.2 → tenacity-8.3.0}/tests/__init__.py +0 -0
|
@@ -18,10 +18,6 @@ jobs:
|
|
|
18
18
|
strategy:
|
|
19
19
|
matrix:
|
|
20
20
|
include:
|
|
21
|
-
- python: "3.6"
|
|
22
|
-
tox: py36
|
|
23
|
-
- python: "3.7"
|
|
24
|
-
tox: py37
|
|
25
21
|
- python: "3.8"
|
|
26
22
|
tox: py38
|
|
27
23
|
- python: "3.9"
|
|
@@ -30,22 +26,23 @@ jobs:
|
|
|
30
26
|
tox: py310
|
|
31
27
|
- python: "3.11"
|
|
32
28
|
tox: py311
|
|
33
|
-
- python: "3.
|
|
29
|
+
- python: "3.12"
|
|
30
|
+
tox: py312
|
|
31
|
+
- python: "3.12"
|
|
34
32
|
tox: pep8
|
|
35
|
-
- python: "3.11"
|
|
36
|
-
tox: black-ci
|
|
37
33
|
- python: "3.11"
|
|
38
34
|
tox: mypy
|
|
39
35
|
steps:
|
|
40
36
|
- name: Checkout 🛎️
|
|
41
|
-
uses: actions/checkout@
|
|
37
|
+
uses: actions/checkout@v4.1.1
|
|
42
38
|
with:
|
|
43
39
|
fetch-depth: 0
|
|
44
40
|
|
|
45
41
|
- name: Setup Python 🔧
|
|
46
|
-
uses: actions/setup-python@
|
|
42
|
+
uses: actions/setup-python@v5.0.0
|
|
47
43
|
with:
|
|
48
|
-
python-version: ${{
|
|
44
|
+
python-version: ${{ matrix.python }}
|
|
45
|
+
allow-prereleases: true
|
|
49
46
|
|
|
50
47
|
- name: Build 🔧 & Test 🔍
|
|
51
48
|
run: |
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
name: Release deploy
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
6
7
|
|
|
7
8
|
jobs:
|
|
8
|
-
|
|
9
|
+
publish:
|
|
9
10
|
timeout-minutes: 20
|
|
10
|
-
runs-on: ubuntu-
|
|
11
|
+
runs-on: ubuntu-latest
|
|
11
12
|
steps:
|
|
12
13
|
- name: Checkout 🛎️
|
|
13
|
-
uses: actions/checkout@
|
|
14
|
+
uses: actions/checkout@v4.1.1
|
|
14
15
|
with:
|
|
15
16
|
fetch-depth: 0
|
|
16
17
|
|
|
17
18
|
- name: Setup Python 🔧
|
|
18
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@v5.0.0
|
|
19
20
|
with:
|
|
20
21
|
python-version: 3.11
|
|
21
22
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
queue_rules:
|
|
2
|
+
- name: default
|
|
3
|
+
merge_method: squash
|
|
4
|
+
queue_conditions:
|
|
5
|
+
- or:
|
|
6
|
+
- author = jd
|
|
7
|
+
- "#approved-reviews-by >= 1"
|
|
8
|
+
- author = dependabot[bot]
|
|
9
|
+
- or:
|
|
10
|
+
- files ~= ^releasenotes/notes/
|
|
11
|
+
- label = no-changelog
|
|
12
|
+
- author = dependabot[bot]
|
|
13
|
+
- "check-success=test (3.8, py38)"
|
|
14
|
+
- "check-success=test (3.9, py39)"
|
|
15
|
+
- "check-success=test (3.10, py310)"
|
|
16
|
+
- "check-success=test (3.11, py311)"
|
|
17
|
+
- "check-success=test (3.12, py312)"
|
|
18
|
+
- "check-success=test (3.12, pep8)"
|
|
19
|
+
|
|
20
|
+
pull_request_rules:
|
|
21
|
+
- name: warn on no changelog
|
|
22
|
+
conditions:
|
|
23
|
+
- -files~=^releasenotes/notes/
|
|
24
|
+
- label!=no-changelog
|
|
25
|
+
- -closed
|
|
26
|
+
actions:
|
|
27
|
+
comment:
|
|
28
|
+
message: >
|
|
29
|
+
⚠️ No release notes detected. Please make sure to use
|
|
30
|
+
[reno](https://docs.openstack.org/reno/latest/user/usage.html) to add
|
|
31
|
+
a changelog entry.
|
|
32
|
+
|
|
33
|
+
- name: automatic queue
|
|
34
|
+
conditions: []
|
|
35
|
+
actions:
|
|
36
|
+
queue:
|
|
37
|
+
|
|
38
|
+
- name: dismiss reviews
|
|
39
|
+
conditions: []
|
|
40
|
+
actions:
|
|
41
|
+
dismiss_reviews: {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tenacity
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.3.0
|
|
4
4
|
Summary: Retry code until it succeeds
|
|
5
5
|
Home-page: https://github.com/jd/tenacity
|
|
6
6
|
Author: Julien Danjou
|
|
@@ -11,15 +11,15 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
11
11
|
Classifier: Programming Language :: Python
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
19
|
Classifier: Topic :: Utilities
|
|
21
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.8
|
|
22
21
|
Provides-Extra: doc
|
|
22
|
+
Provides-Extra: test
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
|
|
25
25
|
Tenacity is a general-purpose retrying library to simplify the task of adding retry behavior to just about anything.
|
|
@@ -10,6 +10,8 @@ Tenacity
|
|
|
10
10
|
:target: https://mergify.io
|
|
11
11
|
:alt: Mergify Status
|
|
12
12
|
|
|
13
|
+
**Please refer to the** `tenacity documentation <https://tenacity.readthedocs.io/en/latest/>`_ **for a better experience.**
|
|
14
|
+
|
|
13
15
|
Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in
|
|
14
16
|
Python, to simplify the task of adding retry behavior to just about anything.
|
|
15
17
|
It originates from `a fork of retrying
|
|
@@ -122,6 +124,16 @@ retrying stuff.
|
|
|
122
124
|
print("Stopping after 10 seconds")
|
|
123
125
|
raise Exception
|
|
124
126
|
|
|
127
|
+
If you're on a tight deadline, and exceeding your delay time isn't ok,
|
|
128
|
+
then you can give up on retries one attempt before you would exceed the delay.
|
|
129
|
+
|
|
130
|
+
.. testcode::
|
|
131
|
+
|
|
132
|
+
@retry(stop=stop_before_delay(10))
|
|
133
|
+
def stop_before_10_s():
|
|
134
|
+
print("Stopping 1 attempt before 10 seconds")
|
|
135
|
+
raise Exception
|
|
136
|
+
|
|
125
137
|
You can combine several stop conditions by using the `|` operator:
|
|
126
138
|
|
|
127
139
|
.. testcode::
|
|
@@ -400,43 +412,7 @@ without raising an exception (or you can re-raise or do anything really)
|
|
|
400
412
|
RetryCallState
|
|
401
413
|
~~~~~~~~~~~~~~
|
|
402
414
|
|
|
403
|
-
``retry_state`` argument is an object of
|
|
404
|
-
|
|
405
|
-
.. autoclass:: tenacity.RetryCallState
|
|
406
|
-
|
|
407
|
-
Constant attributes:
|
|
408
|
-
|
|
409
|
-
.. autoattribute:: start_time(float)
|
|
410
|
-
:annotation:
|
|
411
|
-
|
|
412
|
-
.. autoattribute:: retry_object(BaseRetrying)
|
|
413
|
-
:annotation:
|
|
414
|
-
|
|
415
|
-
.. autoattribute:: fn(callable)
|
|
416
|
-
:annotation:
|
|
417
|
-
|
|
418
|
-
.. autoattribute:: args(tuple)
|
|
419
|
-
:annotation:
|
|
420
|
-
|
|
421
|
-
.. autoattribute:: kwargs(dict)
|
|
422
|
-
:annotation:
|
|
423
|
-
|
|
424
|
-
Variable attributes:
|
|
425
|
-
|
|
426
|
-
.. autoattribute:: attempt_number(int)
|
|
427
|
-
:annotation:
|
|
428
|
-
|
|
429
|
-
.. autoattribute:: outcome(tenacity.Future or None)
|
|
430
|
-
:annotation:
|
|
431
|
-
|
|
432
|
-
.. autoattribute:: outcome_timestamp(float or None)
|
|
433
|
-
:annotation:
|
|
434
|
-
|
|
435
|
-
.. autoattribute:: idle_for(float)
|
|
436
|
-
:annotation:
|
|
437
|
-
|
|
438
|
-
.. autoattribute:: next_action(tenacity.RetryAction or None)
|
|
439
|
-
:annotation:
|
|
415
|
+
``retry_state`` argument is an object of :class:`~tenacity.RetryCallState` class.
|
|
440
416
|
|
|
441
417
|
Other Custom Callbacks
|
|
442
418
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -445,33 +421,33 @@ It's also possible to define custom callbacks for other keyword arguments.
|
|
|
445
421
|
|
|
446
422
|
.. function:: my_stop(retry_state)
|
|
447
423
|
|
|
448
|
-
:param
|
|
424
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
449
425
|
:return: whether or not retrying should stop
|
|
450
426
|
:rtype: bool
|
|
451
427
|
|
|
452
428
|
.. function:: my_wait(retry_state)
|
|
453
429
|
|
|
454
|
-
:param
|
|
430
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
455
431
|
:return: number of seconds to wait before next retry
|
|
456
432
|
:rtype: float
|
|
457
433
|
|
|
458
434
|
.. function:: my_retry(retry_state)
|
|
459
435
|
|
|
460
|
-
:param
|
|
436
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
461
437
|
:return: whether or not retrying should continue
|
|
462
438
|
:rtype: bool
|
|
463
439
|
|
|
464
440
|
.. function:: my_before(retry_state)
|
|
465
441
|
|
|
466
|
-
:param
|
|
442
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
467
443
|
|
|
468
444
|
.. function:: my_after(retry_state)
|
|
469
445
|
|
|
470
|
-
:param
|
|
446
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
471
447
|
|
|
472
448
|
.. function:: my_before_sleep(retry_state)
|
|
473
449
|
|
|
474
|
-
:param
|
|
450
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
475
451
|
|
|
476
452
|
Here's an example with a custom ``before_sleep`` function:
|
|
477
453
|
|
|
@@ -622,7 +598,7 @@ Contribute
|
|
|
622
598
|
#. Check for open issues or open a fresh issue to start a discussion around a
|
|
623
599
|
feature idea or a bug.
|
|
624
600
|
#. Fork `the repository`_ on GitHub to start making your changes to the
|
|
625
|
-
**
|
|
601
|
+
**main** branch (or branch off of it).
|
|
626
602
|
#. Write a test which shows that the bug was fixed or that the feature works as
|
|
627
603
|
expected.
|
|
628
604
|
#. Add a `changelog <#Changelogs>`_
|
|
@@ -10,6 +10,8 @@ Tenacity
|
|
|
10
10
|
:target: https://mergify.io
|
|
11
11
|
:alt: Mergify Status
|
|
12
12
|
|
|
13
|
+
**Please refer to the** `tenacity documentation <https://tenacity.readthedocs.io/en/latest/>`_ **for a better experience.**
|
|
14
|
+
|
|
13
15
|
Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in
|
|
14
16
|
Python, to simplify the task of adding retry behavior to just about anything.
|
|
15
17
|
It originates from `a fork of retrying
|
|
@@ -122,6 +124,16 @@ retrying stuff.
|
|
|
122
124
|
print("Stopping after 10 seconds")
|
|
123
125
|
raise Exception
|
|
124
126
|
|
|
127
|
+
If you're on a tight deadline, and exceeding your delay time isn't ok,
|
|
128
|
+
then you can give up on retries one attempt before you would exceed the delay.
|
|
129
|
+
|
|
130
|
+
.. testcode::
|
|
131
|
+
|
|
132
|
+
@retry(stop=stop_before_delay(10))
|
|
133
|
+
def stop_before_10_s():
|
|
134
|
+
print("Stopping 1 attempt before 10 seconds")
|
|
135
|
+
raise Exception
|
|
136
|
+
|
|
125
137
|
You can combine several stop conditions by using the `|` operator:
|
|
126
138
|
|
|
127
139
|
.. testcode::
|
|
@@ -400,43 +412,7 @@ without raising an exception (or you can re-raise or do anything really)
|
|
|
400
412
|
RetryCallState
|
|
401
413
|
~~~~~~~~~~~~~~
|
|
402
414
|
|
|
403
|
-
``retry_state`` argument is an object of
|
|
404
|
-
|
|
405
|
-
.. autoclass:: tenacity.RetryCallState
|
|
406
|
-
|
|
407
|
-
Constant attributes:
|
|
408
|
-
|
|
409
|
-
.. autoattribute:: start_time(float)
|
|
410
|
-
:annotation:
|
|
411
|
-
|
|
412
|
-
.. autoattribute:: retry_object(BaseRetrying)
|
|
413
|
-
:annotation:
|
|
414
|
-
|
|
415
|
-
.. autoattribute:: fn(callable)
|
|
416
|
-
:annotation:
|
|
417
|
-
|
|
418
|
-
.. autoattribute:: args(tuple)
|
|
419
|
-
:annotation:
|
|
420
|
-
|
|
421
|
-
.. autoattribute:: kwargs(dict)
|
|
422
|
-
:annotation:
|
|
423
|
-
|
|
424
|
-
Variable attributes:
|
|
425
|
-
|
|
426
|
-
.. autoattribute:: attempt_number(int)
|
|
427
|
-
:annotation:
|
|
428
|
-
|
|
429
|
-
.. autoattribute:: outcome(tenacity.Future or None)
|
|
430
|
-
:annotation:
|
|
431
|
-
|
|
432
|
-
.. autoattribute:: outcome_timestamp(float or None)
|
|
433
|
-
:annotation:
|
|
434
|
-
|
|
435
|
-
.. autoattribute:: idle_for(float)
|
|
436
|
-
:annotation:
|
|
437
|
-
|
|
438
|
-
.. autoattribute:: next_action(tenacity.RetryAction or None)
|
|
439
|
-
:annotation:
|
|
415
|
+
``retry_state`` argument is an object of :class:`~tenacity.RetryCallState` class.
|
|
440
416
|
|
|
441
417
|
Other Custom Callbacks
|
|
442
418
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -445,33 +421,33 @@ It's also possible to define custom callbacks for other keyword arguments.
|
|
|
445
421
|
|
|
446
422
|
.. function:: my_stop(retry_state)
|
|
447
423
|
|
|
448
|
-
:param
|
|
424
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
449
425
|
:return: whether or not retrying should stop
|
|
450
426
|
:rtype: bool
|
|
451
427
|
|
|
452
428
|
.. function:: my_wait(retry_state)
|
|
453
429
|
|
|
454
|
-
:param
|
|
430
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
455
431
|
:return: number of seconds to wait before next retry
|
|
456
432
|
:rtype: float
|
|
457
433
|
|
|
458
434
|
.. function:: my_retry(retry_state)
|
|
459
435
|
|
|
460
|
-
:param
|
|
436
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
461
437
|
:return: whether or not retrying should continue
|
|
462
438
|
:rtype: bool
|
|
463
439
|
|
|
464
440
|
.. function:: my_before(retry_state)
|
|
465
441
|
|
|
466
|
-
:param
|
|
442
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
467
443
|
|
|
468
444
|
.. function:: my_after(retry_state)
|
|
469
445
|
|
|
470
|
-
:param
|
|
446
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
471
447
|
|
|
472
448
|
.. function:: my_before_sleep(retry_state)
|
|
473
449
|
|
|
474
|
-
:param
|
|
450
|
+
:param RetryCallState retry_state: info about current retry invocation
|
|
475
451
|
|
|
476
452
|
Here's an example with a custom ``before_sleep`` function:
|
|
477
453
|
|
|
@@ -622,7 +598,7 @@ Contribute
|
|
|
622
598
|
#. Check for open issues or open a fresh issue to start a discussion around a
|
|
623
599
|
feature idea or a bug.
|
|
624
600
|
#. Fork `the repository`_ on GitHub to start making your changes to the
|
|
625
|
-
**
|
|
601
|
+
**main** branch (or branch off of it).
|
|
626
602
|
#. Write a test which shows that the bug was fixed or that the feature works as
|
|
627
603
|
expected.
|
|
628
604
|
#. Add a `changelog <#Changelogs>`_
|
|
@@ -8,14 +8,14 @@ requires = [
|
|
|
8
8
|
]
|
|
9
9
|
build-backend="setuptools.build_meta"
|
|
10
10
|
|
|
11
|
-
[tool.
|
|
12
|
-
line-length =
|
|
13
|
-
|
|
14
|
-
target-version =
|
|
11
|
+
[tool.ruff]
|
|
12
|
+
line-length = 88
|
|
13
|
+
indent-width = 4
|
|
14
|
+
target-version = "py38"
|
|
15
15
|
|
|
16
16
|
[tool.mypy]
|
|
17
17
|
strict = true
|
|
18
|
-
files = ["tenacity"]
|
|
18
|
+
files = ["tenacity", "tests"]
|
|
19
19
|
show_error_codes = true
|
|
20
20
|
|
|
21
21
|
[[tool.mypy.overrides]]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
features:
|
|
3
|
+
- |
|
|
4
|
+
Added a new stop function: stop_before_delay, which will stop execution
|
|
5
|
+
if the next sleep time would cause overall delay to exceed the specified delay.
|
|
6
|
+
Useful for use cases where you have some upper bound on retry times that you must
|
|
7
|
+
not exceed, so returning before that timeout is preferable than returning after that timeout.
|
|
@@ -13,17 +13,16 @@ classifier =
|
|
|
13
13
|
Programming Language :: Python
|
|
14
14
|
Programming Language :: Python :: 3
|
|
15
15
|
Programming Language :: Python :: 3 :: Only
|
|
16
|
-
Programming Language :: Python :: 3.6
|
|
17
|
-
Programming Language :: Python :: 3.7
|
|
18
16
|
Programming Language :: Python :: 3.8
|
|
19
17
|
Programming Language :: Python :: 3.9
|
|
20
18
|
Programming Language :: Python :: 3.10
|
|
21
19
|
Programming Language :: Python :: 3.11
|
|
20
|
+
Programming Language :: Python :: 3.12
|
|
22
21
|
Topic :: Utilities
|
|
23
22
|
|
|
24
23
|
[options]
|
|
25
24
|
install_requires =
|
|
26
|
-
python_requires = >=3.
|
|
25
|
+
python_requires = >=3.8
|
|
27
26
|
packages = tenacity
|
|
28
27
|
|
|
29
28
|
[options.packages.find]
|
|
@@ -36,7 +35,10 @@ tenacity = py.typed
|
|
|
36
35
|
doc =
|
|
37
36
|
reno
|
|
38
37
|
sphinx
|
|
38
|
+
test =
|
|
39
|
+
pytest
|
|
39
40
|
tornado>=4.5
|
|
41
|
+
typeguard
|
|
40
42
|
|
|
41
43
|
[tool:pytest]
|
|
42
44
|
filterwarnings =
|