chalkpy 2.95.1__py3-none-any.whl → 2.95.2__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.
@@ -18,7 +18,7 @@ from chalk._gen.chalk.common.v1 import chalk_error_pb2 as chalk_dot_common_dot_v
18
18
 
19
19
 
20
20
  DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
21
- b'\n1chalk/streaming/v1/simple_streaming_service.proto\x12\x12\x63halk.streaming.v1\x1a\x1f\x63halk/auth/v1/permissions.proto\x1a!chalk/common/v1/chalk_error.proto"\xa0\x01\n\x0eStreamingError\x12\x31\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x1b.chalk.common.v1.ChalkErrorR\x05\x65rror\x12\x38\n\x05phase\x18\x02 \x01(\x0e\x32".chalk.streaming.v1.ExecutionPhaseR\x05phase\x12!\n\x0coperation_id\x18\x03 \x01(\tR\x0boperationId"\xd6\x01\n!SimpleStreamingUnaryInvokeRequest\x12\x34\n\x16streaming_resolver_fqn\x18\x01 \x01(\tR\x14streamingResolverFqn\x12\x1d\n\ninput_data\x18\x02 \x01(\x0cR\tinputData\x12&\n\x0coperation_id\x18\x03 \x01(\tH\x00R\x0boperationId\x88\x01\x01\x12\x19\n\x05\x64\x65\x62ug\x18\x04 \x01(\x08H\x01R\x05\x64\x65\x62ug\x88\x01\x01\x42\x0f\n\r_operation_idB\x08\n\x06_debug"\xe7\x02\n"SimpleStreamingUnaryInvokeResponse\x12(\n\x10num_rows_succeed\x18\x01 \x01(\x03R\x0enumRowsSucceed\x12&\n\x0fnum_rows_failed\x18\x02 \x01(\x03R\rnumRowsFailed\x12(\n\x10num_rows_skipped\x18\x03 \x01(\x03R\x0enumRowsSkipped\x12\x36\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x1b.chalk.common.v1.ChalkErrorH\x00R\x05\x65rror\x88\x01\x01\x12$\n\x0boutput_data\x18\x05 \x01(\x0cH\x01R\noutputData\x88\x01\x01\x12M\n\x10\x65xecution_errors\x18\x06 \x03(\x0b\x32".chalk.streaming.v1.StreamingErrorR\x0f\x65xecutionErrorsB\x08\n\x06_errorB\x0e\n\x0c_output_data*\xc5\x01\n\x0e\x45xecutionPhase\x12\x1f\n\x1b\x45XECUTION_PHASE_UNSPECIFIED\x10\x00\x12\x19\n\x15\x45XECUTION_PHASE_PARSE\x10\x01\x12\x1b\n\x17\x45XECUTION_PHASE_MAPPING\x10\x02\x12\x1f\n\x1b\x45XECUTION_PHASE_PERSISTENCE\x10\x03\x12\x1f\n\x1b\x45XECUTION_PHASE_AGGREGATION\x10\x04\x12\x18\n\x14\x45XECUTION_PHASE_SINK\x10\x05\x32\xab\x01\n\x16SimpleStreamingService\x12\x90\x01\n\x1aSimpleStreamingUnaryInvoke\x12\x35.chalk.streaming.v1.SimpleStreamingUnaryInvokeRequest\x1a\x36.chalk.streaming.v1.SimpleStreamingUnaryInvokeResponse"\x03\x80}\x02\x42\x9f\x01\n\x16\x63om.chalk.streaming.v1B\x1bSimpleStreamingServiceProtoP\x01\xa2\x02\x03\x43SX\xaa\x02\x12\x43halk.Streaming.V1\xca\x02\x12\x43halk\\Streaming\\V1\xe2\x02\x1e\x43halk\\Streaming\\V1\\GPBMetadata\xea\x02\x14\x43halk::Streaming::V1b\x06proto3'
21
+ b'\n1chalk/streaming/v1/simple_streaming_service.proto\x12\x12\x63halk.streaming.v1\x1a\x1f\x63halk/auth/v1/permissions.proto\x1a!chalk/common/v1/chalk_error.proto"\xa0\x01\n\x0eStreamingError\x12\x31\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x1b.chalk.common.v1.ChalkErrorR\x05\x65rror\x12\x38\n\x05phase\x18\x02 \x01(\x0e\x32".chalk.streaming.v1.ExecutionPhaseR\x05phase\x12!\n\x0coperation_id\x18\x03 \x01(\tR\x0boperationId"\xd6\x01\n!SimpleStreamingUnaryInvokeRequest\x12\x34\n\x16streaming_resolver_fqn\x18\x01 \x01(\tR\x14streamingResolverFqn\x12\x1d\n\ninput_data\x18\x02 \x01(\x0cR\tinputData\x12&\n\x0coperation_id\x18\x03 \x01(\tH\x00R\x0boperationId\x88\x01\x01\x12\x19\n\x05\x64\x65\x62ug\x18\x04 \x01(\x08H\x01R\x05\x64\x65\x62ug\x88\x01\x01\x42\x0f\n\r_operation_idB\x08\n\x06_debug"\xe7\x02\n"SimpleStreamingUnaryInvokeResponse\x12(\n\x10num_rows_succeed\x18\x01 \x01(\x03R\x0enumRowsSucceed\x12&\n\x0fnum_rows_failed\x18\x02 \x01(\x03R\rnumRowsFailed\x12(\n\x10num_rows_skipped\x18\x03 \x01(\x03R\x0enumRowsSkipped\x12\x36\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x1b.chalk.common.v1.ChalkErrorH\x00R\x05\x65rror\x88\x01\x01\x12$\n\x0boutput_data\x18\x05 \x01(\x0cH\x01R\noutputData\x88\x01\x01\x12M\n\x10\x65xecution_errors\x18\x06 \x03(\x0b\x32".chalk.streaming.v1.StreamingErrorR\x0f\x65xecutionErrorsB\x08\n\x06_errorB\x0e\n\x0c_output_data"\xb5\x02\n\x1cTestStreamingResolverRequest\x12&\n\x0cresolver_fqn\x18\x01 \x01(\tH\x00R\x0bresolverFqn\x88\x01\x01\x12@\n\x1astatic_stream_resolver_b64\x18\x02 \x01(\tH\x01R\x17staticStreamResolverB64\x88\x01\x01\x12\x1d\n\ninput_data\x18\x03 \x01(\x0cR\tinputData\x12&\n\x0coperation_id\x18\x04 \x01(\tH\x02R\x0boperationId\x88\x01\x01\x12\x19\n\x05\x64\x65\x62ug\x18\x05 \x01(\x08H\x03R\x05\x64\x65\x62ug\x88\x01\x01\x42\x0f\n\r_resolver_fqnB\x1d\n\x1b_static_stream_resolver_b64B\x0f\n\r_operation_idB\x08\n\x06_debug"\xe1\x01\n\x1dTestStreamingResolverResponse\x12\x44\n\x06status\x18\x01 \x01(\x0e\x32,.chalk.streaming.v1.TestStreamResolverStatusR\x06status\x12\x1e\n\x08\x64\x61ta_uri\x18\x02 \x01(\tH\x00R\x07\x64\x61taUri\x88\x01\x01\x12\x33\n\x06\x65rrors\x18\x03 \x03(\x0b\x32\x1b.chalk.common.v1.ChalkErrorR\x06\x65rrors\x12\x18\n\x07message\x18\x04 \x01(\tR\x07messageB\x0b\n\t_data_uri*\xc5\x01\n\x0e\x45xecutionPhase\x12\x1f\n\x1b\x45XECUTION_PHASE_UNSPECIFIED\x10\x00\x12\x19\n\x15\x45XECUTION_PHASE_PARSE\x10\x01\x12\x1b\n\x17\x45XECUTION_PHASE_MAPPING\x10\x02\x12\x1f\n\x1b\x45XECUTION_PHASE_PERSISTENCE\x10\x03\x12\x1f\n\x1b\x45XECUTION_PHASE_AGGREGATION\x10\x04\x12\x18\n\x14\x45XECUTION_PHASE_SINK\x10\x05*\x99\x01\n\x18TestStreamResolverStatus\x12+\n\'TEST_STREAM_RESOLVER_STATUS_UNSPECIFIED\x10\x00\x12\'\n#TEST_STREAM_RESOLVER_STATUS_SUCCESS\x10\x01\x12\'\n#TEST_STREAM_RESOLVER_STATUS_FAILURE\x10\x02\x32\xaf\x02\n\x16SimpleStreamingService\x12\x90\x01\n\x1aSimpleStreamingUnaryInvoke\x12\x35.chalk.streaming.v1.SimpleStreamingUnaryInvokeRequest\x1a\x36.chalk.streaming.v1.SimpleStreamingUnaryInvokeResponse"\x03\x80}\x02\x12\x81\x01\n\x15TestStreamingResolver\x12\x30.chalk.streaming.v1.TestStreamingResolverRequest\x1a\x31.chalk.streaming.v1.TestStreamingResolverResponse"\x03\x80}\x02\x42\x9f\x01\n\x16\x63om.chalk.streaming.v1B\x1bSimpleStreamingServiceProtoP\x01\xa2\x02\x03\x43SX\xaa\x02\x12\x43halk.Streaming.V1\xca\x02\x12\x43halk\\Streaming\\V1\xe2\x02\x1e\x43halk\\Streaming\\V1\\GPBMetadata\xea\x02\x14\x43halk::Streaming::V1b\x06proto3'
22
22
  )
