from metaxy._version import __version__
from metaxy.ext.dagster.cleanup import delete
from metaxy.ext.dagster.constants import (
    DAGSTER_METAXY_FEATURE_METADATA_KEY,
    DAGSTER_METAXY_INFO_METADATA_KEY,
    DAGSTER_METAXY_KIND,
    DAGSTER_METAXY_PARTITION_KEY,
    DAGSTER_METAXY_PROJECT_TAG_KEY,
    METAXY_DAGSTER_METADATA_KEY,
)
from metaxy.ext.dagster.dagster_type import feature_to_dagster_type
from metaxy.ext.dagster.io_manager import MetaxyIOManager, MetaxyOutput
from metaxy.ext.dagster.metaxify import metaxify
from metaxy.ext.dagster.observable import observable_metaxy_asset
from metaxy.ext.dagster.observation_job import (
    build_metaxy_multi_observation_job,
    build_metaxy_observation_job,
)
from metaxy.ext.dagster.resources import MetaxyStoreFromConfigResource
from metaxy.ext.dagster.selection import select_metaxy_assets
from metaxy.ext.dagster.table_metadata import (
    build_column_lineage,
    build_column_schema,
    build_table_preview_metadata,
)
from metaxy.ext.dagster.utils import (
    FeatureStats,
    build_partition_filter,
    compute_feature_stats,
    compute_stats_from_lazy_frame,
    generate_materialize_results,
    generate_observe_results,
    get_partition_filter,
)

try:
    from dagster_shared.libraries import DagsterLibraryRegistry

    DagsterLibraryRegistry.register("metaxy.ext.dagster", __version__, is_dagster_package=False)
except (ImportError, ModuleNotFoundError):
    pass


__all__ = [
    "metaxify",
    "feature_to_dagster_type",
    "build_column_schema",
    "build_column_lineage",
    "build_table_preview_metadata",
    "observable_metaxy_asset",
    "select_metaxy_assets",
    "generate_materialize_results",
    "generate_observe_results",
    "build_metaxy_multi_observation_job",
    "build_metaxy_observation_job",
    "compute_feature_stats",
    "compute_stats_from_lazy_frame",
    "get_partition_filter",
    "build_partition_filter",
    "FeatureStats",
    "MetaxyStoreFromConfigResource",
    "MetaxyIOManager",
    "MetaxyOutput",
    "METAXY_DAGSTER_METADATA_KEY",
    "DAGSTER_METAXY_FEATURE_METADATA_KEY",
    "DAGSTER_METAXY_INFO_METADATA_KEY",
    "DAGSTER_METAXY_KIND",
    "DAGSTER_METAXY_PARTITION_KEY",
    "DAGSTER_METAXY_PROJECT_TAG_KEY",
    "delete",
]
