calc-flow-python 4.0.0__cp313-abi3-win_amd64.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.
calc_flow/__init__.py ADDED
@@ -0,0 +1,169 @@
1
+ from __future__ import annotations
2
+
3
+ from calc_flow import _native as _native
4
+ from calc_flow import symbolic
5
+ from calc_flow.array import register_jax, register_numpy
6
+ from calc_flow.capabilities import (
7
+ CapabilityRule,
8
+ ConnectorCapabilities,
9
+ ConnectorCapability,
10
+ OperatorCapability,
11
+ ProviderArrayRules,
12
+ ProviderCapability,
13
+ ProviderOption,
14
+ ProviderOptionsSchema,
15
+ ProviderPort,
16
+ RuntimeCapabilities,
17
+ RuntimeSessionScope,
18
+ UdfCapability,
19
+ connector_capabilities,
20
+ )
21
+ from calc_flow.config import ProjectDocument
22
+ from calc_flow.errors import (
23
+ CalcFlowError,
24
+ CancelledError,
25
+ CheckpointError,
26
+ CheckpointPublicationUnknownError,
27
+ CompileError,
28
+ ConfigError,
29
+ ExecutionError,
30
+ ProviderError,
31
+ StreamingRuntimeError,
32
+ )
33
+ from calc_flow.pipeline import (
34
+ ArrowFieldSpec,
35
+ BatchExecutionPlan,
36
+ DeliveryGuarantee,
37
+ ExecutionPlan,
38
+ JoinStateLimits,
39
+ JoinTimeBounds,
40
+ PipelineBuilder,
41
+ Runtime,
42
+ StreamExecutionPlan,
43
+ StreamRequirements,
44
+ compile_stream_project,
45
+ project_json_schema,
46
+ validate_project_json,
47
+ )
48
+ from calc_flow.runtime import (
49
+ BoundedOutOfOrderness,
50
+ Cursor,
51
+ Data,
52
+ DisabledWatermarks,
53
+ EdgeBudget,
54
+ EpochIdempotentDelivery,
55
+ Idle,
56
+ JobOutcome,
57
+ JobStatus,
58
+ JSONValue,
59
+ ManagedCheckpointRuntime,
60
+ NativeWatermarkCapability,
61
+ OrdinaryDelivery,
62
+ ReplayPositioning,
63
+ SinkBinding,
64
+ SinkDelivery,
65
+ SinkRecovery,
66
+ SourceBinding,
67
+ SourceCapabilities,
68
+ SourceDeliveryCapability,
69
+ SourceEvent,
70
+ SourceProvidedWatermarks,
71
+ StreamingError,
72
+ StreamingFailureReasonCode,
73
+ StreamingJob,
74
+ StreamingRunner,
75
+ StreamRuntimeConfig,
76
+ StreamSink,
77
+ StreamSource,
78
+ TransactionalDelivery,
79
+ TransactionalStreamSink,
80
+ Watermark,
81
+ WatermarkPolicy,
82
+ )
83
+ from calc_flow.store import FileProjectStore
84
+
85
+ __version__ = "4.0.0"
86
+ Batch = _native.Batch
87
+ ExecutionOptions = _native.ExecutionOptions
88
+ ProviderContext = _native.ProviderContext
89
+ RunResult = _native.RunResult
90
+ __all__ = [
91
+ "Batch",
92
+ "ArrowFieldSpec",
93
+ "BatchExecutionPlan",
94
+ "BoundedOutOfOrderness",
95
+ "CalcFlowError",
96
+ "CancelledError",
97
+ "CheckpointError",
98
+ "CheckpointPublicationUnknownError",
99
+ "CompileError",
100
+ "ConfigError",
101
+ "Cursor",
102
+ "Data",
103
+ "DisabledWatermarks",
104
+ "EdgeBudget",
105
+ "EpochIdempotentDelivery",
106
+ "ExecutionError",
107
+ "ExecutionOptions",
108
+ "DeliveryGuarantee",
109
+ "FileProjectStore",
110
+ "Idle",
111
+ "JobOutcome",
112
+ "JobStatus",
113
+ "JSONValue",
114
+ "JoinStateLimits",
115
+ "JoinTimeBounds",
116
+ "ManagedCheckpointRuntime",
117
+ "NativeWatermarkCapability",
118
+ "OrdinaryDelivery",
119
+ "ProviderError",
120
+ "ProviderContext",
121
+ "ProjectDocument",
122
+ "ExecutionPlan",
123
+ "PipelineBuilder",
124
+ "ConnectorCapabilities",
125
+ "ConnectorCapability",
126
+ "CapabilityRule",
127
+ "OperatorCapability",
128
+ "connector_capabilities",
129
+ "compile_stream_project",
130
+ "ProviderArrayRules",
131
+ "ProviderCapability",
132
+ "ProviderOption",
133
+ "ProviderOptionsSchema",
134
+ "ProviderPort",
135
+ "Runtime",
136
+ "RuntimeCapabilities",
137
+ "RuntimeSessionScope",
138
+ "RunResult",
139
+ "ReplayPositioning",
140
+ "SinkBinding",
141
+ "SinkDelivery",
142
+ "SinkRecovery",
143
+ "SourceBinding",
144
+ "SourceCapabilities",
145
+ "SourceDeliveryCapability",
146
+ "SourceEvent",
147
+ "SourceProvidedWatermarks",
148
+ "StreamRuntimeConfig",
149
+ "StreamSink",
150
+ "StreamSource",
151
+ "StreamingError",
152
+ "StreamingFailureReasonCode",
153
+ "StreamingJob",
154
+ "StreamingRunner",
155
+ "StreamingRuntimeError",
156
+ "StreamExecutionPlan",
157
+ "StreamRequirements",
158
+ "TransactionalDelivery",
159
+ "TransactionalStreamSink",
160
+ "UdfCapability",
161
+ "register_jax",
162
+ "register_numpy",
163
+ "symbolic",
164
+ "project_json_schema",
165
+ "validate_project_json",
166
+ "Watermark",
167
+ "WatermarkPolicy",
168
+ "__version__",
169
+ ]
calc_flow/_native.pyd ADDED
Binary file
calc_flow/_native.pyi ADDED
@@ -0,0 +1,366 @@
1
+ import asyncio
2
+ from collections.abc import Awaitable, Callable, Mapping, Sequence
3
+ from datetime import datetime
4
+ from typing import Literal, Never, Protocol, TypedDict, final
5
+
6
+ import pyarrow as pa
7
+
8
+ type JSONValue = (
9
+ None | bool | int | float | str | list[JSONValue] | dict[str, JSONValue]
10
+ )
11
+ type _JSONInput = (
12
+ None | bool | int | float | str | list[_JSONInput] | Mapping[str, _JSONInput]
13
+ )
14
+ type StreamingFailureReasonCode = Literal[
15
+ "join_state_limit_exceeded",
16
+ "join_match_limit_exceeded",
17
+ "join_counter_overflow",
18
+ "join_time_conversion_failed",
19
+ ]
20
+
21
+ class _ArrowCStream(Protocol):
22
+ def __arrow_c_stream__(
23
+ self, requested_schema: object | None = None, /
24
+ ) -> object: ...
25
+
26
+ class CalcFlowError(Exception): ...
27
+
28
+ class ConfigError(CalcFlowError):
29
+ @property
30
+ def issues(self) -> tuple[dict[str, str], ...]: ...
31
+
32
+ class CompileError(CalcFlowError): ...
33
+ class ExecutionError(CalcFlowError): ...
34
+ class ProviderError(ExecutionError): ...
35
+ class CheckpointError(CalcFlowError): ...
36
+ class CancelledError(ExecutionError): ...
37
+
38
+ class StreamingRuntimeError(CalcFlowError):
39
+ @property
40
+ def category(self) -> str: ...
41
+ @property
42
+ def reason_code(self) -> StreamingFailureReasonCode | None: ...
43
+ @property
44
+ def message(self) -> str: ...
45
+ @property
46
+ def job_id(self) -> int | None: ...
47
+ @property
48
+ def epoch(self) -> int | None: ...
49
+ @property
50
+ def checkpoint_phase(self) -> str | None: ...
51
+ @property
52
+ def component_kind(self) -> str | None: ...
53
+ @property
54
+ def component_id(self) -> str | None: ...
55
+ @property
56
+ def diagnostic_id(self) -> int | None: ...
57
+ @property
58
+ def position(self) -> int: ...
59
+
60
+ class CheckpointPublicationUnknownError(StreamingRuntimeError): ...
61
+
62
+ @final
63
+ class ExecutionOptions:
64
+ def __init__(
65
+ self,
66
+ settings: Mapping[str, _JSONInput] | None = ...,
67
+ deadline: datetime | None = ...,
68
+ ) -> None: ...
69
+ @property
70
+ def settings(self) -> dict[str, JSONValue]: ...
71
+ @property
72
+ def deadline(self) -> datetime | None: ...
73
+
74
+ @final
75
+ class ProviderContext:
76
+ def __new__(cls) -> Never:
77
+ """Engine-created; application construction is not public API."""
78
+ ...
79
+ @property
80
+ def settings(self) -> dict[str, JSONValue]: ...
81
+ @property
82
+ def deadline(self) -> datetime | None: ...
83
+
84
+ class _ExecutionCancellation(Protocol):
85
+ def cancel(self) -> None: ...
86
+
87
+ class Batch:
88
+ @staticmethod
89
+ def from_pyarrow(
90
+ table: _ArrowCStream, metadata: Mapping[str, object] | None = None
91
+ ) -> Batch: ...
92
+ @staticmethod
93
+ def from_array(
94
+ array: object,
95
+ *,
96
+ backend: str,
97
+ metadata: Mapping[str, object] | None = None,
98
+ ) -> Batch: ...
99
+ @staticmethod
100
+ def _from_external(
101
+ object: object, backend: str, len: int, metadata: Mapping[str, object]
102
+ ) -> Batch:
103
+ """Build an internal Python-provider batch; this is not a stable public API."""
104
+ ...
105
+ @staticmethod
106
+ def _new_owned_numpy(shape: Sequence[int], dtype: str) -> tuple[object, object]:
107
+ """Allocate private Rust-owned NumPy storage."""
108
+ ...
109
+ @staticmethod
110
+ def _from_owned_array(
111
+ array: object,
112
+ *,
113
+ backend: str,
114
+ token: object | None,
115
+ metadata: Mapping[str, object],
116
+ ) -> Batch:
117
+ """Adopt a trusted provider result; this is not a stable public API."""
118
+ ...
119
+
120
+ def to_pyarrow(self) -> pa.Table: ...
121
+ @property
122
+ def array(self) -> object: ...
123
+ @property
124
+ def backend(self) -> str: ...
125
+ @property
126
+ def kind(self) -> str: ...
127
+ @property
128
+ def num_rows(self) -> int: ...
129
+ @property
130
+ def metadata(self) -> dict[str, object]: ...
131
+
132
+ class Runtime:
133
+ def __init__(self) -> None: ...
134
+ def register_provider(
135
+ self,
136
+ provider: str,
137
+ name: str,
138
+ version: str,
139
+ callback: object,
140
+ *,
141
+ accepts_context: bool = False,
142
+ ) -> None: ...
143
+ def _register_mapping_provider(
144
+ self,
145
+ provider: str,
146
+ name: str,
147
+ version: str,
148
+ callback: object,
149
+ *,
150
+ input_ports: Sequence[tuple[str, str]],
151
+ output_ports: Sequence[tuple[str, str]],
152
+ accepts_context: bool = False,
153
+ ) -> None: ...
154
+ def _register_stateless_stream_provider(
155
+ self,
156
+ provider: str,
157
+ name: str,
158
+ version: str,
159
+ callback: object,
160
+ *,
161
+ microbatch_invariant: bool,
162
+ deterministic: bool,
163
+ replay_safe: bool,
164
+ ) -> None: ...
165
+ def _register_stateless_stream_mapping_provider(
166
+ self,
167
+ provider: str,
168
+ name: str,
169
+ version: str,
170
+ callback: object,
171
+ *,
172
+ input_ports: Sequence[tuple[str, str]],
173
+ output_ports: Sequence[tuple[str, str]],
174
+ microbatch_invariant: bool,
175
+ deterministic: bool,
176
+ replay_safe: bool,
177
+ ) -> None: ...
178
+ def register_scalar_udf(
179
+ self,
180
+ *,
181
+ provider: str,
182
+ name: str,
183
+ version: str,
184
+ input_types: Sequence[str],
185
+ return_type: str,
186
+ volatility: str,
187
+ function: Callable[..., object],
188
+ ) -> None: ...
189
+ def catalog(self) -> list[dict[str, object]]: ...
190
+ def validation_report(self, project_json: str) -> dict[str, object]: ...
191
+ def compile_project(self, project_json: str) -> ExecutionPlan: ...
192
+ def compile_stream_project(
193
+ self, project_json: str, delivery: Mapping[str, str]
194
+ ) -> StreamExecutionPlan: ...
195
+ def _compile_stream_graph_project(
196
+ self, project_json: str, delivery: Mapping[str, str]
197
+ ) -> StreamExecutionPlan: ...
198
+
199
+ class ExecutionPlan:
200
+ @property
201
+ def name(self) -> str: ...
202
+ @property
203
+ def fingerprint(self) -> str: ...
204
+ def execute(
205
+ self,
206
+ inputs: dict[str, Batch],
207
+ *,
208
+ options: ExecutionOptions | None = None,
209
+ ) -> RunResult: ...
210
+ def execute_async(
211
+ self,
212
+ inputs: dict[str, Batch],
213
+ *,
214
+ options: ExecutionOptions | None = None,
215
+ ) -> Awaitable[RunResult]: ...
216
+ def _execute_async_cancellable(
217
+ self,
218
+ inputs: dict[str, Batch],
219
+ *,
220
+ options: ExecutionOptions | None = None,
221
+ ) -> tuple[asyncio.Future[RunResult], _ExecutionCancellation]: ...
222
+ def snapshot_async(self) -> Awaitable[dict[str, object]]: ...
223
+ def restore_async(self, state_json: str) -> Awaitable[None]: ...
224
+ def reset_async(self) -> Awaitable[None]: ...
225
+
226
+ class StreamExecutionPlan:
227
+ @property
228
+ def name(self) -> str: ...
229
+ @property
230
+ def fingerprint(self) -> str: ...
231
+ @property
232
+ def source_binding_ids(self) -> tuple[str, ...]: ...
233
+ @property
234
+ def static_input_ids(self) -> tuple[str, ...]: ...
235
+ @property
236
+ def sink_binding_ids(self) -> tuple[str, ...]: ...
237
+ @property
238
+ def requirements(self) -> dict[str, str]: ...
239
+
240
+ @final
241
+ class _ManagedCheckpointRuntime:
242
+ def __init__(self, directory: str, /) -> None: ...
243
+
244
+ @final
245
+ class _StreamingRunner:
246
+ def __init__(
247
+ self,
248
+ plan: StreamExecutionPlan,
249
+ sources: Mapping[str, object],
250
+ sinks: Mapping[str, Sequence[object]],
251
+ checkpoints: _ManagedCheckpointRuntime,
252
+ config: Mapping[str, int],
253
+ static_inputs: Mapping[str, object],
254
+ ) -> None: ...
255
+ def start_async(self) -> Awaitable[_StreamingJob]: ...
256
+ def _wait_start_cleanup_async(self) -> Awaitable[None]: ...
257
+ def _release_roots(self) -> None: ...
258
+
259
+ @final
260
+ class _StreamingJob:
261
+ @property
262
+ def id(self) -> int: ...
263
+ def status(self) -> dict[str, object]: ...
264
+ def trigger_checkpoint_async(self) -> Awaitable[int]: ...
265
+ def shutdown_async(self) -> Awaitable[dict[str, object]]: ...
266
+ def cancel_async(self) -> Awaitable[dict[str, object]]: ...
267
+ def wait_async(self) -> Awaitable[dict[str, object]]: ...
268
+ def _release_roots(self) -> None: ...
269
+ def _enable_callback_profiling(self) -> None: ...
270
+ def _take_callback_profile(self) -> str: ...
271
+
272
+ class _FileProjectStore:
273
+ def __init__(self, directory: str) -> None: ...
274
+ def create(self, project_json: str) -> Awaitable[None]: ...
275
+ def put(self, project_json: str) -> Awaitable[None]: ...
276
+ def get(self, project_id: str) -> Awaitable[str]: ...
277
+ def list(self) -> Awaitable[list[str]]: ...
278
+ def delete(self, project_id: str) -> Awaitable[None]: ...
279
+
280
+ def import_project_json(document: bytes) -> str: ...
281
+ def import_project_yaml(document: bytes) -> str: ...
282
+ def export_project_json(project_json: str) -> str: ...
283
+ def export_project_yaml(project_json: str) -> str: ...
284
+
285
+ class _NodeTiming(TypedDict):
286
+ duration_ns: int
287
+ input_rows: dict[str, int]
288
+ output_rows: dict[str, int]
289
+
290
+ class _DataFusionMetric(TypedDict):
291
+ query_id: int
292
+ node_id: str | None
293
+ runtime_acquire_ns: int
294
+ session_state_create_ns: int
295
+ input_adapter_ns: int
296
+ table_register_ns: int
297
+ sql_parse_ns: int
298
+ logical_planning_ns: int
299
+ physical_planning_ns: int
300
+ physical_planning_count: int
301
+ planning_ns: int
302
+ stream_open_ns: int
303
+ execution_to_first_batch_ns: int
304
+ execution_remaining_ns: int
305
+ execution_ns: int
306
+ collect_ns: int
307
+ output_arrow_wrap_ns: int
308
+ audit_ns: int
309
+ metrics_traversal_ns: int
310
+ logical_plan_string_ns: int
311
+ physical_plan_string_ns: int
312
+ batch_envelope_ns: int
313
+ run_result_ns: int
314
+ physical_metric_count: int
315
+ output_partition_count: int
316
+ output_partition_rows: list[int]
317
+ window_partition_count: int
318
+ window_partition_rows: list[int]
319
+ spill_bytes: int
320
+ elapsed_compute_ns: int
321
+ window_compute_ns: int
322
+ repartition_sort_compute_ns: int
323
+ window_operator_count: int
324
+ repartition_operator_count: int
325
+ sort_operator_count: int
326
+ coalesce_operator_count: int
327
+ output_rows: int
328
+ configured_batch_size: int
329
+ parallelism_mode: Literal["fixed", "auto"]
330
+ configured_target_partitions: int
331
+ requested_target_partitions: int
332
+ effective_target_partitions: int
333
+ available_parallelism: int
334
+ max_partitions: int
335
+ min_rows_per_partition: int
336
+ small_rows_threshold: int
337
+ parallelism_decision_reused: bool
338
+ decision_input_rows: int
339
+ decision_active_entities: int | None
340
+ decision_active_entities_source: str
341
+ input_rows: int
342
+ active_entities: int | None
343
+ active_entities_source: str
344
+ partition_limit_reason: str
345
+ rolling_rewrite_enabled: bool
346
+ diagnostics_collected: bool
347
+ rolling_candidate_windows: int
348
+ rolling_rewritten_windows: int
349
+ rolling_fallback_reasons: list[str]
350
+ logical_plan: str
351
+ physical_plan: str
352
+
353
+ class RunResult:
354
+ @property
355
+ def outputs(self) -> dict[str, Batch]: ...
356
+ @property
357
+ def metadata(self) -> dict[str, str]: ...
358
+ @property
359
+ def node_timings(self) -> dict[str, _NodeTiming]: ...
360
+ @property
361
+ def datafusion_metrics(self) -> list[_DataFusionMetric]: ...
362
+
363
+ def project_json_schema() -> str: ...
364
+ def validate_project_json(project_json: str) -> str: ...
365
+ def version() -> str: ...
366
+ def registered_connectors() -> list[dict[str, object]]: ...