23
23
 
24
24
  _globals = globals()
@@ -31,14 +31,22 @@ if _descriptor._USE_C_DESCRIPTORS == False:
31
31
  ]._serialized_options = b"\n\026com.chalk.streaming.v1B\033SimpleStreamingServiceProtoP\001\242\002\003CSX\252\002\022Chalk.Streaming.V1\312\002\022Chalk\\Streaming\\V1\342\002\036Chalk\\Streaming\\V1\\GPBMetadata\352\002\024Chalk::Streaming::V1"
32
32
  _globals["_SIMPLESTREAMINGSERVICE"].methods_by_name["SimpleStreamingUnaryInvoke"]._options = None
33
33
  _globals["_SIMPLESTREAMINGSERVICE"].methods_by_name["SimpleStreamingUnaryInvoke"]._serialized_options = b"\200}\002"
34
- _globals["_EXECUTIONPHASE"]._serialized_start = 884
35
- _globals["_EXECUTIONPHASE"]._serialized_end = 1081
34
+ _globals["_SIMPLESTREAMINGSERVICE"].methods_by_name["TestStreamingResolver"]._options = None
35
+ _globals["_SIMPLESTREAMINGSERVICE"].methods_by_name["TestStreamingResolver"]._serialized_options = b"\200}\002"
36
+ _globals["_EXECUTIONPHASE"]._serialized_start = 1424
37
+ _globals["_EXECUTIONPHASE"]._serialized_end = 1621
38
+ _globals["_TESTSTREAMRESOLVERSTATUS"]._serialized_start = 1624
39
+ _globals["_TESTSTREAMRESOLVERSTATUS"]._serialized_end = 1777
36
40
  _globals["_STREAMINGERROR"]._serialized_start = 142
