Skip to content

Improve backoff retry configuration#1993

Merged
iMicknl merged 5 commits intov2/mainfrom
v2/developer-experience
Apr 24, 2026
Merged

Improve backoff retry configuration#1993
iMicknl merged 5 commits intov2/mainfrom
v2/developer-experience

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Apr 17, 2026

Summary

  • Add __all__ and re-exports to package __init__.py for cleaner public API
  • Add max_time and jitter to all backoff retry decorators for more resilient retry behavior

Test plan

  • Existing tests pass
  • Public API exports are importable from pyoverkiz
  • Retry behavior works with new max_time/jitter settings

iMicknl added 2 commits April 17, 2026 13:01
Define an explicit public API surface by re-exporting the most commonly
used classes (client, models, auth credentials, exceptions) from the
top-level pyoverkiz package.
Cap total retry duration with max_time on each decorator and add
full_jitter to avoid thundering herd on concurrent retries.
@iMicknl iMicknl requested a review from tetienne as a code owner April 17, 2026 13:03
Copilot AI review requested due to automatic review settings April 17, 2026 13:03
@iMicknl iMicknl added v2 enhancement New feature or request labels Apr 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to simplify the library’s public API by re-exporting commonly used symbols from pyoverkiz/__init__.py, and to make retry behavior more resilient by capping total retry duration and adding jitter to backoff decorators.

Changes:

  • Add max_time and jitter=backoff.full_jitter to all reusable backoff.on_exception decorators in pyoverkiz/client.py.
  • Add package-root re-exports and an explicit __all__ in pyoverkiz/__init__.py.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pyoverkiz/client.py Adds max_time and jitter to backoff decorators to cap retry duration and reduce thundering-herd retries.
pyoverkiz/__init__.py Introduces top-level re-exports and __all__ to define a cleaner public import surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyoverkiz/__init__.py Outdated
Comment on lines +7 to +13
from pyoverkiz.auth import (
Credentials,
LocalTokenCredentials,
RexelOAuthCodeCredentials,
TokenCredentials,
UsernamePasswordCredentials,
)
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing credential classes from pyoverkiz.auth pulls in pyoverkiz.auth.factory and pyoverkiz.auth.strategies (via pyoverkiz/auth/__init__.py), which imports heavy optional runtime deps like boto3 at module import time. That makes a plain import pyoverkiz significantly heavier than necessary for users who only need models/exceptions. Prefer importing these symbols directly from pyoverkiz.auth.credentials (or use a lazy re-export via __getattr__) to keep top-level imports lightweight.

Copilot uses AI. Check for mistakes.
Comment thread pyoverkiz/__init__.py Outdated
Comment thread pyoverkiz/__init__.py Outdated
@iMicknl iMicknl marked this pull request as draft April 21, 2026 16:42
Copy link
Copy Markdown
Collaborator

@tetienne tetienne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really clean PR — the alphabetical __all__ with re-exports is exactly the kind of public API hygiene that makes a library pleasant to use, and the full_jitter addition is a solid thundering-herd fix. A few things worth considering before this lands.

Comment thread pyoverkiz/__init__.py Outdated
Comment thread pyoverkiz/client.py Outdated
Comment thread pyoverkiz/client.py
@iMicknl iMicknl changed the title Add __all__ exports and improve backoff retry configuration Improve backoff retry configuration Apr 24, 2026
@iMicknl iMicknl marked this pull request as ready for review April 24, 2026 14:32
@iMicknl iMicknl merged commit 896f34b into v2/main Apr 24, 2026
6 checks passed
@iMicknl iMicknl deleted the v2/developer-experience branch April 24, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants