-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding DictConfig #498
base: main
Are you sure you want to change the base?
Adding DictConfig #498
Conversation
Introduce a DictConfig class to manage default retry parameters in a singleton dictionary. Enhances flexibility by allowing default configurations to be overridden or extended when calling the retry decorator.
Remove redundant attribute check in __init__ method and simplify its initialization. Add a new `get` method to access configuration values more explicitly and efficiently.
This commit introduces a new test class `TestRetryDefaults` to verify `dict_config` functionalities within tenacity. Included tests cover setting, getting, overriding, and deleting configuration attributes, as well as testing retry behavior with default and overridden configurations.
|
Reformatted function calls and comments across `tests/test_tenacity.py` and `tenacity/config.py` for consistent indentation and alignment. This improves the code's readability and maintainability.
Introduced the `DictConfig` class to manage default retry parameters in a singleton dictionary. Refactored initialization methods, adding a new `get` method for better configuration access. Included a new test class `TestRetryDefaults` to verify `dict_config` functionalities.
Converted multi-line entries in release notes to single-line with quotes. This improves readability and maintains consistency across the document. Reduced redundancy in formatting for a cleaner output.
Updated the singleton implementation and added type annotations to various methods and attributes in the DictConfig class. This improves code readability and helps with static type checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is an infrastructure we want to offer in tenacity.
Is there another way / a compromise for this to be supported by Tenacity? I think it would be highly useful to have safer retry defaults, for one. Perhaps configurable via |
Pull Request Description
This pull request includes new features for configuring retry parameters using the
DictConfig
class.Summary of Changes:
Add Unit Tests for Tenacity's Default Configurations:
TestRetryDefaults
to validate the functionalities ofdict_config
within tenacity.Refactor Configuration Handling:
__init__
method and simplified its initialization.get
method to access configuration values more explicitly and efficiently.Add Configurable Retry Parameters with
DictConfig
:DictConfig
class to manage default retry parameters in a singleton dictionary.This is addressing issue #495