relinker 0.6.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.
- relinker-0.6.0/.editorconfig +15 -0
- relinker-0.6.0/.github/dependabot.yml +24 -0
- relinker-0.6.0/.github/pull_request_template.md +12 -0
- relinker-0.6.0/.github/workflows/ci.yml +95 -0
- relinker-0.6.0/.github/workflows/publish.yml +42 -0
- relinker-0.6.0/.gitignore +32 -0
- relinker-0.6.0/.pre-commit-config.yaml +7 -0
- relinker-0.6.0/APPLYING_DOCS_PATCH.md +38 -0
- relinker-0.6.0/APPLYING_RELINKER_PATCH.md +31 -0
- relinker-0.6.0/CHANGELOG.md +56 -0
- relinker-0.6.0/CONTRIBUTING.md +47 -0
- relinker-0.6.0/LICENSE +21 -0
- relinker-0.6.0/PKG-INFO +397 -0
- relinker-0.6.0/README.md +372 -0
- relinker-0.6.0/ROADMAP.md +39 -0
- relinker-0.6.0/SECURITY.md +16 -0
- relinker-0.6.0/docs/README.md +33 -0
- relinker-0.6.0/docs/api-reference.md +129 -0
- relinker-0.6.0/docs/async.md +64 -0
- relinker-0.6.0/docs/common-patterns.md +214 -0
- relinker-0.6.0/docs/conditions.md +3 -0
- relinker-0.6.0/docs/context-manager.md +59 -0
- relinker-0.6.0/docs/delays.md +102 -0
- relinker-0.6.0/docs/design-principles.md +70 -0
- relinker-0.6.0/docs/development.md +55 -0
- relinker-0.6.0/docs/diagnostics.md +96 -0
- relinker-0.6.0/docs/error-handling.md +102 -0
- relinker-0.6.0/docs/events.md +30 -0
- relinker-0.6.0/docs/examples.md +67 -0
- relinker-0.6.0/docs/getting-started.md +74 -0
- relinker-0.6.0/docs/http.md +82 -0
- relinker-0.6.0/docs/index.md +63 -0
- relinker-0.6.0/docs/installation.md +60 -0
- relinker-0.6.0/docs/observability.md +79 -0
- relinker-0.6.0/docs/policy-builder.md +110 -0
- relinker-0.6.0/docs/policy.md +57 -0
- relinker-0.6.0/docs/presets.md +126 -0
- relinker-0.6.0/docs/production-checklist.md +49 -0
- relinker-0.6.0/docs/quickstart.md +89 -0
- relinker-0.6.0/docs/release.md +74 -0
- relinker-0.6.0/docs/results.md +64 -0
- relinker-0.6.0/docs/retry.md +3 -0
- relinker-0.6.0/docs/roadmap.md +43 -0
- relinker-0.6.0/docs/safety.md +87 -0
- relinker-0.6.0/docs/state.md +116 -0
- relinker-0.6.0/docs/statistics.md +53 -0
- relinker-0.6.0/docs/stop.md +3 -0
- relinker-0.6.0/docs/testing.md +54 -0
- relinker-0.6.0/docs/try-again.md +92 -0
- relinker-0.6.0/docs/when-not-to-retry.md +45 -0
- relinker-0.6.0/examples/README.md +40 -0
- relinker-0.6.0/examples/__init__.py +1 -0
- relinker-0.6.0/examples/basic_retry.py +16 -0
- relinker-0.6.0/examples/fake_services.py +34 -0
- relinker-0.6.0/examples/retry_async.py +26 -0
- relinker-0.6.0/examples/retry_context_manager.py +13 -0
- relinker-0.6.0/examples/retry_database_like.py +17 -0
- relinker-0.6.0/examples/retry_http_like.py +25 -0
- relinker-0.6.0/examples/retry_http_retry_after.py +24 -0
- relinker-0.6.0/examples/retry_policy_doctor.py +14 -0
- relinker-0.6.0/examples/retry_polling.py +16 -0
- relinker-0.6.0/examples/retry_preview_and_explain.py +16 -0
- relinker-0.6.0/examples/retry_production_checklist.py +16 -0
- relinker-0.6.0/examples/retry_result_to_json.py +12 -0
- relinker-0.6.0/examples/retry_return_result.py +15 -0
- relinker-0.6.0/examples/retry_structured_logging.py +15 -0
- relinker-0.6.0/examples/retry_try_again.py +20 -0
- relinker-0.6.0/examples/retry_with_diagnostics.py +12 -0
- relinker-0.6.0/examples/retry_with_events.py +28 -0
- relinker-0.6.0/examples/retry_with_fallback.py +18 -0
- relinker-0.6.0/examples/retry_with_logging.py +17 -0
- relinker-0.6.0/examples/retry_with_policy.py +24 -0
- relinker-0.6.0/examples/retry_with_presets.py +16 -0
- relinker-0.6.0/examples/retry_with_statistics.py +16 -0
- relinker-0.6.0/examples/retry_without_sleep_in_tests.py +14 -0
- relinker-0.6.0/pyproject.toml +57 -0
- relinker-0.6.0/scripts/ci.sh +8 -0
- relinker-0.6.0/scripts/format.sh +5 -0
- relinker-0.6.0/scripts/lint.sh +5 -0
- relinker-0.6.0/scripts/release.sh +4 -0
- relinker-0.6.0/scripts/test.sh +4 -0
- relinker-0.6.0/src/relinker/.github/workflows/ci.yml +43 -0
- relinker-0.6.0/src/relinker/__init__.py +70 -0
- relinker-0.6.0/src/relinker/attempt.py +46 -0
- relinker-0.6.0/src/relinker/conditions/__init__.py +17 -0
- relinker-0.6.0/src/relinker/conditions/base.py +41 -0
- relinker-0.6.0/src/relinker/conditions/composite.py +38 -0
- relinker-0.6.0/src/relinker/conditions/custom.py +29 -0
- relinker-0.6.0/src/relinker/conditions/exception.py +26 -0
- relinker-0.6.0/src/relinker/conditions/result.py +24 -0
- relinker-0.6.0/src/relinker/context.py +619 -0
- relinker-0.6.0/src/relinker/delays/__init__.py +24 -0
- relinker-0.6.0/src/relinker/delays/base.py +31 -0
- relinker-0.6.0/src/relinker/delays/chain.py +35 -0
- relinker-0.6.0/src/relinker/delays/composite.py +18 -0
- relinker-0.6.0/src/relinker/delays/custom.py +22 -0
- relinker-0.6.0/src/relinker/delays/exponential.py +35 -0
- relinker-0.6.0/src/relinker/delays/fixed.py +22 -0
- relinker-0.6.0/src/relinker/delays/linear.py +35 -0
- relinker-0.6.0/src/relinker/delays/random_delay.py +35 -0
- relinker-0.6.0/src/relinker/delays/random_exponential.py +47 -0
- relinker-0.6.0/src/relinker/delays/stateful.py +85 -0
- relinker-0.6.0/src/relinker/diagnostics.py +179 -0
- relinker-0.6.0/src/relinker/event.py +50 -0
- relinker-0.6.0/src/relinker/exceptions.py +53 -0
- relinker-0.6.0/src/relinker/executors/__init__.py +6 -0
- relinker-0.6.0/src/relinker/executors/async_.py +378 -0
- relinker-0.6.0/src/relinker/executors/sync.py +378 -0
- relinker-0.6.0/src/relinker/http.py +189 -0
- relinker-0.6.0/src/relinker/internal/__init__.py +4 -0
- relinker-0.6.0/src/relinker/internal/clock.py +10 -0
- relinker-0.6.0/src/relinker/internal/decorator.py +65 -0
- relinker-0.6.0/src/relinker/internal/exhaustion.py +70 -0
- relinker-0.6.0/src/relinker/internal/policy_diagnostics.py +181 -0
- relinker-0.6.0/src/relinker/internal/policy_logging.py +108 -0
- relinker-0.6.0/src/relinker/internal/policy_simulation.py +199 -0
- relinker-0.6.0/src/relinker/internal/sleep.py +19 -0
- relinker-0.6.0/src/relinker/internal/validation.py +35 -0
- relinker-0.6.0/src/relinker/policy.py +614 -0
- relinker-0.6.0/src/relinker/presets.py +149 -0
- relinker-0.6.0/src/relinker/py.typed +0 -0
- relinker-0.6.0/src/relinker/result.py +213 -0
- relinker-0.6.0/src/relinker/retry.py +58 -0
- relinker-0.6.0/src/relinker/state.py +77 -0
- relinker-0.6.0/src/relinker/stats.py +120 -0
- relinker-0.6.0/src/relinker/stop/__init__.py +17 -0
- relinker-0.6.0/src/relinker/stop/attempts.py +22 -0
- relinker-0.6.0/src/relinker/stop/base.py +38 -0
- relinker-0.6.0/src/relinker/stop/composite.py +29 -0
- relinker-0.6.0/src/relinker/stop/forever.py +21 -0
- relinker-0.6.0/src/relinker/stop/max_time.py +22 -0
- relinker-0.6.0/src/relinker/testing/__init__.py +6 -0
- relinker-0.6.0/src/relinker/testing/fake_task.py +44 -0
- relinker-0.6.0/src/relinker/testing/no_sleep.py +33 -0
- relinker-0.6.0/src/relinker/typing.py +54 -0
- relinker-0.6.0/tests/integration/test_async_context_manager.py +32 -0
- relinker-0.6.0/tests/integration/test_async_flow.py +31 -0
- relinker-0.6.0/tests/integration/test_context_manager.py +28 -0
- relinker-0.6.0/tests/integration/test_decorator_usage.py +9 -0
- relinker-0.6.0/tests/integration/test_events_state.py +31 -0
- relinker-0.6.0/tests/integration/test_exhausted_behavior.py +51 -0
- relinker-0.6.0/tests/integration/test_exhausted_precedence.py +22 -0
- relinker-0.6.0/tests/integration/test_new_diagnostics.py +239 -0
- relinker-0.6.0/tests/integration/test_policy_composition.py +23 -0
- relinker-0.6.0/tests/integration/test_policy_delays.py +23 -0
- relinker-0.6.0/tests/integration/test_policy_diagnostics.py +27 -0
- relinker-0.6.0/tests/integration/test_policy_usage.py +11 -0
- relinker-0.6.0/tests/integration/test_presets_usage.py +31 -0
- relinker-0.6.0/tests/integration/test_result_serialization.py +30 -0
- relinker-0.6.0/tests/integration/test_simulation_improvements.py +114 -0
- relinker-0.6.0/tests/integration/test_stateful_delay.py +310 -0
- relinker-0.6.0/tests/integration/test_statistics.py +38 -0
- relinker-0.6.0/tests/integration/test_sync_flow.py +31 -0
- relinker-0.6.0/tests/integration/test_try_again.py +270 -0
- relinker-0.6.0/tests/integration/test_version.py +5 -0
- relinker-0.6.0/tests/test_http_helpers.py +47 -0
- relinker-0.6.0/tests/test_policy_guidance.py +24 -0
- relinker-0.6.0/tests/unit/conditions/test_composite.py +19 -0
- relinker-0.6.0/tests/unit/conditions/test_custom.py +9 -0
- relinker-0.6.0/tests/unit/conditions/test_exception.py +8 -0
- relinker-0.6.0/tests/unit/conditions/test_result.py +8 -0
- relinker-0.6.0/tests/unit/delays/test_composite.py +16 -0
- relinker-0.6.0/tests/unit/delays/test_custom.py +7 -0
- relinker-0.6.0/tests/unit/delays/test_exponential.py +9 -0
- relinker-0.6.0/tests/unit/delays/test_fixed.py +5 -0
- relinker-0.6.0/tests/unit/delays/test_more_strategies.py +29 -0
- relinker-0.6.0/tests/unit/delays/test_random_delay.py +15 -0
- relinker-0.6.0/tests/unit/delays/test_random_exponential.py +17 -0
- relinker-0.6.0/tests/unit/executors/test_async.py +59 -0
- relinker-0.6.0/tests/unit/executors/test_sync.py +46 -0
- relinker-0.6.0/tests/unit/stop/test_attempts.py +8 -0
- relinker-0.6.0/tests/unit/stop/test_composite.py +18 -0
- relinker-0.6.0/tests/unit/stop/test_forever.py +7 -0
- relinker-0.6.0/tests/unit/stop/test_max_time.py +8 -0
- relinker-0.6.0/tests/unit/test_attempt.py +9 -0
- relinker-0.6.0/tests/unit/test_event.py +9 -0
- relinker-0.6.0/tests/unit/test_exceptions.py +8 -0
- relinker-0.6.0/tests/unit/test_http_helpers.py +294 -0
- relinker-0.6.0/tests/unit/test_logging_helper.py +186 -0
- relinker-0.6.0/tests/unit/test_policy.py +10 -0
- relinker-0.6.0/tests/unit/test_presets.py +47 -0
- relinker-0.6.0/tests/unit/test_result.py +29 -0
- relinker-0.6.0/tests/unit/test_result_improvements.py +295 -0
- relinker-0.6.0/tests/unit/test_retry.py +15 -0
- relinker-0.6.0/tests/unit/test_retry_state.py +126 -0
- relinker-0.6.0/tests/unit/test_retry_wrapped_function.py +105 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 4
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.md]
|
|
12
|
+
trim_trailing_whitespace = false
|
|
13
|
+
|
|
14
|
+
[*.{yml,yaml,toml}]
|
|
15
|
+
indent_size = 2
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
groups:
|
|
9
|
+
github-actions:
|
|
10
|
+
patterns:
|
|
11
|
+
- "*"
|
|
12
|
+
|
|
13
|
+
- package-ecosystem: "pip"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
17
|
+
groups:
|
|
18
|
+
python-dev-tools:
|
|
19
|
+
patterns:
|
|
20
|
+
- "pytest*"
|
|
21
|
+
- "ruff"
|
|
22
|
+
- "mypy"
|
|
23
|
+
- "build"
|
|
24
|
+
- "hatchling"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Describe what changed and why.
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
|
|
7
|
+
- [ ] Tests were added or updated when needed.
|
|
8
|
+
- [ ] `python -m ruff format --check .` passes.
|
|
9
|
+
- [ ] `python -m ruff check .` passes.
|
|
10
|
+
- [ ] `python -m mypy src` passes.
|
|
11
|
+
- [ ] `python -m pytest` passes.
|
|
12
|
+
- [ ] Documentation was updated when behavior changed.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ci-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
quality:
|
|
19
|
+
name: Quality checks
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v6
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v6
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
cache: pip
|
|
31
|
+
|
|
32
|
+
- name: Install package with development dependencies
|
|
33
|
+
run: |
|
|
34
|
+
python -m pip install --upgrade pip
|
|
35
|
+
python -m pip install -e ".[dev]"
|
|
36
|
+
|
|
37
|
+
- name: Check formatting
|
|
38
|
+
run: python -m ruff format --check .
|
|
39
|
+
|
|
40
|
+
- name: Run lint
|
|
41
|
+
run: python -m ruff check .
|
|
42
|
+
|
|
43
|
+
- name: Run type checks
|
|
44
|
+
run: python -m mypy src
|
|
45
|
+
|
|
46
|
+
tests:
|
|
47
|
+
name: Tests on Python ${{ matrix.python-version }}
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
needs: quality
|
|
50
|
+
|
|
51
|
+
strategy:
|
|
52
|
+
fail-fast: false
|
|
53
|
+
matrix:
|
|
54
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
55
|
+
|
|
56
|
+
steps:
|
|
57
|
+
- name: Checkout repository
|
|
58
|
+
uses: actions/checkout@v6
|
|
59
|
+
|
|
60
|
+
- name: Set up Python
|
|
61
|
+
uses: actions/setup-python@v6
|
|
62
|
+
with:
|
|
63
|
+
python-version: ${{ matrix.python-version }}
|
|
64
|
+
cache: pip
|
|
65
|
+
|
|
66
|
+
- name: Install package with development dependencies
|
|
67
|
+
run: |
|
|
68
|
+
python -m pip install --upgrade pip
|
|
69
|
+
python -m pip install -e ".[dev]"
|
|
70
|
+
|
|
71
|
+
- name: Run tests
|
|
72
|
+
run: python -m pytest
|
|
73
|
+
|
|
74
|
+
build:
|
|
75
|
+
name: Build package
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
needs: tests
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- name: Checkout repository
|
|
81
|
+
uses: actions/checkout@v6
|
|
82
|
+
|
|
83
|
+
- name: Set up Python
|
|
84
|
+
uses: actions/setup-python@v6
|
|
85
|
+
with:
|
|
86
|
+
python-version: "3.12"
|
|
87
|
+
cache: pip
|
|
88
|
+
|
|
89
|
+
- name: Install build dependencies
|
|
90
|
+
run: |
|
|
91
|
+
python -m pip install --upgrade pip
|
|
92
|
+
python -m pip install -e ".[dev]"
|
|
93
|
+
|
|
94
|
+
- name: Build distribution
|
|
95
|
+
run: python -m build
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
name: Build and publish to PyPI
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
environment:
|
|
17
|
+
name: pypi
|
|
18
|
+
url: https://pypi.org/project/relinker/
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
id-token: write
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout repository
|
|
26
|
+
uses: actions/checkout@v6
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Install build tooling
|
|
34
|
+
run: |
|
|
35
|
+
python -m pip install --upgrade pip
|
|
36
|
+
python -m pip install build
|
|
37
|
+
|
|
38
|
+
- name: Build package
|
|
39
|
+
run: python -m build
|
|
40
|
+
|
|
41
|
+
- name: Publish package to PyPI
|
|
42
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.mypy_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.coverage
|
|
10
|
+
htmlcov/
|
|
11
|
+
|
|
12
|
+
# Build
|
|
13
|
+
build/
|
|
14
|
+
dist/
|
|
15
|
+
*.egg-info/
|
|
16
|
+
|
|
17
|
+
# Environments
|
|
18
|
+
.venv/
|
|
19
|
+
venv/
|
|
20
|
+
env/
|
|
21
|
+
|
|
22
|
+
# Editors
|
|
23
|
+
.vscode/
|
|
24
|
+
.idea/
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
|
|
30
|
+
.venv/
|
|
31
|
+
venv/
|
|
32
|
+
env/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Applying this documentation patch
|
|
2
|
+
|
|
3
|
+
This archive focuses only on documentation and examples.
|
|
4
|
+
|
|
5
|
+
It replaces or adds:
|
|
6
|
+
|
|
7
|
+
- `README.md`
|
|
8
|
+
- `CHANGELOG.md`
|
|
9
|
+
- `docs/`
|
|
10
|
+
- `examples/`
|
|
11
|
+
|
|
12
|
+
It does not change Relinker runtime source code under `src/relinker/`.
|
|
13
|
+
|
|
14
|
+
## Apply
|
|
15
|
+
|
|
16
|
+
From the repository root:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
unzip -o relinker_docs_examples_patch.zip -d .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then run:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
python -m ruff format .
|
|
26
|
+
python -m ruff check .
|
|
27
|
+
python -m mypy src
|
|
28
|
+
python -m pytest
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Because this patch only changes Markdown and examples, runtime tests should not change unless an example is imported by tests.
|
|
32
|
+
|
|
33
|
+
## Suggested commit message
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git add README.md CHANGELOG.md docs examples
|
|
37
|
+
git commit -m "Expand documentation and examples"
|
|
38
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Relinker implementation patch
|
|
2
|
+
|
|
3
|
+
This ZIP contains replacement and new files using the same project structure.
|
|
4
|
+
Copy the files into the repository root and allow your file manager to replace
|
|
5
|
+
existing files.
|
|
6
|
+
|
|
7
|
+
## What changed
|
|
8
|
+
|
|
9
|
+
- Added `RetryPolicy.doctor()` with a `PolicyHealthReport`.
|
|
10
|
+
- Added `RetryPolicy.preview()` for a concise timing preview.
|
|
11
|
+
- Improved `RetryPolicy.explain()` to be more human-readable.
|
|
12
|
+
- Added event shortcut methods:
|
|
13
|
+
- `on_before_attempt()`
|
|
14
|
+
- `on_success()`
|
|
15
|
+
- `on_failure()`
|
|
16
|
+
- `on_retry()`
|
|
17
|
+
- `on_giveup()`
|
|
18
|
+
- Added `RetryPolicy.with_structured_logging()` with safe JSON log fields.
|
|
19
|
+
- Hardened HTTP helpers with validation and safer `Retry-After` parsing.
|
|
20
|
+
- Added `http_retry_policy()` as a friendly HTTP recipe.
|
|
21
|
+
- Exported new public helpers from `relinker.__init__`.
|
|
22
|
+
- Added tests for the new HTTP helpers and guidance features.
|
|
23
|
+
|
|
24
|
+
## Suggested checks
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m ruff format --check .
|
|
28
|
+
python -m ruff check .
|
|
29
|
+
python -m mypy src
|
|
30
|
+
python -m pytest
|
|
31
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Relinker will be documented in this file.
|
|
4
|
+
|
|
5
|
+
Relinker follows practical semantic versioning while the project is still pre-1.0. Breaking changes may happen before 1.0, but they should be documented clearly.
|
|
6
|
+
|
|
7
|
+
## 0.6.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added `RetryPolicy.doctor()` for human-friendly policy health reports.
|
|
12
|
+
- Added `PolicyHealthReport` with risk levels and JSON-friendly output.
|
|
13
|
+
- Added `RetryPolicy.preview()` for concise retry timing previews.
|
|
14
|
+
- Added more human-friendly `RetryPolicy.explain()` output.
|
|
15
|
+
- Added shortcut event methods:
|
|
16
|
+
- `on_before_attempt()`
|
|
17
|
+
- `on_success()`
|
|
18
|
+
- `on_failure()`
|
|
19
|
+
- `on_retry()`
|
|
20
|
+
- `on_giveup()`
|
|
21
|
+
- Added `with_structured_logging()` for compact JSON logs.
|
|
22
|
+
- Added dependency-free HTTP helpers:
|
|
23
|
+
- `should_retry_http_status()`
|
|
24
|
+
- `retry_if_status()`
|
|
25
|
+
- `retry_after_delay()`
|
|
26
|
+
- `parse_retry_after()`
|
|
27
|
+
- `http_retry_policy()`
|
|
28
|
+
- Added safer handling for large or invalid `Retry-After` headers.
|
|
29
|
+
- Added documentation-focused examples for production-style workflows.
|
|
30
|
+
|
|
31
|
+
### Improved
|
|
32
|
+
|
|
33
|
+
- Improved policy diagnostics for risky retry loops.
|
|
34
|
+
- Improved simulation and preview readability.
|
|
35
|
+
- Improved structured logging safety by excluding error messages by default.
|
|
36
|
+
- Improved the public API exports for HTTP and diagnostics helpers.
|
|
37
|
+
- Improved tests around diagnostics, HTTP helpers, simulation, logging, and policy guidance.
|
|
38
|
+
|
|
39
|
+
### Notes
|
|
40
|
+
|
|
41
|
+
This release strengthens the core project direction:
|
|
42
|
+
|
|
43
|
+
> Simple by default, powerful by composition, safe by guidance.
|
|
44
|
+
|
|
45
|
+
## 0.4.0
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- Added the initial public retry policy builder.
|
|
50
|
+
- Added retry decorator support.
|
|
51
|
+
- Added sync and async execution.
|
|
52
|
+
- Added retry by exception and result.
|
|
53
|
+
- Added core delay strategies.
|
|
54
|
+
- Added presets.
|
|
55
|
+
- Added result objects and statistics.
|
|
56
|
+
- Added initial diagnostics and simulation support.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to Relinker.
|
|
4
|
+
|
|
5
|
+
## Local setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python3 -m venv .venv
|
|
9
|
+
source .venv/bin/activate
|
|
10
|
+
python -m pip install --upgrade pip
|
|
11
|
+
python -m pip install -e ".[dev]"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Run checks
|
|
15
|
+
|
|
16
|
+
Run the same checks used by GitHub Actions:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
./scripts/ci.sh
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or run them separately:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
python -m ruff format --check .
|
|
26
|
+
python -m ruff check .
|
|
27
|
+
python -m mypy src
|
|
28
|
+
python -m pytest
|
|
29
|
+
python -m build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Auto-format code
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python -m ruff check . --fix
|
|
36
|
+
python -m ruff format .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Code principles
|
|
40
|
+
|
|
41
|
+
- Keep modules small.
|
|
42
|
+
- Prefer clear names over clever names.
|
|
43
|
+
- Avoid hidden behavior.
|
|
44
|
+
- Validate impossible configurations only.
|
|
45
|
+
- Keep user control at the center of the API.
|
|
46
|
+
- Prefer explicit behavior over magic.
|
|
47
|
+
- Add tests for bug fixes and new behavior.
|
relinker-0.6.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RetryFlow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|