37
41
  _globals["_STREAMINGERROR"]._serialized_end = 302
38
42
  _globals["_SIMPLESTREAMINGUNARYINVOKEREQUEST"]._serialized_start = 305
39
43
  _globals["_SIMPLESTREAMINGUNARYINVOKEREQUEST"]._serialized_end = 519
40
44
  _globals["_SIMPLESTREAMINGUNARYINVOKERESPONSE"]._serialized_start = 522
41
45
  _globals["_SIMPLESTREAMINGUNARYINVOKERESPONSE"]._serialized_end = 881
42
- _globals["_SIMPLESTREAMINGSERVICE"]._serialized_start = 1084
43
- _globals["_SIMPLESTREAMINGSERVICE"]._serialized_end = 1255
46
+ _globals["_TESTSTREAMINGRESOLVERREQUEST"]._serialized_start = 884
47
+ _globals["_TESTSTREAMINGRESOLVERREQUEST"]._serialized_end = 1193
48
+ _globals["_TESTSTREAMINGRESOLVERRESPONSE"]._serialized_start = 1196
49
+ _globals["_TESTSTREAMINGRESOLVERRESPONSE"]._serialized_end = 1421
50
+ _globals["_SIMPLESTREAMINGSERVICE"]._serialized_start = 1780
51
+ _globals["_SIMPLESTREAMINGSERVICE"]._serialized_end = 2083
44
52
  # @@protoc_insertion_point(module_scope)
@@ -23,12 +23,21 @@ class ExecutionPhase(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
23
23
  EXECUTION_PHASE_AGGREGATION: _ClassVar[ExecutionPhase]
24
24
  EXECUTION_PHASE_SINK: _ClassVar[ExecutionPhase]
25
25
 
26
+ class TestStreamResolverStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
27
+ __slots__ = ()
28
+ TEST_STREAM_RESOLVER_STATUS_UNSPECIFIED: _ClassVar[TestStreamResolverStatus]
29
+ TEST_STREAM_RESOLVER_STATUS_SUCCESS: _ClassVar[TestStreamResolverStatus]
30
+ TEST_STREAM_RESOLVER_STATUS_FAILURE: _ClassVar[TestStreamResolverStatus]
31
+
26
32
  EXECUTION_PHASE_UNSPECIFIED: ExecutionPhase
27
33
  EXECUTION_PHASE_PARSE: ExecutionPhase
28
34
  EXECUTION_PHASE_MAPPING: ExecutionPhase
29
35
  EXECUTION_PHASE_PERSISTENCE: ExecutionPhase
30
36
  EXECUTION_PHASE_AGGREGATION: ExecutionPhase
31
37
  EXECUTION_PHASE_SINK: ExecutionPhase
38
+ TEST_STREAM_RESOLVER_STATUS_UNSPECIFIED: TestStreamResolverStatus
39
+ TEST_STREAM_RESOLVER_STATUS_SUCCESS: TestStreamResolverStatus
40
+ TEST_STREAM_RESOLVER_STATUS_FAILURE: TestStreamResolverStatus
32
41
 
33
42
  class StreamingError(_message.Message):
34
43
  __slots__ = ("error", "phase", "operation_id")
@@ -86,3 +95,42 @@ class SimpleStreamingUnaryInvokeResponse(_message.Message):
86
95
  output_data: _Optional[bytes] = ...,
87
96
  execution_errors: _Optional[_Iterable[_Union[StreamingError, _Mapping]]] = ...,
88
97
  ) -> None: ...
98
+
99
+ class TestStreamingResolverRequest(_message.Message):
100
+ __slots__ = ("resolver_fqn", "static_stream_resolver_b64", "input_data", "operation_id", "debug")
101
+ RESOLVER_FQN_FIELD_NUMBER: _ClassVar[int]
102
+ STATIC_STREAM_RESOLVER_B64_FIELD_NUMBER: _ClassVar[int]
103
+ INPUT_DATA_FIELD_NUMBER: _ClassVar[int]
104
+ OPERATION_ID_FIELD_NUMBER: _ClassVar[int]
105
+ DEBUG_FIELD_NUMBER: _ClassVar[int]
106
+ resolver_fqn: str
107
+ static_stream_resolver_b64: str
108
+ input_data: bytes
109
+ operation_id: str
110
+ debug: bool
111
+ def __init__(
112
+ self,
113
+ resolver_fqn: _Optional[str] = ...,
114
+ static_stream_resolver_b64: _Optional[str] = ...,
115
+ input_data: _Optional[bytes] = ...,
116
+ operation_id: _Optional[str] = ...,
117
+ debug: bool = ...,
118
+ ) -> None: ...
119
+
120
+ class TestStreamingResolverResponse(_message.Message):
121
+ __slots__ = ("status", "data_uri", "errors", "message")
122
+ STATUS_FIELD_NUMBER: _ClassVar[int]
123
+ DATA_URI_FIELD_NUMBER: _ClassVar[int]
124
+ ERRORS_FIELD_NUMBER: _ClassVar[int]
125
+ MESSAGE_FIELD_NUMBER: _ClassVar[int]
126
+ status: TestStreamResolverStatus
127
+ data_uri: str
128
+ errors: _containers.RepeatedCompositeFieldContainer[_chalk_error_pb2.ChalkError]
129
+ message: str
130
+ def __init__(
131
+ self,
132
+ status: _Optional[_Union[TestStreamResolverStatus, str]] = ...,
133
+ data_uri: _Optional[str] = ...,
134
+ errors: _Optional[_Iterable[_Union[_chalk_error_pb2.ChalkError, _Mapping]]] = ...,
135
+ message: _Optional[str] = ...,
136
+ ) -> None: ...
@@ -22,6 +22,11 @@ class SimpleStreamingServiceStub(object):
22
22
  request_serializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.SimpleStreamingUnaryInvokeRequest.SerializeToString,
