Skip to content

Commit

Permalink
move image and text imports out of top level (avoid cv dependencies) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shcheklein authored Jul 15, 2024
1 parent ee3d16c commit d5cfe2c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/datachain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
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
Expand All @@ -23,12 +21,9 @@
"FileError",
"FileFeature",
"Generator",
"ImageFile",
"IndexedFile",
"Mapper",
"Session",
"TarVFile",
"convert_images",
"convert_text",
"pydantic_to_feature",
]
3 changes: 3 additions & 0 deletions src/datachain/image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from datachain.lib.image import ImageFile, convert_images

__all__ = ["ImageFile", "convert_images"]
3 changes: 3 additions & 0 deletions src/datachain/text/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from datachain.lib.text import convert_text

__all__ = ["convert_text"]
5 changes: 2 additions & 3 deletions tests/unit/test_module_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ def test_module_exports():
FileError,
FileFeature,
Generator,
ImageFile,
IndexedFile,
Mapper,
Session,
TarVFile,
convert_images,
convert_text,
pydantic_to_feature,
)
from datachain.image import ImageFile, convert_images
from datachain.text import convert_text
except Exception as e: # noqa: BLE001
pytest.fail(f"Importing raised an exception: {e}")

0 comments on commit d5cfe2c

Please sign in to comment.