tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Adding DictConfig

Open SalvatoreZagaria opened this issue 1 year ago • 2 comments

Pull Request Description

This pull request includes new features for configuring retry parameters using the DictConfig class.

Summary of Changes:

  1. Add Unit Tests for Tenacity's Default Configurations:

    • Introduced a new test class TestRetryDefaults to validate the functionalities of dict_config within tenacity.
    • Created unit tests that cover:
      • Setting, getting, overriding, and deleting configuration attributes.
      • Testing retry behavior with both default and overridden configurations.
  2. Refactor Configuration Handling:

    • Removed redundant attribute checks in the __init__ method and simplified its initialization.
    • Added a new get method to access configuration values more explicitly and efficiently.
  3. Add Configurable Retry Parameters with DictConfig:

    • Introduced a DictConfig class 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.

This is addressing issue #495

SalvatoreZagaria avatar Sep 28 '24 13:09 SalvatoreZagaria

⚠️ No release notes detected. Please make sure to use reno to add a changelog entry.

mergify[bot] avatar Sep 28 '24 13:09 mergify[bot]

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.

tk512 avatar Oct 08 '24 07:10 tk512