23
23
  response_deserializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.SimpleStreamingUnaryInvokeResponse.FromString,
24
24
  )
25
+ self.TestStreamingResolver = channel.unary_unary(
26
+ "/chalk.streaming.v1.SimpleStreamingService/TestStreamingResolver",
27
+ request_serializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverRequest.SerializeToString,
28
+ response_deserializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverResponse.FromString,
29
+ )
25
30
 
26
31
 
27
32
  class SimpleStreamingServiceServicer(object):
@@ -35,6 +40,15 @@ class SimpleStreamingServiceServicer(object):
35
40
  context.set_details("Method not implemented!")
36
41
  raise NotImplementedError("Method not implemented!")
37
42
 
43
+ def TestStreamingResolver(self, request, context):
44
+ """Test a streaming resolver with provided messages.
45
+ Supports testing both deployed resolvers and static/undeployed resolvers.
46
+ Returns a signed URL to download the test results.
47
+ """
48
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
49
+ context.set_details("Method not implemented!")
50
+ raise NotImplementedError("Method not implemented!")
51
+
38
52
 
39
53
  def add_SimpleStreamingServiceServicer_to_server(servicer, server):
40
54
  rpc_method_handlers = {
@@ -43,6 +57,11 @@ def add_SimpleStreamingServiceServicer_to_server(servicer, server):
43
57
  request_deserializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.SimpleStreamingUnaryInvokeRequest.FromString,
44
58
  response_serializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.SimpleStreamingUnaryInvokeResponse.SerializeToString,
45
59
  ),
60
+ "TestStreamingResolver": grpc.unary_unary_rpc_method_handler(
61
+ servicer.TestStreamingResolver,
62
+ request_deserializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverRequest.FromString,
63
+ response_serializer=chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverResponse.SerializeToString,
64
+ ),
46
65
  }
47
66
  generic_handler = grpc.method_handlers_generic_handler(
48
67
  "chalk.streaming.v1.SimpleStreamingService", rpc_method_handlers
@@ -82,3 +101,32 @@ class SimpleStreamingService(object):
82
101
  timeout,
83
102
  metadata,
84
103
  )
