arthur-common 1.0.1__py3-none-any.whl → 2.1.48__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.

Potentially problematic release.


This version of arthur-common might be problematic. Click here for more details.

@@ -4,7 +4,6 @@ from pydantic import BaseModel, Field
4
4
  class ConnectorPaginationOptions(BaseModel):
5
5
  page: int = Field(default=1, ge=1)
6
6
  page_size: int = Field(default=25, gt=0, le=500)
7
- # comment to run pipeline
8
7
 
9
8
  @property
10
9
  def page_params(self) -> tuple[int, int]:
@@ -30,6 +29,12 @@ GOOGLE_CONNECTOR_PROJECT_ID_FIELD = "project_id"
30
29
  GOOGLE_CONNECTOR_LOCATION_FIELD = "location"
31
30
  SHIELD_CONNECTOR_API_KEY_FIELD = "api_key"
32
31
  SHIELD_CONNECTOR_ENDPOINT_FIELD = "endpoint"
32
+ MSSQL_CONNECTOR_HOST_FIELD = "host"
33
+ MSSQL_CONNECTOR_PORT_FIELD = "port"
34
+ MSSQL_CONNECTOR_DATABASE_FIELD = "database"
35
+ MSSQL_CONNECTOR_USERNAME_FIELD = "username"
36
+ MSSQL_CONNECTOR_PASSWORD_FIELD = "password"
37
+ MSSQL_CONNECTOR_DRIVER_FIELD = "driver"
33
38
 
34
39
  # dataset (connector type dependent) constants
35
40
  SHIELD_DATASET_TASK_ID_FIELD = "task_id"
@@ -166,7 +166,7 @@ class MetricsColumnParameterSchema(MetricsParameterSchema):
166
166
 
167
167
 
168
168
  # Not used /implemented yet. Might turn into group by column list
169
- class MetricsColumnListParameterSchema(MetricsParameterSchema):
169
+ class MetricsColumnListParameterSchema(MetricsColumnParameterSchema):
170
170
  parameter_type: Literal["column_list"] = "column_list"
171
171
 
172
172
 
@@ -202,13 +202,6 @@ class AggregationSpecSchema(BaseModel):
202
202
  description="List of parameters to the aggregation's aggregate function.",
203
203
  )
204
204
 
205
- def parameter_is_column_reference(self, parameter_name: str) -> bool:
206
- return any(
207
- param.parameter_key == parameter_name
208
- and isinstance(param, MetricsColumnParameterSchema)
209
- for param in self.aggregate_args
210
- )
211
-
212
205
  @model_validator(mode="after")
213
206
  def column_dataset_references_exist(self) -> Self:
214
207
  dataset_parameter_keys = [
@@ -218,7 +211,10 @@ class AggregationSpecSchema(BaseModel):
218
211
  ]
219
212
  for param in self.aggregate_args:
220
213
  if (
221
- isinstance(param, MetricsColumnParameterSchema)
214
+ isinstance(
215
+ param,
216
+ (MetricsColumnParameterSchema, MetricsColumnListParameterSchema),
217
+ )
222
218
  and param.source_dataset_parameter_key not in dataset_parameter_keys
223
219
  ):
