diff --git a/kedro-datasets/kedro_datasets/api/__init__.py b/kedro-datasets/kedro_datasets/api/__init__.py index ccd799b2c..b8dcef6a8 100644 --- a/kedro-datasets/kedro_datasets/api/__init__.py +++ b/kedro-datasets/kedro_datasets/api/__init__.py @@ -3,9 +3,8 @@ It uses the python requests library: https://requests.readthedocs.io/en/latest/ """ -__all__ = ["APIDataSet"] +import lazy_loader as lazy -from contextlib import suppress - -with suppress(ImportError): - from .api_dataset import APIDataSet +__getattr__, __dir__, __all__ = lazy.attach( + __name__, submod_attrs={"api_dataset": ["APIDataSet"]} +) diff --git a/kedro-datasets/pyproject.toml b/kedro-datasets/pyproject.toml index d8d1d654c..f478b94b1 100644 --- a/kedro-datasets/pyproject.toml +++ b/kedro-datasets/pyproject.toml @@ -11,7 +11,8 @@ description = "Kedro-Datasets is where you can find all of Kedro's data connecto requires-python = ">=3.7, <3.11" license = {text = "Apache Software License (Apache 2.0)"} dependencies = [ - "kedro>=0.16" + "kedro>=0.16", + "lazy_loader", ] dynamic = ["readme", "version"]