Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add top module exports #23

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/datachain/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an internal class, I don't think it should be exposed at the top-level.

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",
]
31 changes: 31 additions & 0 deletions tests/unit/test_module_exports.py
Original file line number Diff line number Diff line change
@@ -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}")
Loading