104
+
105
+ @staticmethod
106
+ def TestStreamingResolver(
107
+ request,
108
+ target,
109
+ options=(),
110
+ channel_credentials=None,
111
+ call_credentials=None,
112
+ insecure=False,
113
+ compression=None,
114
+ wait_for_ready=None,
115
+ timeout=None,
116
+ metadata=None,
117
+ ):
118
+ return grpc.experimental.unary_unary(
119
+ request,
120
+ target,
121
+ "/chalk.streaming.v1.SimpleStreamingService/TestStreamingResolver",
122
+ chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverRequest.SerializeToString,
123
+ chalk_dot_streaming_dot_v1_dot_simple__streaming__service__pb2.TestStreamingResolverResponse.FromString,
124
+ options,
125
+ channel_credentials,
126
+ insecure,
127
+ call_credentials,
128
+ compression,
129
+ wait_for_ready,
130
+ timeout,
131
+ metadata,
132
+ )
@@ -10,6 +10,8 @@ from abc import (
10
10
  from chalk._gen.chalk.streaming.v1.simple_streaming_service_pb2 import (
11
11
  SimpleStreamingUnaryInvokeRequest,
12
12
  SimpleStreamingUnaryInvokeResponse,
13
+ TestStreamingResolverRequest,
14
+ TestStreamingResolverResponse,
13
15
  )
14
16
  from grpc import (
15
17
  Channel,
@@ -27,6 +29,14 @@ class SimpleStreamingServiceStub:
27
29
  """Runs a simple streaming plan with the given request.
28
30
  This is a simplified version of the streaming invoker service.
29
31
  """
32
+ TestStreamingResolver: UnaryUnaryMultiCallable[
33
+ TestStreamingResolverRequest,
34
+ TestStreamingResolverResponse,
35
+ ]
36
+ """Test a streaming resolver with provided messages.
37
+ Supports testing both deployed resolvers and static/undeployed resolvers.
38
+ Returns a signed URL to download the test results.
39
+ """
30
40
 
31
41
  class SimpleStreamingServiceServicer(metaclass=ABCMeta):
32
42
  @abstractmethod
@@ -38,5 +48,15 @@ class SimpleStreamingServiceServicer(metaclass=ABCMeta):
38
48
  """Runs a simple streaming plan with the given request.
39
49
  This is a simplified version of the streaming invoker service.
40
50
  """
51
+ @abstractmethod
52
+ def TestStreamingResolver(
53
+ self,
54
+ request: TestStreamingResolverRequest,
55
+ context: ServicerContext,
56
+ ) -> TestStreamingResolverResponse:
57
+ """Test a streaming resolver with provided messages.
58
+ Supports testing both deployed resolvers and static/undeployed resolvers.
59
+ Returns a signed URL to download the test results.
60
+ """
41
61
 
42
62
  def add_SimpleStreamingServiceServicer_to_server(servicer: SimpleStreamingServiceServicer, server: Server) -> None: ...
chalk/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.95.1"
1
+ __version__ = "2.95.2"
@@ -87,6 +87,7 @@ from chalk._gen.chalk.server.v1.team_pb2 import (
87
87
  ListServiceTokensResponse,
88
88
  )
89
89
  from chalk._gen.chalk.server.v1.team_pb2_grpc import TeamServiceStub
90
+ from chalk._gen.chalk.streaming.v1.simple_streaming_service_pb2_grpc import SimpleStreamingServiceStub
90
91
  from chalk.client import ChalkAuthException, FeatureReference
91
92
  from chalk.client.client_impl import _validate_context_dict # pyright: ignore[reportPrivateUsage]
92
93
  from chalk.client.models import (
@@ -107,6 +108,8 @@ from chalk.client.models import (
107
108
  RegisterModelVersionResponse,
108
109
  ResourceRequests,
109
110
  ScheduledQueryRun,
111
+ StreamResolverTestResponse,
112
+ StreamResolverTestStatus,
110
113
  UploadFeaturesResponse,
111
114
  )
112
115
  from chalk.client.serialization.model_serialization import ModelSerializer
@@ -117,6 +120,7 @@ from chalk.features._encoding.inputs import GRPC_ENCODE_OPTIONS, InputEncodeOpti
117
120
  from chalk.features._encoding.json import FeatureEncodingOptions
118
121
  from chalk.features._encoding.outputs import encode_outputs
119
122
  from chalk.features.feature_set import is_feature_set_class
123
+ from chalk.features.resolver import Resolver
120
124
  from chalk.features.tag import DeploymentId
121
125
  from chalk.importer import CHALK_IMPORT_FLAG
122
126
  from chalk.ml import LocalSourceConfig, ModelEncoding, ModelRunCriterion, ModelType, SourceConfig
@@ -130,9 +134,11 @@ from chalk.utils.tracing import add_trace_headers, safe_trace
130
134
 
131
135
  if TYPE_CHECKING:
132
136
  from pyarrow import RecordBatch, Table
137
+ from pydantic import BaseModel
133
138
 
134
139
  from chalk._gen.chalk.server.v1.builder_pb2 import StartBranchResponse
135
140
  from chalk._gen.chalk.server.v1.builder_pb2_grpc import BuilderServiceStub
141
+ from chalk.client import ChalkError
136
142
 
137
143
  CHALK_GRPC_TRACE_ID_HEADER: str = "x-chalk-trace-id"
138
144
 
@@ -319,6 +325,14 @@ class StubProvider:
319
325
  )
320
326
  return DataFrameServiceStub(self._engine_channel)
321
327
 
328
+ @cached_property
329
+ def streaming_stub(self) -> SimpleStreamingServiceStub:
330
+ if self._engine_channel is None:
331
+ raise ValueError(
332
+ "The GRPC engine service is not available. If you would like to set up a GRPC service, please contact Chalk."
333
+ )
334
+ return SimpleStreamingServiceStub(self._engine_channel)
335
+
322
336
  @cached_property
323
337
  def model_stub(self) -> ModelRegistryServiceStub:
324
338
  if self._server_channel is None:
@@ -574,6 +588,9 @@ class StubRefresher:
574
588
  def call_job_queue_stub(self, fn: Callable[[DataPlaneJobQueueServiceStub], T]) -> T:
575
589
  return self._retry_callable(fn, lambda: self._stub.job_queue_stub)
576
590
 
591
+ def call_streaming_stub(self, fn: Callable[[SimpleStreamingServiceStub], T]) -> T:
592
+ return self._retry_callable(fn, lambda: self._stub.streaming_stub)
593
+
577
594
  @property
578
595
  def log_stub(self) -> LogSearchServiceStub:
579
596
  return self._stub.log_stub
@@ -2200,3 +2217,232 @@ class ChalkGRPCClient:
2200
2217
  poll_interval=poll_interval,
2201
2218
  output_callback=output_callback,
2202
2219
  )
2220
+
2221
+ def test_streaming_resolver(
2222
+ self,
2223
+ resolver: str | Resolver,
2224
+ message_bodies: "list[str | bytes | BaseModel] | None" = None,
2225
+ message_keys: list[str | None] | None = None,
2226
+ message_timestamps: list[str | dt.datetime] | None = None,
2227
+ message_filepath: str | None = None,
2228
+ request_timeout: Optional[float] = None,
2229
+ ) -> "StreamResolverTestResponse":
2230
+ """Test a streaming resolver with supplied messages.
2231
+
2232
+ This method tests streaming resolvers using the gRPC TestStreamingResolver endpoint.
2233
+ It supports both deployed resolvers (by FQN) and static/undeployed resolvers
2234
+ (automatically serialized from Resolver objects).
2235
+
2236
+ Parameters
2237
+ ----------
2238
+ resolver : str | Resolver
2239
+ The streaming resolver or its string name. If a StreamResolver object with
2240
+ feature_expressions is provided, it will be automatically serialized for testing.
2241
+ message_bodies : list[str | bytes | BaseModel], optional
2242
+ The message bodies to process. Can be JSON strings, raw bytes,
2243
+ or Pydantic models (will be serialized to JSON).
2244
+ Either message_bodies or message_filepath must be provided.
2245
+ message_keys : list[str | None], optional
2246
+ Optional keys for each message. If not provided, all keys will be None.
2247
+ Must match length of message_bodies if provided.
2248
+ message_timestamps : list[str | datetime], optional
2249
+ Optional timestamps for each message. If not provided, current time
2250
+ will be used. Must match length of message_bodies if provided.
2251
+ message_filepath : str, optional
2252
+ A filepath from which test messages will be ingested.
2253
+ This file should be newline delimited JSON with format:
2254
+ {"message_key": "my-key", "message_body": {"field1": "value1"}}
2255
+ Each line may optionally contain a "message_timestamp" field.
2256
+ Either message_bodies or message_filepath must be provided.
2257
+ request_timeout : float, optional
2258
+ Request timeout in seconds.
2259
+
2260
+ Returns
2261
+ -------
2262
+ StreamResolverTestResponse
2263
+ Response containing:
2264
+ - status: SUCCESS or FAILURE
2265
+ - data_uri: Optional signed URL to parquet file with results
2266
+ - errors: List of ChalkError objects
2267
+ - message: Human-readable message
2268
+
2269
+ Examples
2270
+ --------
2271
+ >>> from chalk.client.client_grpc import ChalkGRPCClient
2272
+ >>> client = ChalkGRPCClient()
2273
+ >>> response = client.test_streaming_resolver(
2274
+ ... resolver="my_module.my_stream_resolver",
2275
+ ... message_bodies=[
2276
+ ... '{"user_id": 1, "event": "login"}',
2277
+ ... '{"user_id": 2, "event": "logout"}',
2278
+ ... ],
2279
+ ... message_keys=["user_1", "user_2"],
2280
+ ... )
2281
+ >>> print(f"Status: {response.status}")
2282
+ >>> if response.data_uri:
2283
+ ... print(f"Results at: {response.data_uri}")
2284
+ """
2285
+ import base64
2286
+ import json
2287
+ from uuid import uuid4
2288
+
2289
+ import pyarrow as pa
2290
+
2291
+ from chalk._gen.chalk.streaming.v1.simple_streaming_service_pb2 import TestStreamingResolverRequest
2292
+ from chalk.utils.pydanticutil.pydantic_compat import get_pydantic_model_json, is_pydantic_basemodel_instance
2293
+
2294
+ # Determine if resolver is static and needs serialization
2295
+ resolver_fqn: str | None = None
2296
+ static_stream_resolver_b64: str | None = None
2297
+
2298
+ if isinstance(resolver, str):
2299
+ resolver_fqn = resolver
2300
+ else:
2301
+ from chalk.features.resolver import StreamResolver
2302
+
2303
+ resolver_fqn = resolver.fqn
2304
+
2305
+ if isinstance(resolver, StreamResolver) and resolver.feature_expressions:
2306
+ from chalk.parsed.to_proto import ToProtoConverter
2307
+
2308
+ proto_resolver = ToProtoConverter.convert_stream_resolver(resolver)
2309
+ static_stream_resolver_b64 = base64.b64encode(
2310
+ proto_resolver.SerializeToString(deterministic=True)
2311
+ ).decode("utf-8")
2312
+
2313
+ # Load from file if provided
2314
+ if message_filepath is not None:
2315
+ if message_bodies is not None:
2316
+ raise ValueError("Cannot provide both message_filepath and message_bodies")
2317
+
2318
+ loaded_bodies: list[Any] = []
2319
+ loaded_keys: list[str | None] = []
2320
+ loaded_timestamps: list[str | None] = []
2321
+
2322
+ with open(message_filepath, "r") as f:
2323
+ for line in f:
2324
+ line = line.strip()
2325
+ if not line:
2326
+ continue
2327
+ msg = json.loads(line)
2328
+ loaded_bodies.append(msg.get("message_body", msg))
2329
+ loaded_keys.append(msg.get("message_key"))
2330
+ loaded_timestamps.append(msg.get("message_timestamp"))
2331
+
2332
+ message_bodies = loaded_bodies
2333
+ if message_keys is None and any(k is not None for k in loaded_keys):
2334
+ message_keys = loaded_keys
2335
+ if message_timestamps is None and any(t is not None for t in loaded_timestamps):
2336
+ # Cast needed: loaded_timestamps is list[str | None] from JSON,
2337
+ # but message_timestamps is list[str | datetime] - strings will be parsed later
2338
+ message_timestamps = typing.cast(list[str | dt.datetime], loaded_timestamps)
2339
+
2340
+ # Validate inputs
2341
+ if message_bodies is None:
2342
+ raise ValueError("Either message_bodies or message_filepath must be provided")
2343
+
2344
+ num_messages = len(message_bodies)
2345
+ if num_messages == 0:
2346
+ raise ValueError("message_bodies cannot be empty")
2347
+
2348
+ if message_keys is not None and len(message_keys) != num_messages:
2349
+ raise ValueError(
2350
+ f"message_keys length ({len(message_keys)}) must match message_bodies length ({num_messages})"
2351
+ )
2352
+
2353
+ if message_timestamps is not None and len(message_timestamps) != num_messages:
2354
+ raise ValueError(
2355
+ f"message_timestamps length ({len(message_timestamps)}) must match message_bodies length ({num_messages})"
2356
+ )
2357
+
2358
+ # Generate defaults
2359
+ message_ids = [str(uuid4()) for _ in range(num_messages)]
2360
+
2361
+ if message_keys is None:
2362
+ message_keys = typing.cast(list[str | None], [None] * num_messages)
2363
+
2364
+ if message_timestamps is None:
2365
+ message_timestamps = typing.cast(list[str | dt.datetime], [dt.datetime.now()] * num_messages)
2366
+
2367
+ # Convert message bodies to bytes
2368
+ processed_bodies: list[bytes] = []
2369
+ for body in message_bodies:
2370
+ if isinstance(body, bytes):
2371
+ processed_bodies.append(body)
2372
+ elif isinstance(body, str):
2373
+ processed_bodies.append(body.encode("utf-8"))
2374
+ elif is_pydantic_basemodel_instance(body):
2375
+ # Use utility function that handles both Pydantic v1 and v2
2376
+ processed_bodies.append(get_pydantic_model_json(body).encode("utf-8"))
2377
+ else:
2378
+ # Try JSON serialization for dict-like objects
2379
+ processed_bodies.append(json.dumps(body).encode("utf-8"))
2380
+
2381
+ # Convert timestamps to unix timestamps in milliseconds (int64)
2382
+ # At this point message_timestamps is guaranteed to be non-None due to the default assignment above
2383
+ assert message_timestamps is not None
2384
+ processed_timestamps: list[int] = []
2385
+ for ts in message_timestamps:
2386
+ if isinstance(ts, str):
2387
+ # Parse ISO format string
2388
+ parsed = dt.datetime.fromisoformat(ts.replace("Z", "+00:00"))
2389
+ processed_timestamps.append(int(parsed.timestamp() * 1000)) # milliseconds
2390
+ else:
2391
+ # Type narrowing: ts must be dt.datetime here
2392
+ processed_timestamps.append(int(ts.timestamp() * 1000)) # milliseconds
2393
+
2394
+ # Create Arrow table
2395
+ table = pa.table(
2396
+ {
2397
+ "message_id": message_ids,
2398
+ "message_key": message_keys,
2399
+ "message_data": processed_bodies,
2400
+ "publish_timestamp": processed_timestamps,
2401
+ }
2402
+ )
2403
+
2404
+ # Serialize to Arrow IPC format
2405
+ sink = pa.BufferOutputStream()
2406
+ with pa.ipc.new_stream(sink, table.schema) as writer:
2407
+ writer.write_table(table)
2408
+ input_data = sink.getvalue().to_pybytes()
2409
+
2410
+ # Create gRPC request
2411
+ request = TestStreamingResolverRequest(
2412
+ resolver_fqn=resolver_fqn or "",
2413
+ input_data=input_data,
2414
+ operation_id=None,
2415
+ debug=True,
2416
+ )
2417
+
2418
+ if static_stream_resolver_b64:
2419
+ request.static_stream_resolver_b64 = static_stream_resolver_b64
2420
+
2421
+ # Call new TestStreamingResolver endpoint
2422
+ proto_response = self._stub_refresher.call_streaming_stub(
2423
+ lambda x: x.TestStreamingResolver(
2424
+ request,
2425
+ timeout=request_timeout,
2426
+ )
2427
+ )
2428
+
2429
+ # Convert proto response to StreamResolverTestResponse
2430
+ from chalk._gen.chalk.streaming.v1.simple_streaming_service_pb2 import TEST_STREAM_RESOLVER_STATUS_SUCCESS
2431
+
2432
+ status = (
2433
+ StreamResolverTestStatus.SUCCESS
2434
+ if proto_response.status == TEST_STREAM_RESOLVER_STATUS_SUCCESS
2435
+ else StreamResolverTestStatus.FAILURE
2436
+ )
2437
+
2438
+ # Convert proto errors to ChalkError objects
2439
+ errors_list: list[ChalkError] = []
2440
+ if proto_response.errors:
2441
+ errors_list = [ChalkErrorConverter.chalk_error_decode(err) for err in proto_response.errors]
2442
+
2443
+ return StreamResolverTestResponse(
2444
+ status=status,
2445
+ data_uri=proto_response.data_uri if proto_response.HasField("data_uri") else None,
2446
+ errors=errors_list if errors_list else None,
2447
+ message=proto_response.message if proto_response.message else None,
2448
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalkpy
3
- Version: 2.95.1
3
+ Version: 2.95.2
4
4
  Summary: Python SDK for Chalk
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -1,5 +1,5 @@
1
1
  chalk/__init__.py,sha256=vKsx9-cl5kImlVWGHVRYO6bweBm79NAzGs3l36u71wM,2657
2
- chalk/_version.py,sha256=rk-4TApc5a3eBFZLyztEsm1bUXcfcBUXksYD8HUtU0k,23
2
+ chalk/_version.py,sha256=8T7eHxynVt8b7bbVY3EdisoyHrkbUH4P6Ycon__siBE,23
3
3
  chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
4
4
  chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
5
5
  chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
@@ -553,10 +553,10 @@ chalk/_gen/chalk/streaming/v1/debug_service_pb2.py,sha256=Io77o-qWUcna6B0MW1xVU5
553
553
  chalk/_gen/chalk/streaming/v1/debug_service_pb2.pyi,sha256=ZPwi3ZF2deh5oN7fJ35l91oEhJruTjoEygmea7-Px9Y,2941
554
554
  chalk/_gen/chalk/streaming/v1/debug_service_pb2_grpc.py,sha256=s0Amfp7IoTGzId59EnMzd_X0rYHjVRP-nEdY4w1YeSE,8816
555
555
  chalk/_gen/chalk/streaming/v1/debug_service_pb2_grpc.pyi,sha256=jNfL9gkz44M8lyElcdLYGSSUhSTMUku9N9EQAndfwhQ,2632
556
- chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.py,sha256=JXZrNzA6pe7UN_yfXv4vw1hD1-uV19bWtJ-tHRrbQgk,4442
557
- chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.pyi,sha256=QoH3lr-Zx4ytiPZ9zd0S7IhZimGG2IzLE1FCK2mTn0Q,3526
558
- chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.py,sha256=40Par0twcomUnZQ3DVGsyasCXmQrGOFhE8L4k4dnN3Y,3298
559
- chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.pyi,sha256=b22fo-wAGglRbj5wGUHHaAKr49WNdqYi8rkGDMe5haY,1311
556
+ chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.py,sha256=bRAeaMHDopyEplI8AErmtgTQn4tHOEcDuJz8Qqdwtsc,6333
557
+ chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.pyi,sha256=xM-yWokZKLwoO1sCa67ax9LLo9VoyDUk6o_uKVfqDX8,5561
558
+ chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.py,sha256=QSpSfZE-ok8pbvQQSQxk0LfD_srC4U0wxcQ186ucqLw,5493
559
+ chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.pyi,sha256=k5hmTpeA7grZUvp9HT1yg4NCBv1c0lb5FovNLFJ48JE,2113
560
560
  chalk/_gen/chalk/streaming/v1/streaming_invoker_service_pb2.py,sha256=iR2JMAflAZ73jMRGKuB1TDzit4gC7fh32B_eGCU-13Q,2867
561
561
  chalk/_gen/chalk/streaming/v1/streaming_invoker_service_pb2.pyi,sha256=7l8sddT_cCLg5IX0ooriHKRncWMfyIQYhlLQ3gLJT10,1327
562
562
  chalk/_gen/chalk/streaming/v1/streaming_invoker_service_pb2_grpc.py,sha256=1XHsT0CoqifIS3o9-NPmAnVTdr2krgtpbZwnxAlIH2o,3159
@@ -606,7 +606,7 @@ chalk/client/__init__.py,sha256=wu3WQVzE5gRj6noQQDOdYJUgDaz_9QtbjXH4KuoIlXQ,1782
606
606
  chalk/client/client.py,sha256=fqw75x4yiAk3CXryGbuF_qg09WDIlluhYeFdQ-BfTG8,103337
607
607
  chalk/client/client_async.py,sha256=nFFTWJbdBlb7zksyjOMBY566tZTAyNXQhCnq06LHWl0,50803
608
608
  chalk/client/client_async_impl.py,sha256=ZphhgTB49JBWHCGXe-dI0wWWKc9zPcOczy02q_gFy50,6925
609
- chalk/client/client_grpc.py,sha256=zRqk6qV6UO-kHnn3Ann_ckva1MRf5YC1eDWxFO3x1Pc,95443
609
+ chalk/client/client_grpc.py,sha256=VB3JDdSzpk5jMIRUi15_wGs2U9pumeAav7x46VFCFew,106317
610
610
  chalk/client/client_impl.py,sha256=R2ZUiEQf662q3O1eo_NjzYqLGB71B5mWzcx8opC3Os0,211639
611
611
  chalk/client/dataset.py,sha256=LneWwaAOHCjtj7gaJjsSeVNruj-QJ51hjRi62zrFNVE,77561
612
612
  chalk/client/exc.py,sha256=kZJ80YbSeSRDmTLTh240j_eRdJFZBa7IaDsNSRoDroU,4145
@@ -818,8 +818,8 @@ chalk/utils/tracing.py,sha256=ye5z6UCEsrxXC3ofXUNCDdUCf8ydPahEO92qQTd0AIA,11383
818
818
  chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
819
819
  chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
820
820
  chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
821
- chalkpy-2.95.1.dist-info/METADATA,sha256=nig-03oMLofMUVjgNSNjPMJA5q05ufTcKApOi-6eQwo,27494
822
- chalkpy-2.95.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
823
- chalkpy-2.95.1.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
824
- chalkpy-2.95.1.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
825
- chalkpy-2.95.1.dist-info/RECORD,,
821
+ chalkpy-2.95.2.dist-info/METADATA,sha256=Hjr3rOClUaaqTZV6p5I1zzfHAESGKpHv1JsTteE9TCU,27494
822
+ chalkpy-2.95.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
823
+ chalkpy-2.95.2.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
824
+ chalkpy-2.95.2.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
825
+ chalkpy-2.95.2.dist-info/RECORD,,