From eaac498307dc8f2b09efc45fb8651ac7e6b60cec Mon Sep 17 00:00:00 2001 From: Deepyaman Datta Date: Sun, 23 Jul 2023 20:19:05 -0500 Subject: [PATCH] perf(datasets): lazily load datasets in init files (dask) Signed-off-by: Deepyaman Datta --- kedro-datasets/kedro_datasets/dask/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kedro-datasets/kedro_datasets/dask/__init__.py b/kedro-datasets/kedro_datasets/dask/__init__.py index d93bf4c63..cd8d04120 100644 --- a/kedro-datasets/kedro_datasets/dask/__init__.py +++ b/kedro-datasets/kedro_datasets/dask/__init__.py @@ -1,8 +1,11 @@ """Provides I/O modules using dask dataframe.""" +from typing import Any -__all__ = ["ParquetDataSet"] +import lazy_loader as lazy -from contextlib import suppress +# https://github.com/pylint-dev/pylint/issues/4300#issuecomment-1043601901 +ParquetDataSet: Any -with suppress(ImportError): - from .parquet_dataset import ParquetDataSet +__getattr__, __dir__, __all__ = lazy.attach( + __name__, submod_attrs={"parquet_dataset": ["ParquetDataSet"]} +)