chalkpy 2.98.2__py3-none-any.whl → 2.98.4__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.
chalk/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.98.2"
1
+ __version__ = "2.98.4"
chalk/client/client.py CHANGED
@@ -63,7 +63,7 @@ if TYPE_CHECKING:
63
63
  from chalk.features._encoding.json import FeatureEncodingOptions
64
64
  from chalk.features.resolver import Resolver
65
65
  from chalk.features.tag import BranchId, DeploymentId, EnvironmentId
66
- from chalk.ml import ModelEncoding, ModelRunCriterion, ModelType
66
+ from chalk.ml import ModelClass, ModelEncoding, ModelRunCriterion, ModelType
67
67
  from chalk.parsed.branch_state import BranchGraphSummary
68
68
  from chalk.prompts import Prompt
69
69
 
@@ -2271,6 +2271,7 @@ class ChalkClient:
2271
2271
  self,
2272
2272
  name: str,
2273
2273
  model_type: Optional[ModelType] = None,
2274
+ model_class: Optional[ModelClass] = None,
2274
2275
  model_encoding: Optional[ModelEncoding] = None,
2275
2276
  aliases: Optional[List[str]] = None,
2276
2277
  model: Optional[Any] = None,
@@ -162,7 +162,7 @@ from chalk.features.pseudofeatures import CHALK_TS_FEATURE
162
162
  from chalk.features.resolver import Resolver, StreamResolver
163
163
  from chalk.features.tag import BranchId, DeploymentId, EnvironmentId
164
164
  from chalk.importer import CHALK_IMPORT_FLAG
165
- from chalk.ml import ModelEncoding, ModelRunCriterion, ModelType
165
+ from chalk.ml import ModelClass, ModelEncoding, ModelRunCriterion, ModelType
166
166
  from chalk.ml.model_file_transfer import SourceConfig
167
167
  from chalk.parsed._proto.utils import encode_proto_to_b64
168
168
  from chalk.parsed.branch_state import BranchGraphSummary
@@ -5270,6 +5270,7 @@ https://docs.chalk.ai/cli/apply
5270
5270
  self,
5271
5271
  name: str,
5272
5272
  model_type: Optional[ModelType] = None,
5273
+ model_class: Optional[ModelClass] = None,
5273
5274
  model_encoding: Optional[ModelEncoding] = None,
5274
5275
  aliases: Optional[List[str]] = None,
5275
5276
  model: Optional[Any] = None,
@@ -5296,6 +5297,7 @@ https://docs.chalk.ai/cli/apply
5296
5297
  name=name,
5297
5298
  aliases=aliases,
5298
5299
  model_type=model_type,
5300
+ model_class=model_class,
5299
5301
  model_encoding=model_encoding,
5300
5302
  model=model,
5301
5303
  model_paths=model_paths,
chalk/operators/_utils.py CHANGED
@@ -2,11 +2,12 @@ from __future__ import annotations
2
2
 
3
3
  import dataclasses
4
4
  import traceback
5
- from typing import Callable, Optional, Sequence, Union
5
+ from typing import Callable, Optional, Protocol, Sequence, TypeVar, Union
6
6
 
7
7
  import pyarrow
8
8
 
9
9
  from chalk import DataFrame, Features, StaticOperator
10
+ from chalk._gen.chalk.dataframe.v1 import dataframe_pb2
10
11
  from chalk._gen.chalk.expression.v1 import expression_pb2 as expr_pb
11
12
  from chalk.client import ChalkError, ChalkException, ErrorCode, ErrorCodeCategory
12
13
  from chalk.df.LazyFramePlaceholder import LazyFramePlaceholder
@@ -40,6 +41,14 @@ class _GetStaticOperatorError(Exception):
40
41
  )
41
42
 
42
43
 
44
+ ProtoT = TypeVar("ProtoT", covariant=True)
45
+
46
+
47
+ class _ToProto(Protocol[ProtoT]):
48
+ def _to_proto(self) -> ProtoT:
49
+ ...
50
+
51
+
43
52
  @dataclasses.dataclass
44
53
  class DfPlaceholder:
45
54
  schema_dict: dict[str, pyarrow.DataType]
@@ -80,7 +89,7 @@ def static_resolver_to_operator(
80
89
  fn: Callable,
81
90
  inputs: Sequence[Union[Feature, type[DataFrame]]],
82
91
  output: Optional[type[Features]],
83
- ) -> StaticOperator | DfPlaceholder | ChalkDataFrame | LazyFramePlaceholder:
92
+ ) -> StaticOperator | DfPlaceholder | ChalkDataFrame | _ToProto[dataframe_pb2.DataFramePlan]:
84
93
  if output is None:
