Open
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.
Contributor
|
|
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.
jd
reviewed
Sep 29, 2024
Owner
jd
left a comment
There was a problem hiding this comment.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
This pull request includes new features for configuring retry parameters using the
DictConfigclass.Summary of Changes:
Add Unit Tests for Tenacity's Default Configurations:
TestRetryDefaultsto validate the functionalities ofdict_configwithin tenacity.Refactor Configuration Handling:
__init__method and simplified its initialization.getmethod to access configuration values more explicitly and efficiently.Add Configurable Retry Parameters with
DictConfig:DictConfigclass to manage default retry parameters in a singleton dictionary.This is addressing issue #495