Skip to content

[REFACTOR] Clean up chainladder.__init__.py #856

@genedan

Description

@genedan

Description

Currently working on this, I was trying to clean up some repetitive code:

_DT64_DTYPE = pd.to_datetime(["2000-01-01"]).dtype
_ULT_VAL: str = str(
pd.Timestamp("2262-01-01") - \
pd.Timedelta(1, unit=np.datetime_data(_DT64_DTYPE)[0])
)
class Options:
ARRAY_BACKEND = "numpy"
AUTO_SPARSE = True
ARRAY_PRIORITY = ["dask", "sparse", "cupy", "numpy"]
ULT_VAL: str = _ULT_VAL
DT64_UNIT: str = np.datetime_data(_DT64_DTYPE)[0]
DT64_DTYPE: str = str(_DT64_DTYPE)

but this revealed other tasks that we'll have to address via multiple PRs. These would include but are not limited to:

  • validation or deprecation of Options.get_option
  • deprecation of auto_sparse and auto_backend
  • add Options.reset_... for each option.

Is your feature request aligned with the scope of the package?

  • Yes, absolutely!
  • No, but it's still worth discussing.
  • N/A (this request is not a codebase enhancement).

Describe the solution you'd like, or your current workaround.

I will reorganize Options with an init, and set the attributes to be assigned to the instance rather than class.

Do you have any additional supporting notes?

No response

Metadata

Metadata

Assignees

Labels

Effort > Brief 🐇Small tasks expected to take a few hours up to a couple of days.Impact > Minor 🔷Small, backward compatible change. Treat like a patch release (e.g., 0.5.8 → 0.5.9).Refactor 🔧Code level improvements that restructure existing logic without changing behavior.

Type

No fields configured for Task.

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions