chalk-remote-call-python 1.8.3__tar.gz → 1.8.6__tar.gz

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 (67) hide show
  1. {chalk_remote_call_python-1.8.3/chalk_remote_call_python.egg-info → chalk_remote_call_python-1.8.6}/PKG-INFO +13 -2
  2. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/README.md +12 -1
  3. chalk_remote_call_python-1.8.6/chalk_remote_call/_version.py +1 -0
  4. chalk_remote_call_python-1.8.6/chalk_remote_call/input_transform.py +50 -0
  5. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/servicer.py +6 -7
  6. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6/chalk_remote_call_python.egg-info}/PKG-INFO +13 -2
  7. chalk_remote_call_python-1.8.3/chalk_remote_call/_version.py +0 -1
  8. chalk_remote_call_python-1.8.3/chalk_remote_call/input_transform.py +0 -32
  9. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/MANIFEST.in +0 -0
  10. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/Cargo.lock +0 -0
  11. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/Cargo.toml +0 -0
  12. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/Cargo.toml +0 -0
  13. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.auth.v1.rs +0 -0
  14. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.common.v1.rs +0 -0
  15. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.rs +0 -0
  16. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.tonic.rs +0 -0
  17. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.utils.v1.rs +0 -0
  18. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/descriptor.bin +0 -0
  19. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-proto/src/lib.rs +0 -0
  20. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml +0 -0
  21. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/async_service.rs +0 -0
  22. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/coalesce.rs +0 -0
  23. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/lib.rs +0 -0
  24. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +0 -0
  25. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/python_bridge.rs +0 -0
  26. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/self_consumer.rs +0 -0
  27. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/server.rs +0 -0
  28. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/chalk-remote-call-server/src/service.rs +0 -0
  29. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk-remote-call-rs/rust-toolchain.toml +0 -0
  30. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/__init__.py +0 -0
  31. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/__main__.py +0 -0
  32. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/__init__.py +0 -0
  33. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/__init__.py +0 -0
  34. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/auth/__init__.py +0 -0
  35. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/auth/v1/__init__.py +0 -0
  36. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
  37. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
  38. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/common/__init__.py +0 -0
  39. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/common/v1/__init__.py +0 -0
  40. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
  41. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2_grpc.py +0 -0
  42. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/runtime/__init__.py +0 -0
  43. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/runtime/v1/__init__.py +0 -0
  44. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -0
  45. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2_grpc.py +0 -0
  46. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/__init__.py +0 -0
  47. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/__init__.py +0 -0
  48. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
  49. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
  50. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
  51. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
  52. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
  53. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
  54. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/_native.pyi +0 -0
  55. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/arrow_utils.py +0 -0
  56. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/cli.py +0 -0
  57. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/handler_loader.py +0 -0
  58. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/server.py +0 -0
  59. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call/tracing.py +0 -0
  60. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call_python.egg-info/SOURCES.txt +0 -0
  61. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call_python.egg-info/dependency_links.txt +0 -0
  62. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call_python.egg-info/entry_points.txt +0 -0
  63. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call_python.egg-info/requires.txt +0 -0
  64. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/chalk_remote_call_python.egg-info/top_level.txt +0 -0
  65. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/pyproject.toml +0 -0
  66. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/setup.cfg +0 -0
  67. {chalk_remote_call_python-1.8.3 → chalk_remote_call_python-1.8.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.8.3
3
+ Version: 1.8.6
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -112,7 +112,18 @@ python -m chalk_remote_call --handler my_handler.handler
112
112
 
113
113
  | Variable | Description |
114
114
  |----------|-------------|
115
- | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. |
115
+ | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. Reserved columns (below) are held out of this mapping and keep their own name. |
116
+
117
+ #### Reserved columns
118
+
119
+ A caller may attach framework side-channel data to a request as an extra column. Reserved
120
+ columns are matched by name, are optional on any given request, and are excluded from the
121
+ positional `CHALK_INPUT_ARGS` mapping — so `CHALK_INPUT_ARGS` always lists exactly the
122
+ handler's declared arguments, whether or not the caller sent one.
123
+
124
+ | Column | Meaning |
125
+ |--------|---------|
126
+ | `__chalk_row_metadata__` | Per-row binary blob supplied by the caller (Chalk's engine sets it from `catalog_call(..., row_metadata => ...)`). Handlers read it via `chalkcompute.get_row_metadata()`. |
116
127
 
117
128
  ### 3. Docker image
118
129
 
@@ -74,7 +74,18 @@ python -m chalk_remote_call --handler my_handler.handler
74
74
 
75
75
  | Variable | Description |
76
76
  |----------|-------------|
77
- | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. |
77
+ | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. Reserved columns (below) are held out of this mapping and keep their own name. |
78
+
79
+ #### Reserved columns
80
+
81
+ A caller may attach framework side-channel data to a request as an extra column. Reserved
82
+ columns are matched by name, are optional on any given request, and are excluded from the
83
+ positional `CHALK_INPUT_ARGS` mapping — so `CHALK_INPUT_ARGS` always lists exactly the
84
+ handler's declared arguments, whether or not the caller sent one.
85
+
86
+ | Column | Meaning |
87
+ |--------|---------|
88
+ | `__chalk_row_metadata__` | Per-row binary blob supplied by the caller (Chalk's engine sets it from `catalog_call(..., row_metadata => ...)`). Handlers read it via `chalkcompute.get_row_metadata()`. |
78
89
 
79
90
  ### 3. Docker image
80
91
 
@@ -0,0 +1 @@
1
+ __version__ = "1.8.6"
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from collections.abc import Sequence
5
+
6
+ import pyarrow as pa
7
+
8
+ # Columns the caller attaches as framework side channels rather than handler arguments.
9
+ # They are identified by name and are optional per request, so they must be held out of the
10
+ # positional CHALK_INPUT_ARGS mapping, which describes only the handler's declared arguments.
11
+ RESERVED_COLUMNS = frozenset({"__chalk_row_metadata__"})
12
+
13
+
14
+ def resolve_column_names(field_names: Sequence[str], arg_names: Sequence[str]) -> list[str]:
15
+ """Map `arg_names` positionally onto the non-reserved columns of `field_names`.
16
+
17
+ Reserved columns keep their own name and consume no entry from `arg_names`, so a request
18
+ that carries one maps its arguments exactly as a request without one does.
19
+ """
20
+ positional = [name for name in field_names if name not in RESERVED_COLUMNS]
21
+ if len(arg_names) != len(positional):
22
+ raise ValueError(
23
+ f"CHALK_INPUT_ARGS specifies {len(arg_names)} names but RecordBatch has {len(positional)} columns"
24
+ )
25
+ remaining = iter(arg_names)
26
+ return [name if name in RESERVED_COLUMNS else next(remaining) for name in field_names]
27
+
28
+
29
+ def parse_input_args() -> list[str] | None:
30
+ """Parse CHALK_INPUT_ARGS env var into a list of column names.
31
+
32
+ Returns None if the env var is unset or empty.
33
+ """
34
+ raw = os.environ.get("CHALK_INPUT_ARGS", "").strip()
35
+ if not raw:
36
+ return None
37
+ return [name.strip() for name in raw.split(",") if name.strip()]
38
+
39
+
40
+ def transform(batch: pa.RecordBatch, arg_names: list[str] | None) -> dict[str, pa.Array]:
41
+ """Transform a RecordBatch into a dict of named arrays.
42
+
43
+ If arg_names is provided, columns are renamed by index to the given names
44
+ (ignoring the original column names), except for reserved columns, which keep
45
+ their own name. If arg_names is None, the original column names are used.
46
+ """
47
+ if arg_names is not None:
48
+ names = resolve_column_names(batch.schema.names, arg_names)
49
+ return {name: batch.column(i) for i, name in enumerate(names)}
50
+ return {batch.schema.field(i).name: batch.column(i) for i in range(batch.num_columns)}
@@ -9,7 +9,7 @@ from typing import Any
9
9
  import pyarrow as pa
10
10
 
11
11
  from chalk_remote_call.arrow_utils import decode_ipc_stream, encode_record_batch
12
- from chalk_remote_call.input_transform import transform
12
+ from chalk_remote_call.input_transform import resolve_column_names, transform
13
13
  from chalk_remote_call.tracing import remote_function_invocation_span
14
14
 
15
15
 
@@ -395,12 +395,11 @@ def process_batches_coalesced_combined(
395
395
  )
396
396
 
397
397
  if arg_names is not None:
398
- if len(arg_names) != combined.num_columns:
399
- raise ValueError(
400
- f"CHALK_INPUT_ARGS specifies {len(arg_names)} names but "
401
- f"combined batch has {combined.num_columns} columns"
402
- )
403
- combined = combined.rename_columns(arg_names)
398
+ try:
399
+ names = resolve_column_names(combined.schema.names, arg_names)
400
+ except ValueError as e:
401
+ raise ValueError(str(e).replace("RecordBatch has", "combined batch has")) from e
402
+ combined = combined.rename_columns(names)
404
403
 
405
404
  with remote_function_invocation_span(context_metadatas, coalesced_count=len(context_metadatas)):
406
405
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.8.3
3
+ Version: 1.8.6
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -112,7 +112,18 @@ python -m chalk_remote_call --handler my_handler.handler
112
112
 
113
113
  | Variable | Description |
114
114
  |----------|-------------|
115
- | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. |
115
+ | `CHALK_INPUT_ARGS` | Comma-separated list of column names (e.g. `x,y,z`). Renames incoming RecordBatch columns by index. If unset, the original column names are used. Reserved columns (below) are held out of this mapping and keep their own name. |
116
+
117
+ #### Reserved columns
118
+
119
+ A caller may attach framework side-channel data to a request as an extra column. Reserved
120
+ columns are matched by name, are optional on any given request, and are excluded from the
121
+ positional `CHALK_INPUT_ARGS` mapping — so `CHALK_INPUT_ARGS` always lists exactly the
122
+ handler's declared arguments, whether or not the caller sent one.
123
+
124
+ | Column | Meaning |
125
+ |--------|---------|
126
+ | `__chalk_row_metadata__` | Per-row binary blob supplied by the caller (Chalk's engine sets it from `catalog_call(..., row_metadata => ...)`). Handlers read it via `chalkcompute.get_row_metadata()`. |
116
127
 
117
128
  ### 3. Docker image
118
129
 
@@ -1 +0,0 @@
1
- __version__ = "1.8.3"
@@ -1,32 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
-
5
- import pyarrow as pa
6
-
7
-
8
- def parse_input_args() -> list[str] | None:
9
- """Parse CHALK_INPUT_ARGS env var into a list of column names.
10
-
11
- Returns None if the env var is unset or empty.
12
- """
13
- raw = os.environ.get("CHALK_INPUT_ARGS", "").strip()
14
- if not raw:
15
- return None
16
- return [name.strip() for name in raw.split(",") if name.strip()]
17
-
18
-
19
- def transform(batch: pa.RecordBatch, arg_names: list[str] | None) -> dict[str, pa.Array]:
20
- """Transform a RecordBatch into a dict of named arrays.
21
-
22
- If arg_names is provided, columns are renamed by index to the given names
23
- (ignoring the original column names). If arg_names is None, the original
24
- column names are used.
25
- """
26
- if arg_names is not None:
27
- if len(arg_names) != batch.num_columns:
28
- raise ValueError(
29
- f"CHALK_INPUT_ARGS specifies {len(arg_names)} names but RecordBatch has {batch.num_columns} columns"
30
- )
31
- return {name: batch.column(i) for i, name in enumerate(arg_names)}
32
- return {batch.schema.field(i).name: batch.column(i) for i in range(batch.num_columns)}