224
220
  raise ValueError(
@@ -17,6 +17,7 @@ class ScopeSchemaTag(str, Enum):
17
17
  CONTINUOUS = "continuous"
18
18
  PREDICTION = "prediction"
19
19
  GROUND_TRUTH = "ground_truth"
20
+ PIN_IN_DEEP_DIVE = "pin_in_deep_dive"
20
21
 
21
22
 
22
23
  class DType(str, Enum):
@@ -29,6 +30,7 @@ class DType(str, Enum):
29
30
  TIMESTAMP = "timestamp"
30
31
  DATE = "date"
31
32
  JSON = "json"
33
+ IMAGE = "image"
32
34
 
33
35
 
34
36
  class MetricParameterAnnotation(BaseModel):
@@ -13,6 +13,7 @@ from arthur_common.models.metrics import (
13
13
  AggregationMetricType,
14
14
  AggregationSpecSchema,
15
15
  DatasetReference,
16
+ MetricsColumnListParameterSchema,
16
17
  MetricsColumnParameterSchema,
17
18
  MetricsDatasetParameterSchema,
18
19
  MetricsLiteralParameterSchema,
@@ -23,6 +24,7 @@ from arthur_common.models.schema_definitions import (
23
24
  MetricColumnParameterAnnotation,
24
25
  MetricDatasetParameterAnnotation,
25
26
  MetricLiteralParameterAnnotation,
27
+ MetricMultipleColumnParameterAnnotation,
26
28
  MetricsParameterAnnotationUnion,
27
29
  )
28
30
 
@@ -44,6 +46,19 @@ class FunctionAnalyzer:
44
46
  return DType.UUID
45
47
  elif t is DatasetReference:
46
48
  return DType.UUID
49
+ elif typing.get_origin(t) is list:
50
+ return DType.JSON
51
+ elif typing.get_origin(t) is typing.Union:
52
+ # handle union types to add support for Optional types only
53
+ # extract the non-None type from Optional[T] = Union[T, None]
54
+ args = typing.get_args(t)
55
+ non_none_args = [arg for arg in args if arg is not type(None)]
56
+ if len(non_none_args) == 1:
57
+ return FunctionAnalyzer._python_type_to_scope_dtype(non_none_args[0])
58
+ else:
59
+ raise ValueError(
60
+ f"Union type {t} is not supported (only Optional[T] is supported).",
61
+ )
47
62
  else:
48
63
  raise ValueError(f"Parameter type {t} is not supported.")
49
64
 
@@ -69,7 +84,7 @@ class FunctionAnalyzer:
69
84
  @staticmethod
70
85
  def _get_scope_metric_parameter_from_annotation(
71
86
  param_name: str,
72
- param_dtype: DType,
87
+ param_dtype: typing.Optional[DType],
73
88
  optional: bool,
74
89
  annotation: typing.Annotated, # type: ignore
75
90
  ) -> MetricsParameterSchemaUnion:
@@ -101,6 +116,21 @@ class FunctionAnalyzer:
101
116
  description=annotation.description,
102
117
  model_problem_type=annotation.model_problem_type,
103
118
  )
119
+ elif isinstance(annotation, MetricMultipleColumnParameterAnnotation):
120
+ if param_dtype != DType.JSON:
121
+ raise ValueError(
122
+ f"Dataset parameter {param_name} has type {param_dtype}, but should be a JSON type (valid list expected).",
123
+ )
124
+ return MetricsColumnListParameterSchema(
125
+ parameter_key=param_name,
126
+ tag_hints=annotation.tag_hints,
127
+ optional=optional,
128
+ source_dataset_parameter_key=annotation.source_dataset_parameter_key,
129
+ allowed_column_types=annotation.allowed_column_types,
130
+ allow_any_column_type=annotation.allow_any_column_type,
131
+ friendly_name=annotation.friendly_name,
132
+ description=annotation.description,
133
+ )
104
134
  elif isinstance(annotation, MetricColumnParameterAnnotation):
105
135
  if param_dtype != DType.STRING:
106
136
  raise ValueError(
@@ -291,7 +291,7 @@ def _make_schema(
291
291
  return "DOUBLE"
292
292
  case DType.BOOL:
293
293
  return "BOOLEAN"
294
- case DType.STRING:
294
+ case DType.STRING | DType.IMAGE:
295
295
  return "VARCHAR"
296
296
  case DType.UUID:
297
297
  return "UUID"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arthur-common
3
- Version: 1.0.1
3
+ Version: 2.1.48
4
4
  Summary: Utility code common to Arthur platform components.
5
5
  License: MIT
6
6
  Author: Arthur
@@ -69,6 +69,3 @@ This project is licensed under the MIT License.
69
69
 
70
70
  - Arthur <engineering@arthur.ai>
71
71
 
72
- # ALEX
73
- - Change for testing
74
-
@@ -1,40 +1,39 @@
1
1
  arthur_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- arthur_common/__version__.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
3
2
  arthur_common/aggregations/__init__.py,sha256=vISWyciQAtksa71OKeHNP-QyFGd1NzBKq_LBsG0QSG8,67
4
- arthur_common/aggregations/aggregator.py,sha256=cw6mr1Dl0sH7Rn_EggCRvduC7GvC8XTDP2L84FODKY0,7445
3
+ arthur_common/aggregations/aggregator.py,sha256=8J0TRYjQdwf0qXBnoZ4ETJVCdo4UIyvQnBTZCypY7Fo,7713
5
4
  arthur_common/aggregations/functions/README.md,sha256=MkZoTAJ94My96R5Z8GAxud7S6vyR0vgVi9gqdt9a4XY,5460
6
5
  arthur_common/aggregations/functions/__init__.py,sha256=HqC3UNRURX7ZQHgamTrQvfA8u_FiZGZ4I4eQW7Ooe5o,1299
7
- arthur_common/aggregations/functions/categorical_count.py,sha256=_hk1TYkrnCAe-0Hflt4W3Nvrp-c-vWHSgVxaqcFNWAI,3368
8
- arthur_common/aggregations/functions/confusion_matrix.py,sha256=xqJkwcFZck_F1tsvMeJdmU-EOSOfWJS_N7-PXYJiSmo,16351
9
- arthur_common/aggregations/functions/inference_count.py,sha256=BGWa262UxpkqY5Y_Pm22URSRvwXzdRbGUcd4DSVJbN0,2312
10
- arthur_common/aggregations/functions/inference_count_by_class.py,sha256=BwZw8wCmFHRoau5oDgcDAkcwNhXjktFBCG1Sfsj6iGY,7830
11
- arthur_common/aggregations/functions/inference_null_count.py,sha256=wZDz89_23bGjB_Tb3ob_69_VhugFxzbSRkuENfyJ-ic,2867
12
- arthur_common/aggregations/functions/mean_absolute_error.py,sha256=rDEQlKEDyy_zRewtgthB_BK2oKrW6ymWmdtkxUFzfW8,4233
13
- arthur_common/aggregations/functions/mean_squared_error.py,sha256=TMUyPPPEHuG9QFmD2gZxmxy-f_CDU4ds_2R5-DFr42c,4251
14
- arthur_common/aggregations/functions/multiclass_confusion_matrix.py,sha256=QM27MhZMvF5Q5yxENSsHx_MMV_5h6eiRPP554jsdBqY,8204
15
- arthur_common/aggregations/functions/multiclass_inference_count_by_class.py,sha256=dmf4OI4KcFVvE61S2TnPZvBlNOhlFNFKrV7x2_ys5ZU,3201
16
- arthur_common/aggregations/functions/numeric_stats.py,sha256=eN1q10KquF8GeBOOktBuatV9Zxvd_--ZzklqzDpT9qw,3124
17
- arthur_common/aggregations/functions/numeric_sum.py,sha256=DO7jbmUEnyyJliEtYLHb58SDCVBTsFKvywFnADXFpw8,3036
6
+ arthur_common/aggregations/functions/categorical_count.py,sha256=W0xIpqqSElRpGBPpvztoZBpDO5QtiGYpaMVOQ3piS-4,5077
7
+ arthur_common/aggregations/functions/confusion_matrix.py,sha256=fZ5SeFcENjGyoCqecRTF9Y0Ub-RzsA-SlZ8cEHzUvnM,21111
8
+ arthur_common/aggregations/functions/inference_count.py,sha256=jIhuh_NjL82NA84qJD2VI3FVRgZCSFjfcME3Hr_slpg,3832
9
+ arthur_common/aggregations/functions/inference_count_by_class.py,sha256=JKTOhXSP3hBz28u10AvA8OyDi7P68Fv7NP6j_M7kXCQ,11066
10
+ arthur_common/aggregations/functions/inference_null_count.py,sha256=l-yuVX7OJQGk-vvnkuXJPD-mEI1ZzwGjbzeihwSDT_M,4566
11
+ arthur_common/aggregations/functions/mean_absolute_error.py,sha256=pgputW69w0DUT4xbj2nfnPpqliHZAtvh7TQnBfPQ584,6000
12
+ arthur_common/aggregations/functions/mean_squared_error.py,sha256=o9TTdlBb1lX57kWqoMRdTNacXcEa_VH-AkfT6SL1xGs,6032
13
+ arthur_common/aggregations/functions/multiclass_confusion_matrix.py,sha256=47CVl-Wo40jDeKvSKHeWB2DFFTDo_ichXPGyMmlVEmo,10973
14
+ arthur_common/aggregations/functions/multiclass_inference_count_by_class.py,sha256=gLdjXKvQ_WDscc3zksH92LGHhuknkjf6oAF63-cwbJo,3978
15
+ arthur_common/aggregations/functions/numeric_stats.py,sha256=9zyroFSYXXELnz4MKow8v06-tPVL23COVafoLHaHgVc,4676
16
+ arthur_common/aggregations/functions/numeric_sum.py,sha256=f0ZIYqPjBsyCh-V8ktHpDIs1_4wjjPENboC607i5O3c,4785
18
17
  arthur_common/aggregations/functions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
18
  arthur_common/aggregations/functions/shield_aggregations.py,sha256=nkMlj9V7NIKeRP46jpsrlfB741RHk2CgwimD7BYp9To,31540
20
19
  arthur_common/aggregations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
20
  arthur_common/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- arthur_common/models/connectors.py,sha256=Ng2hwXQumfLE9SYepYZs2L5Y6aAIXAQfkJIa0rKCvWQ,1565
21
+ arthur_common/models/connectors.py,sha256=hj8epo32MjtDgWGon1U4l__Ls6pf8nFp2v_jrUYUTCI,1799
23
22
  arthur_common/models/datasets.py,sha256=giG_8mv_3ilBf7cIvRV0_TDCDdb4qxRbYZvl7hRb6l8,491
24
- arthur_common/models/metrics.py,sha256=gFEGuM4kuac2CqpPN69BM2cWG-SUPE4-1jZVHv_M3M0,8380
23
+ arthur_common/models/metrics.py,sha256=ZfsDL3aPdhZ1-E1-wlRyZT4lZNzz2A3qL-jDrqJbQdY,8217
25
24
  arthur_common/models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- arthur_common/models/schema_definitions.py,sha256=MiM-oynqh71zZvVyM-XF5nN55dgOeqEajVyL8ZE3Wuo,14571
25
+ arthur_common/models/schema_definitions.py,sha256=WBJ6JvBCvThlMBGQsbiAwi9QYjhG9KyURyjE8an8-yE,14633
27
26
  arthur_common/models/shield.py,sha256=1ZblfULKCf5BEvYURO5WScyfmijGwjAmcj0XADlF-XY,19110
28
27
  arthur_common/models/task_job_specs.py,sha256=GLJ7qmrb5eXnl5PiV27nnx_yG4S4sc4NDJ8-6xmNDLM,2796
29
28
  arthur_common/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
29
  arthur_common/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- arthur_common/tools/aggregation_analyzer.py,sha256=e4F8vsYDRRTzUmNVIl1vFrn9_nEeYDYcP3ygk7i1964,9534
30
+ arthur_common/tools/aggregation_analyzer.py,sha256=IOpGfj-aihjUNo_L5iI47x2EuJWXAW0FKOUMzNca7ek,11130
32
31
  arthur_common/tools/aggregation_loader.py,sha256=3CF46bNi-GdJBNOXkjYfCQ1Aung8lf65L532sdWmR_s,2351
33
- arthur_common/tools/duckdb_data_loader.py,sha256=XrdXRFkgiGtYulOGsC4khVf12sNiSFx5hB5vD7vQzFE,11066
32
+ arthur_common/tools/duckdb_data_loader.py,sha256=ywvFpI1qioK5Is-S7XxBqgQmQNY6u21qibKygTAW0Oo,11080
34
33
  arthur_common/tools/functions.py,sha256=FWL4eWO5-vLp86WudT-MGUKvf2B8f02IdoXQFKd6d8k,1093
35
34
  arthur_common/tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
35
  arthur_common/tools/schema_inferer.py,sha256=PkAOHZRk_rZ1OZSigYrfzH-jERb9B_Gu7pOMl9WJQA8,4202
37
36
  arthur_common/tools/time_utils.py,sha256=4gfiu9NXfvPZltiVNLSIQGylX6h2W0viNi9Kv4bKyfw,1410
38
- arthur_common-1.0.1.dist-info/METADATA,sha256=WrMAk42ZfTrZhAz12r127fJhuglMx-zHnDXPMp7tzsk,1596
39
- arthur_common-1.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
40
- arthur_common-1.0.1.dist-info/RECORD,,
37
+ arthur_common-2.1.48.dist-info/METADATA,sha256=seHFqwRDe2hVB1k-mNZRKd2ZgdOMNAhJjfzh8srCkk8,1568
38
+ arthur_common-2.1.48.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
39
+ arthur_common-2.1.48.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- __version__ = "1.0.1"