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.
Files changed (111) hide show
  1. metaxy/__init__.py +170 -0
  2. metaxy/_packaging.py +96 -0
  3. metaxy/_testing/__init__.py +55 -0
  4. metaxy/_testing/config.py +43 -0
  5. metaxy/_testing/metaxy_project.py +780 -0
  6. metaxy/_testing/models.py +111 -0
  7. metaxy/_testing/parametric/__init__.py +13 -0
  8. metaxy/_testing/parametric/metadata.py +664 -0
  9. metaxy/_testing/pytest_helpers.py +74 -0
  10. metaxy/_testing/runbook.py +533 -0
  11. metaxy/_utils.py +35 -0
  12. metaxy/_version.py +1 -0
  13. metaxy/cli/app.py +97 -0
  14. metaxy/cli/console.py +13 -0
  15. metaxy/cli/context.py +167 -0
  16. metaxy/cli/graph.py +610 -0
  17. metaxy/cli/graph_diff.py +290 -0
  18. metaxy/cli/list.py +46 -0
  19. metaxy/cli/metadata.py +317 -0
  20. metaxy/cli/migrations.py +999 -0
  21. metaxy/cli/utils.py +268 -0
  22. metaxy/config.py +680 -0
  23. metaxy/entrypoints.py +296 -0
  24. metaxy/ext/__init__.py +1 -0
  25. metaxy/ext/dagster/__init__.py +54 -0
  26. metaxy/ext/dagster/constants.py +10 -0
  27. metaxy/ext/dagster/dagster_type.py +156 -0
  28. metaxy/ext/dagster/io_manager.py +200 -0
  29. metaxy/ext/dagster/metaxify.py +512 -0
  30. metaxy/ext/dagster/observable.py +115 -0
  31. metaxy/ext/dagster/resources.py +27 -0
  32. metaxy/ext/dagster/selection.py +73 -0
  33. metaxy/ext/dagster/table_metadata.py +417 -0
  34. metaxy/ext/dagster/utils.py +462 -0
  35. metaxy/ext/sqlalchemy/__init__.py +23 -0
  36. metaxy/ext/sqlalchemy/config.py +29 -0
  37. metaxy/ext/sqlalchemy/plugin.py +353 -0
  38. metaxy/ext/sqlmodel/__init__.py +13 -0
  39. metaxy/ext/sqlmodel/config.py +29 -0
  40. metaxy/ext/sqlmodel/plugin.py +499 -0
  41. metaxy/graph/__init__.py +29 -0
  42. metaxy/graph/describe.py +325 -0
  43. metaxy/graph/diff/__init__.py +21 -0
  44. metaxy/graph/diff/diff_models.py +446 -0
  45. metaxy/graph/diff/differ.py +769 -0
  46. metaxy/graph/diff/models.py +443 -0
  47. metaxy/graph/diff/rendering/__init__.py +18 -0
  48. metaxy/graph/diff/rendering/base.py +323 -0
  49. metaxy/graph/diff/rendering/cards.py +188 -0
  50. metaxy/graph/diff/rendering/formatter.py +805 -0
  51. metaxy/graph/diff/rendering/graphviz.py +246 -0
  52. metaxy/graph/diff/rendering/mermaid.py +326 -0
  53. metaxy/graph/diff/rendering/rich.py +169 -0
  54. metaxy/graph/diff/rendering/theme.py +48 -0
  55. metaxy/graph/diff/traversal.py +247 -0
  56. metaxy/graph/status.py +329 -0
  57. metaxy/graph/utils.py +58 -0
  58. metaxy/metadata_store/__init__.py +32 -0
  59. metaxy/metadata_store/_ducklake_support.py +419 -0
  60. metaxy/metadata_store/base.py +1792 -0
  61. metaxy/metadata_store/bigquery.py +354 -0
  62. metaxy/metadata_store/clickhouse.py +184 -0
  63. metaxy/metadata_store/delta.py +371 -0
  64. metaxy/metadata_store/duckdb.py +446 -0
  65. metaxy/metadata_store/exceptions.py +61 -0
  66. metaxy/metadata_store/ibis.py +542 -0
  67. metaxy/metadata_store/lancedb.py +391 -0
  68. metaxy/metadata_store/memory.py +292 -0
  69. metaxy/metadata_store/system/__init__.py +57 -0
  70. metaxy/metadata_store/system/events.py +264 -0
  71. metaxy/metadata_store/system/keys.py +9 -0
  72. metaxy/metadata_store/system/models.py +129 -0
  73. metaxy/metadata_store/system/storage.py +957 -0
  74. metaxy/metadata_store/types.py +10 -0
  75. metaxy/metadata_store/utils.py +104 -0
  76. metaxy/metadata_store/warnings.py +36 -0
  77. metaxy/migrations/__init__.py +32 -0
  78. metaxy/migrations/detector.py +291 -0
  79. metaxy/migrations/executor.py +516 -0
  80. metaxy/migrations/generator.py +319 -0
  81. metaxy/migrations/loader.py +231 -0
  82. metaxy/migrations/models.py +528 -0
  83. metaxy/migrations/ops.py +447 -0
  84. metaxy/models/__init__.py +0 -0
  85. metaxy/models/bases.py +12 -0
  86. metaxy/models/constants.py +139 -0
  87. metaxy/models/feature.py +1335 -0
  88. metaxy/models/feature_spec.py +338 -0
  89. metaxy/models/field.py +263 -0
  90. metaxy/models/fields_mapping.py +307 -0
  91. metaxy/models/filter_expression.py +297 -0
  92. metaxy/models/lineage.py +285 -0
  93. metaxy/models/plan.py +232 -0
  94. metaxy/models/types.py +475 -0
  95. metaxy/py.typed +0 -0
  96. metaxy/utils/__init__.py +1 -0
  97. metaxy/utils/constants.py +2 -0
  98. metaxy/utils/exceptions.py +23 -0
  99. metaxy/utils/hashing.py +230 -0
  100. metaxy/versioning/__init__.py +31 -0
  101. metaxy/versioning/engine.py +656 -0
  102. metaxy/versioning/feature_dep_transformer.py +151 -0
  103. metaxy/versioning/ibis.py +249 -0
  104. metaxy/versioning/lineage_handler.py +205 -0
  105. metaxy/versioning/polars.py +189 -0
  106. metaxy/versioning/renamed_df.py +35 -0
  107. metaxy/versioning/types.py +63 -0
  108. metaxy-0.0.1.dev3.dist-info/METADATA +96 -0
  109. metaxy-0.0.1.dev3.dist-info/RECORD +111 -0
  110. metaxy-0.0.1.dev3.dist-info/WHEEL +4 -0
  111. 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
+ ]