From bf5e718621f5f57f4009b49ebd0e7b3774604c45 Mon Sep 17 00:00:00 2001 From: Matt Seddon Date: Fri, 12 Jul 2024 15:43:07 +1000 Subject: [PATCH] add top module exports --- src/datachain/__init__.py | 34 +++++++++++++++++++++++++++++++ tests/unit/test_module_exports.py | 31 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 tests/unit/test_module_exports.py diff --git a/src/datachain/__init__.py b/src/datachain/__init__.py index e69de29bb..0242cdbdd 100644 --- a/src/datachain/__init__.py +++ b/src/datachain/__init__.py @@ -0,0 +1,34 @@ +from datachain.lib.dc import C, DataChain +from datachain.lib.feature import Feature +from datachain.lib.feature_utils import pydantic_to_feature +from datachain.lib.file import File, FileError, FileFeature, IndexedFile, TarVFile +from datachain.lib.image import ImageFile, convert_images +from datachain.lib.text import convert_text +from datachain.lib.udf import Aggregator, Generator, Mapper +from datachain.lib.utils import AbstractUDF, DataChainError +from datachain.query.dataset import UDF as BaseUDF # noqa: N811 +from datachain.query.schema import Column +from datachain.query.session import Session + +__all__ = [ + "AbstractUDF", + "Aggregator", + "BaseUDF", + "C", + "Column", + "DataChain", + "DataChainError", + "Feature", + "File", + "FileError", + "FileFeature", + "Generator", + "ImageFile", + "IndexedFile", + "Mapper", + "Session", + "TarVFile", + "convert_images", + "convert_text", + "pydantic_to_feature", +] diff --git a/tests/unit/test_module_exports.py b/tests/unit/test_module_exports.py new file mode 100644 index 000000000..77aec6dea --- /dev/null +++ b/tests/unit/test_module_exports.py @@ -0,0 +1,31 @@ +# flake8: noqa: F401 + +import pytest + + +def test_module_exports(): + try: + from datachain import ( + AbstractUDF, + Aggregator, + BaseUDF, + C, + Column, + DataChain, + DataChainError, + Feature, + File, + FileError, + FileFeature, + Generator, + ImageFile, + IndexedFile, + Mapper, + Session, + TarVFile, + convert_images, + convert_text, + pydantic_to_feature, + ) + except Exception as e: # noqa: BLE001 + pytest.fail(f"Importing raised an exception: {e}")