85
94
  raise _GetStaticOperatorError(
86
95
  resolver_fqn=fqn,
chalk/parsed/to_proto.py CHANGED
@@ -16,12 +16,13 @@ from typing_extensions import assert_never
16
16
 
17
17
  from chalk import DataFrame
18
18
  from chalk._gen.chalk.arrow.v1 import arrow_pb2 as arrow_pb
19
+ from chalk._gen.chalk.dataframe.v1.dataframe_pb2 import DataFramePlan
19
20
  from chalk._gen.chalk.expression.v1 import expression_pb2 as expr_pb
21
+ from chalk._gen.chalk.expression.v1.expression_pb2 import LogicalExprNode
20
22
  from chalk._gen.chalk.graph.v1 import graph_pb2 as pb
21
23
  from chalk._gen.chalk.graph.v2 import sources_pb2 as sources_pb
22
24
  from chalk._gen.chalk.lsp.v1.lsp_pb2 import Location, Position, Range
23
25
  from chalk._validation.feature_validation import FeatureValidation
24
- from chalk.df.LazyFramePlaceholder import LazyFramePlaceholder
25
26
  from chalk.features import (
26
27
  CacheStrategy,
27
28
  Feature,
@@ -1154,10 +1155,11 @@ class ToProtoConverter:
1154
1155
  static_operation_dataframe = None
1155
1156
  if r.static:
1156
1157
  static_operator = static_resolver_to_operator(fqn=r.fqn, fn=r.fn, inputs=r.inputs, output=r.output)
1157
- if isinstance(static_operator, LazyFramePlaceholder):
1158
- static_operation_dataframe = static_operator._to_proto() # pyright: ignore[reportPrivateUsage]
1159
- else:
1160
- static_operation = static_operator._to_proto() # pyright: ignore[reportPrivateUsage]
1158
+ to_proto = static_operator._to_proto() # pyright: ignore[reportPrivateUsage]
1159
+ if isinstance(to_proto, DataFramePlan):
1160
+ static_operation_dataframe = to_proto
1161
+ elif isinstance(to_proto, LogicalExprNode): # pyright: ignore[reportUnnecessaryIsInstance]
1162
+ static_operation = to_proto
1161
1163
 
1162
1164
  function_reference_proto = ToProtoConverter.create_function_reference(
1163
1165
  r.fn,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalkpy
3
- Version: 2.98.2
3
+ Version: 2.98.4
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=7Cc2OCS4iZEpzdq7iHwkSLQA8S6psTq-SKpiAAtUbG0,23
2
+ chalk/_version.py,sha256=dEzljEJtCL38cLmlHSmH5pTwojeTArPqqy8VF1ezkbo,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
@@ -612,11 +612,11 @@ chalk/_validation/validation.py,sha256=9cCMfZa9-1wxkXLme_ylmD5vIA1qExJD6aqbYvbmK
612
612
  chalk/byte_transmit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
613
613
  chalk/byte_transmit/model.py,sha256=LFX8pj9X_CWXeap7fDnMl9YmXsYTgq7jBAbEWkxoYoE,13048
614
614
  chalk/client/__init__.py,sha256=wu3WQVzE5gRj6noQQDOdYJUgDaz_9QtbjXH4KuoIlXQ,1782
615
- chalk/client/client.py,sha256=DcRJltVqWy_B3Qvbnjz3qOECT9TZ7KD0eovds2CNRIw,104746
615
+ chalk/client/client.py,sha256=VfaLfbWyk-VaImPLNrNeAP4FvuJwQ5yEtJrkLST_-H4,104808
616
616
  chalk/client/client_async.py,sha256=YmuExumlDkenlGc8ROtmPjUE2m6nQUZisUDvJmwTRdk,51546
617
617
  chalk/client/client_async_impl.py,sha256=ZphhgTB49JBWHCGXe-dI0wWWKc9zPcOczy02q_gFy50,6925
618
618
  chalk/client/client_grpc.py,sha256=z1WeFWjmKKCU8dK7fdvWEOsCUlBi-v_2-HijC2_oIVs,108854
619
- chalk/client/client_impl.py,sha256=m2-dovRppOchuEwt2LlKJAv0LBW5obs9ztuJeDhuqY0,213660
619
+ chalk/client/client_impl.py,sha256=L0qE7Gr5MTMv71lg7-HkoPS672eERGVsfu8FObM_ZyQ,213759
620
620
  chalk/client/dataset.py,sha256=LneWwaAOHCjtj7gaJjsSeVNruj-QJ51hjRi62zrFNVE,77561
621
621
  chalk/client/exc.py,sha256=kZJ80YbSeSRDmTLTh240j_eRdJFZBa7IaDsNSRoDroU,4145
622
622
  chalk/client/models.py,sha256=TWiRHDMP_9NUqlCAGaw2RI2UlFI5ED1BCBM1rZRK72k,67482
@@ -718,7 +718,7 @@ chalk/operators/_literal.py,sha256=T8Euf2HRUVlFuct3svX4Z8EVf80r0cWDBZGr0MUgS9Q,5
718
718
  chalk/operators/_parquet_scan.py,sha256=3pSd1U-9My145GO1Nr1P_T2SfdhPZW2PLeMvKg6l4Uo,545
719
719
  chalk/operators/_rename.py,sha256=YgpMnfYsln88gfp4AwhiI8JX58hadDvEcFYrMCcVl1o,741
720
720
  chalk/operators/_select.py,sha256=0vXxnlSlp5DVnO7WcjJJuDb8jnwRtyVyVbdP_U4gtYs,1029
721
- chalk/operators/_utils.py,sha256=7NRUNqFoJoFCTEbAJs4H98KRbDJshwN0RoyjPfmyzN8,5050
721
+ chalk/operators/_utils.py,sha256=WZRYAlK3M_w5k_4tyqg0AzR1cntqfaR7upNmia-g6z4,5270
722
722
  chalk/parsed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
723
723
  chalk/parsed/_graph_validation.py,sha256=XHVPw4cf-nkPdHrqGXevsFuOrMtWtibUTRkTuizEc4g,23771
724
724
  chalk/parsed/_metadata.py,sha256=TCjKr20Fs4Yguo97yKjATurwOdV-DoFQeiGxbX_s1hs,6749
@@ -727,7 +727,7 @@ chalk/parsed/branch_state_rich.py,sha256=X9st1vRMRMOfnEy3hwitsAyNcTzZlubXJt9jI1M
727
727
  chalk/parsed/duplicate_input_gql.py,sha256=IbVRKDCS-M7f9k127LpeVjRlXvzp1tuIek-bOqTULC4,20196
728
728
  chalk/parsed/expressions.py,sha256=A8U54v9jacLX4UVtLqSUYUjL-lOnI-kWvG2hHZvfYE0,554
729
729
  chalk/parsed/json_conversions.py,sha256=GRBg2KvwahP1tXwr7n--s7ueULN6prEDPO2I9B9MWzk,30459
730
- chalk/parsed/to_proto.py,sha256=ZSwEYkuwr3UhMVabt6FM02fBN_oBy_mSMjDYS_crJw0,75530
730
+ chalk/parsed/to_proto.py,sha256=JsMnLlkXL1KH4LxZJStkwBHOB2geG9hnO3ku4LTl3vU,75657
731
731
  chalk/parsed/user_types_to_json.py,sha256=ZJWdYFqyhr5InvItQybtHadXQjW3vjHrv8hjMGtL3Bc,13318
732
732
  chalk/parsed/validation_from_registries.py,sha256=nfiAj1tvWRu0RrkhkGtElhAsL8V7ayEKUisrKQF-wYc,7900
733
733
  chalk/parsed/_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -827,8 +827,8 @@ chalk/utils/tracing.py,sha256=NiiM-9dbuJhSCv6R1npR1uYNKWlkqTR6Ygm0Voi2NrY,13078
827
827
  chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
828
828
  chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
829
829
  chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
830
- chalkpy-2.98.2.dist-info/METADATA,sha256=iROjKSQYMlH8Dfat6xKGCMx7ymmRV7SvKhEK_yGolb8,27754
831
- chalkpy-2.98.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
832
- chalkpy-2.98.2.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
833
- chalkpy-2.98.2.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
834
- chalkpy-2.98.2.dist-info/RECORD,,
830
+ chalkpy-2.98.4.dist-info/METADATA,sha256=A7vXH5sot4cUwTZRmRIJoNCUz6UciNohn3Xvitpuqgk,27754
831
+ chalkpy-2.98.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
832
+ chalkpy-2.98.4.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
833
+ chalkpy-2.98.4.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
834
+ chalkpy-2.98.4.dist-info/RECORD,,