Skip to content

Commit d5cfe2c

Browse files
authored
move image and text imports out of top level (avoid cv dependencies) (#31)
1 parent ee3d16c commit d5cfe2c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/datachain/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
from datachain.lib.feature import Feature
33
from datachain.lib.feature_utils import pydantic_to_feature
44
from datachain.lib.file import File, FileError, FileFeature, IndexedFile, TarVFile
5-
from datachain.lib.image import ImageFile, convert_images
6-
from datachain.lib.text import convert_text
75
from datachain.lib.udf import Aggregator, Generator, Mapper
86
from datachain.lib.utils import AbstractUDF, DataChainError
97
from datachain.query.dataset import UDF as BaseUDF # noqa: N811
@@ -23,12 +21,9 @@
2321
"FileError",
2422
"FileFeature",
2523
"Generator",
26-
"ImageFile",
2724
"IndexedFile",
2825
"Mapper",
2926
"Session",
3027
"TarVFile",
31-
"convert_images",
32-
"convert_text",
3328
"pydantic_to_feature",
3429
]

src/datachain/image/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from datachain.lib.image import ImageFile, convert_images
2+
3+
__all__ = ["ImageFile", "convert_images"]

src/datachain/text/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from datachain.lib.text import convert_text
2+
3+
__all__ = ["convert_text"]

tests/unit/test_module_exports.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ def test_module_exports():
1818
FileError,
1919
FileFeature,
2020
Generator,
21-
ImageFile,
2221
IndexedFile,
2322
Mapper,
2423
Session,
2524
TarVFile,
26-
convert_images,
27-
convert_text,
2825
pydantic_to_feature,
2926
)
27+
from datachain.image import ImageFile, convert_images
28+
from datachain.text import convert_text
3029
except Exception as e: # noqa: BLE001
3130
pytest.fail(f"Importing raised an exception: {e}")

0 commit comments

Comments
 (0)