metaxy 0.0.1.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaxy/__init__.py +170 -0
- metaxy/_packaging.py +96 -0
- metaxy/_testing/__init__.py +55 -0
- metaxy/_testing/config.py +43 -0
- metaxy/_testing/metaxy_project.py +780 -0
- metaxy/_testing/models.py +111 -0
- metaxy/_testing/parametric/__init__.py +13 -0
- metaxy/_testing/parametric/metadata.py +664 -0
- metaxy/_testing/pytest_helpers.py +74 -0
- metaxy/_testing/runbook.py +533 -0
- metaxy/_utils.py +35 -0
- metaxy/_version.py +1 -0
- metaxy/cli/app.py +97 -0
- metaxy/cli/console.py +13 -0
- metaxy/cli/context.py +167 -0
- metaxy/cli/graph.py +610 -0
- metaxy/cli/graph_diff.py +290 -0
- metaxy/cli/list.py +46 -0
- metaxy/cli/metadata.py +317 -0
- metaxy/cli/migrations.py +999 -0
- metaxy/cli/utils.py +268 -0
- metaxy/config.py +680 -0
- metaxy/entrypoints.py +296 -0
- metaxy/ext/__init__.py +1 -0
- metaxy/ext/dagster/__init__.py +54 -0
- metaxy/ext/dagster/constants.py +10 -0
- metaxy/ext/dagster/dagster_type.py +156 -0
- metaxy/ext/dagster/io_manager.py +200 -0
- metaxy/ext/dagster/metaxify.py +512 -0
- metaxy/ext/dagster/observable.py +115 -0
- metaxy/ext/dagster/resources.py +27 -0
- metaxy/ext/dagster/selection.py +73 -0
- metaxy/ext/dagster/table_metadata.py +417 -0
- metaxy/ext/dagster/utils.py +462 -0
- metaxy/ext/sqlalchemy/__init__.py +23 -0
- metaxy/ext/sqlalchemy/config.py +29 -0
- metaxy/ext/sqlalchemy/plugin.py +353 -0
- metaxy/ext/sqlmodel/__init__.py +13 -0
- metaxy/ext/sqlmodel/config.py +29 -0
- metaxy/ext/sqlmodel/plugin.py +499 -0
- metaxy/graph/__init__.py +29 -0
- metaxy/graph/describe.py +325 -0
- metaxy/graph/diff/__init__.py +21 -0
- metaxy/graph/diff/diff_models.py +446 -0
- metaxy/graph/diff/differ.py +769 -0
- metaxy/graph/diff/models.py +443 -0
- metaxy/graph/diff/rendering/__init__.py +18 -0
- metaxy/graph/diff/rendering/base.py +323 -0
- metaxy/graph/diff/rendering/cards.py +188 -0
- metaxy/graph/diff/rendering/formatter.py +805 -0
- metaxy/graph/diff/rendering/graphviz.py +246 -0
- metaxy/graph/diff/rendering/mermaid.py +326 -0
- metaxy/graph/diff/rendering/rich.py +169 -0
- metaxy/graph/diff/rendering/theme.py +48 -0
- metaxy/graph/diff/traversal.py +247 -0
- metaxy/graph/status.py +329 -0
- metaxy/graph/utils.py +58 -0
- metaxy/metadata_store/__init__.py +32 -0
- metaxy/metadata_store/_ducklake_support.py +419 -0
- metaxy/metadata_store/base.py +1792 -0
- metaxy/metadata_store/bigquery.py +354 -0
- metaxy/metadata_store/clickhouse.py +184 -0
- metaxy/metadata_store/delta.py +371 -0
- metaxy/metadata_store/duckdb.py +446 -0
- metaxy/metadata_store/exceptions.py +61 -0
- metaxy/metadata_store/ibis.py +542 -0
- metaxy/metadata_store/lancedb.py +391 -0
- metaxy/metadata_store/memory.py +292 -0
- metaxy/metadata_store/system/__init__.py +57 -0
- metaxy/metadata_store/system/events.py +264 -0
- metaxy/metadata_store/system/keys.py +9 -0
- metaxy/metadata_store/system/models.py +129 -0
- metaxy/metadata_store/system/storage.py +957 -0
- metaxy/metadata_store/types.py +10 -0
- metaxy/metadata_store/utils.py +104 -0
- metaxy/metadata_store/warnings.py +36 -0
- metaxy/migrations/__init__.py +32 -0
- metaxy/migrations/detector.py +291 -0
- metaxy/migrations/executor.py +516 -0
- metaxy/migrations/generator.py +319 -0
- metaxy/migrations/loader.py +231 -0
- metaxy/migrations/models.py +528 -0
- metaxy/migrations/ops.py +447 -0
- metaxy/models/__init__.py +0 -0
- metaxy/models/bases.py +12 -0
- metaxy/models/constants.py +139 -0
- metaxy/models/feature.py +1335 -0
- metaxy/models/feature_spec.py +338 -0
- metaxy/models/field.py +263 -0
- metaxy/models/fields_mapping.py +307 -0
- metaxy/models/filter_expression.py +297 -0
- metaxy/models/lineage.py +285 -0
- metaxy/models/plan.py +232 -0
- metaxy/models/types.py +475 -0
- metaxy/py.typed +0 -0
- metaxy/utils/__init__.py +1 -0
- metaxy/utils/constants.py +2 -0
- metaxy/utils/exceptions.py +23 -0
- metaxy/utils/hashing.py +230 -0
- metaxy/versioning/__init__.py +31 -0
- metaxy/versioning/engine.py +656 -0
- metaxy/versioning/feature_dep_transformer.py +151 -0
- metaxy/versioning/ibis.py +249 -0
- metaxy/versioning/lineage_handler.py +205 -0
- metaxy/versioning/polars.py +189 -0
- metaxy/versioning/renamed_df.py +35 -0
- metaxy/versioning/types.py +63 -0
- metaxy-0.0.1.dev3.dist-info/METADATA +96 -0
- metaxy-0.0.1.dev3.dist-info/RECORD +111 -0
- metaxy-0.0.1.dev3.dist-info/WHEEL +4 -0
- metaxy-0.0.1.dev3.dist-info/entry_points.txt +4 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Testing models for Metaxy.
|
|
2
|
+
|
|
3
|
+
This module contains testing-specific implementations of core Metaxy classes
|
|
4
|
+
that are designed for testing and examples, not production use.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from collections.abc import Mapping, Sequence
|
|
10
|
+
from typing import TYPE_CHECKING, Annotated, Any, Literal, TypeAlias, overload
|
|
11
|
+
|
|
12
|
+
import pydantic
|
|
13
|
+
from pydantic import BeforeValidator
|
|
14
|
+
|
|
15
|
+
from metaxy.models.feature import BaseFeature
|
|
16
|
+
from metaxy.models.feature_spec import FeatureSpec
|
|
17
|
+
from metaxy.models.field import FieldSpec
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from pydantic.types import JsonValue
|
|
21
|
+
|
|
22
|
+
from metaxy.models.feature_spec import (
|
|
23
|
+
CoercibleToFeatureDep,
|
|
24
|
+
FeatureDep,
|
|
25
|
+
IDColumns,
|
|
26
|
+
)
|
|
27
|
+
from metaxy.models.types import CoercibleToFeatureKey
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Type aliases
|
|
31
|
+
DefaultFeatureCols: TypeAlias = tuple[Literal["sample_uid"],]
|
|
32
|
+
TestingUIDCols: TypeAlias = list[str]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _validate_sample_feature_spec_id_columns(
|
|
36
|
+
value: Any,
|
|
37
|
+
) -> list[str]:
|
|
38
|
+
"""Coerce id_columns to list for SampleFeatureSpec."""
|
|
39
|
+
if value is None:
|
|
40
|
+
return ["sample_uid"]
|
|
41
|
+
if isinstance(value, list):
|
|
42
|
+
return value
|
|
43
|
+
return list(value)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class SampleFeatureSpec(FeatureSpec):
|
|
47
|
+
"""A testing implementation of FeatureSpec that has a `sample_uid` ID column. Has to be moved to tests."""
|
|
48
|
+
|
|
49
|
+
id_columns: Annotated[ # pyright: ignore[reportIncompatibleVariableOverride]
|
|
50
|
+
pydantic.SkipValidation[list[str]],
|
|
51
|
+
BeforeValidator(_validate_sample_feature_spec_id_columns),
|
|
52
|
+
] = pydantic.Field(
|
|
53
|
+
default_factory=lambda: ["sample_uid"],
|
|
54
|
+
description="List of columns that uniquely identify a row. They will be used by Metaxy in joins.",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
if TYPE_CHECKING:
|
|
58
|
+
# Overload for common case: list of FeatureDep instances
|
|
59
|
+
@overload
|
|
60
|
+
def __init__(
|
|
61
|
+
self,
|
|
62
|
+
*,
|
|
63
|
+
key: CoercibleToFeatureKey,
|
|
64
|
+
id_columns: IDColumns | None = None,
|
|
65
|
+
deps: list[FeatureDep] | None = None,
|
|
66
|
+
fields: Sequence[str | FieldSpec] | None = None,
|
|
67
|
+
metadata: Mapping[str, JsonValue] | None = None,
|
|
68
|
+
**kwargs: Any,
|
|
69
|
+
) -> None: ...
|
|
70
|
+
|
|
71
|
+
@overload
|
|
72
|
+
def __init__(
|
|
73
|
+
self,
|
|
74
|
+
*,
|
|
75
|
+
key: CoercibleToFeatureKey,
|
|
76
|
+
id_columns: IDColumns | None = None,
|
|
77
|
+
deps: list[CoercibleToFeatureDep] | None = None,
|
|
78
|
+
fields: Sequence[str | FieldSpec] | None = None,
|
|
79
|
+
metadata: Mapping[str, JsonValue] | None = None,
|
|
80
|
+
**kwargs: Any,
|
|
81
|
+
) -> None: ...
|
|
82
|
+
|
|
83
|
+
# Implementation signature
|
|
84
|
+
def __init__( # pyright: ignore[reportMissingSuperCall]
|
|
85
|
+
self,
|
|
86
|
+
*,
|
|
87
|
+
key: CoercibleToFeatureKey,
|
|
88
|
+
id_columns: IDColumns | None = None,
|
|
89
|
+
deps: list[FeatureDep] | list[CoercibleToFeatureDep] | None = None,
|
|
90
|
+
fields: Sequence[str | FieldSpec] | None = None,
|
|
91
|
+
metadata: Mapping[str, JsonValue] | None = None,
|
|
92
|
+
**kwargs: Any,
|
|
93
|
+
) -> None: ... # pyright: ignore[reportMissingSuperCall]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class SampleFeature(BaseFeature, spec=None):
|
|
97
|
+
"""A testing implementation of BaseFeature with a sample_uid field.
|
|
98
|
+
|
|
99
|
+
A default specialization of BaseFeature that uses a `sample_uid` ID column.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
__test__ = False # Prevent pytest from collecting this as a test class
|
|
103
|
+
sample_uid: str | None = None
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
__all__ = [
|
|
107
|
+
"DefaultFeatureCols",
|
|
108
|
+
"TestingUIDCols",
|
|
109
|
+
"SampleFeatureSpec",
|
|
110
|
+
"SampleFeature",
|
|
111
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Parametric testing utilities for property-based testing with Hypothesis."""
|
|
2
|
+
|
|
3
|
+
from metaxy._testing.parametric.metadata import (
|
|
4
|
+
downstream_metadata_strategy,
|
|
5
|
+
feature_metadata_strategy,
|
|
6
|
+
upstream_metadata_strategy,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"downstream_metadata_strategy",
|
|
11
|
+
"feature_metadata_strategy",
|
|
12
|
+
"upstream_metadata_strategy",
|
|
13
|
+
]
|