[REFACTOR]: Continue work on cl.__init__.py refactor#867
Conversation
…option getters and setters. Deprecate cl.array_backend() and cl.auto_sparse()
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #867 +/- ##
==========================================
+ Coverage 87.16% 87.17% +0.01%
==========================================
Files 86 86
Lines 5047 5051 +4
Branches 648 650 +2
==========================================
+ Hits 4399 4403 +4
Misses 457 457
Partials 191 191
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| pd.Timedelta(1, unit=__dt64_unit__) | ||
| ) | ||
| # Store initial values as defaults. | ||
| self.defaults = copy.deepcopy(vars(self)) |
There was a problem hiding this comment.
_defaults maybe?
and do a hasattr check on _defaults to get rid of the bugbot comment?
There was a problem hiding this comment.
I switched it to _defaults and then excluded names beginning with an underscore from the dict. Also did small work on #567, since I noticed there was nothing on top of the file. This is the overall package-level __init__.py so I did a generic description.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 17953c3. Configure here.

Summary of Changes
Related GitHub Issue(s)
#861
#858
#860
#859
Additional Context for Reviewers
It was hard to do this cleanly in multiple PRs, so I hope you can follow this. I found that aside from deprecating 2 functions, the other sub-items were intertwined.
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Changes affect global datetime handling and package-level configuration used across triangle valuation and utilities; removing deprecated helpers is a breaking API change for callers still using cl.array_backend() or cl.auto_sparse().
Overview
This refactor tightens package configuration in
chainladder.__init__: Pandas-derived datetime dtype/unit are now module-level__dt64_dtype__and__dt64_unit__(for Pandas 2/3 compatibility), notOptionsfields.Optionsgains_validate_optionon get/set/reset, a_defaultssnapshot, andreset_option(option)to restore one setting or all defaults.cl.array_backend()andcl.auto_sparse()are removed in favor ofchainladder.options.set_option.Triangle valuation and date helpers in
core/base.py,core/pandas.py, andutils/utility_functions.pynow use the module constants instead ofoptions.DT64_*. Tests were updated accordingly (including single-option reset and invalid-option errors).Reviewed by Cursor Bugbot for commit 8030ac6. Bugbot is set up for automated code reviews on this repo. Configure here.