tenacity
tenacity copied to clipboard
Adding DictConfig
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:
- Introduced a new test class
TestRetryDefaultsto validate the functionalities ofdict_configwithin tenacity. - Created unit tests that cover:
- Setting, getting, overriding, and deleting configuration attributes.
- Testing retry behavior with both default and overridden configurations.
- Introduced a new test class
-
Refactor Configuration Handling:
- Removed redundant attribute checks in the
__init__method and simplified its initialization. - Added a new
getmethod to access configuration values more explicitly and efficiently.
- Removed redundant attribute checks in the
-
Add Configurable Retry Parameters with
DictConfig:- Introduced a
DictConfigclass to manage default retry parameters in a singleton dictionary. - Enhanced flexibility by allowing default configurations to be overridden or extended when calling the retry decorator.
- Introduced a
This is addressing issue #495
⚠️ No release notes detected. Please make sure to use reno to add a changelog entry.
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 pyproject.toml as well.