chalkpy 2.94.0__py3-none-any.whl → 2.94.1__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.94.0"
1
+ __version__ = "2.94.1"
chalk/importer.py CHANGED
@@ -304,6 +304,19 @@ def _parse_agg_function_call(expr: Underscore | None) -> Tuple[str, Underscore,
304
304
  f"expecting 'int' type argument for 'k', but received arg of type '{type(call_expr._chalk__kwargs.get('k'))}'"
305
305
  )
306
306
  opts = FrozenOrderedSet(call_expr._chalk__kwargs.items())
307
+ elif aggregation == "approx_percentile":
308
+ if len(call_expr._chalk__args) > 0:
309
+ raise ChalkParseError("should not have any positional arguments")
310
+ elif {"quantile"} != call_expr._chalk__kwargs.keys():
311
+ raise ChalkParseError("expecting exactly one required keyword argument 'quantile'")
312
+ elif not isinstance(call_expr._chalk__kwargs.get("quantile"), float):
313
+ raise ChalkParseError(
314
+ f"expecting 'float' type argument for 'quantile', but received arg of type '{type(call_expr._chalk__kwargs.get('quantile'))}'"
315
+ )
316
+ # TODO: expand proto definition to accept kwargs that are not necessarily `k`
317
+ quantile = call_expr._chalk__kwargs["quantile"]
318
+ nano_quantile = int(round(quantile * 1_000_000_000))
319
+ opts = FrozenOrderedSet([("k", nano_quantile)])
307
320
  elif aggregation in ("min_by_n", "max_by_n"):
308
321
  if len(call_expr._chalk__kwargs) > 0:
309
322
  raise ChalkParseError("should not have any keyword arguments")
@@ -570,39 +583,51 @@ def parse_grouped_window(f: Feature) -> WindowConfigResolved:
570
583
  aggregation_kwargs=aggregation_kwargs,
571
584
  pyarrow_dtype=pyarrow_dtype,
572
585
  filters=parsed_filters,
573
- backfill_resolver=_try_parse_resolver_fqn(
574
- "backfill_resolver",
575
- f.window_materialization.get("backfill_resolver", None),
576
- )
577
- if isinstance(f.window_materialization, dict)
578
- else None,
579
- backfill_schedule=f.window_materialization.get("backfill_schedule", None)
580
- if isinstance(f.window_materialization, dict)
581
- else None,
582
- backfill_lookback_duration_seconds=_try_parse_duration(
583
- "backfill_lookback_duration",
584
- f.window_materialization.get("backfill_lookback_duration", None),
585
- )
586
- if isinstance(f.window_materialization, dict)
587
- else None,
588
- backfill_start_time=_try_parse_datetime(
589
- "backfill_start_time",
590
- f.window_materialization.get("backfill_start_time", None),
591
- )
592
- if isinstance(f.window_materialization, dict)
593
- else None,
594
- continuous_resolver=_try_parse_resolver_fqn(
595
- "continuous_resolver",
596
- f.window_materialization.get("continuous_resolver", None),
597
- )
598
- if isinstance(f.window_materialization, dict)
599
- else None,
600
- continuous_buffer_duration_seconds=_try_parse_duration(
601
- "continuous_buffer_duration",
602
- f.window_materialization.get("continuous_buffer_duration", None),
603
- )
604
- if isinstance(f.window_materialization, dict)
605
- else None,
586
+ backfill_resolver=(
587
+ _try_parse_resolver_fqn(
588
+ "backfill_resolver",
589
+ f.window_materialization.get("backfill_resolver", None),
590
+ )
591
+ if isinstance(f.window_materialization, dict)
592
+ else None
593
+ ),
594
+ backfill_schedule=(
595
+ f.window_materialization.get("backfill_schedule", None)
596
+ if isinstance(f.window_materialization, dict)
597
+ else None
598
+ ),
599
+ backfill_lookback_duration_seconds=(
600
+ _try_parse_duration(
601
+ "backfill_lookback_duration",
602
+ f.window_materialization.get("backfill_lookback_duration", None),
603
+ )
604
+ if isinstance(f.window_materialization, dict)
605
+ else None
606
+ ),
607
+ backfill_start_time=(
608
+ _try_parse_datetime(
609
+ "backfill_start_time",
610
+ f.window_materialization.get("backfill_start_time", None),
611
+ )
612
+ if isinstance(f.window_materialization, dict)
613
+ else None
614
+ ),
615
+ continuous_resolver=(
616
+ _try_parse_resolver_fqn(
617
+ "continuous_resolver",
618
+ f.window_materialization.get("continuous_resolver", None),
619
+ )
620
+ if isinstance(f.window_materialization, dict)
621
+ else None
622
+ ),
623
+ continuous_buffer_duration_seconds=(
624
+ _try_parse_duration(
625
+ "continuous_buffer_duration",
626
+ f.window_materialization.get("continuous_buffer_duration", None),
627
+ )
628
+ if isinstance(f.window_materialization, dict)
629
+ else None
630
+ ),
606
631
  )
607
632
 
608
633
  return cfg
@@ -798,39 +823,51 @@ def parse_windowed_materialization(f: Feature) -> WindowConfigResolved | None:
798
823
  aggregation_kwargs=aggregation_kwargs,
799
824
  pyarrow_dtype=f.converter.pyarrow_dtype,
800
825
  filters=parsed_filters,
801
- backfill_resolver=_try_parse_resolver_fqn(
802
- "backfill_resolver",
803
- f.window_materialization.get("backfill_resolver", None),
804
- )
805
- if isinstance(f.window_materialization, dict)
806
- else None,
807
- backfill_schedule=f.window_materialization.get("backfill_schedule", None)
808
- if isinstance(f.window_materialization, dict)
809
- else None,
810
- backfill_lookback_duration_seconds=_try_parse_duration(
811
- "backfill_lookback_duration",
812
- f.window_materialization.get("backfill_lookback_duration", None),
813
- )
814
- if isinstance(f.window_materialization, dict)
815
- else None,
816
- backfill_start_time=_try_parse_datetime(
817
- "backfill_start_time",
818
- f.window_materialization.get("backfill_start_time", None),
819
- )
820
- if isinstance(f.window_materialization, dict)
821
- else None,
822
- continuous_resolver=_try_parse_resolver_fqn(
823
- "continuous_resolver",
824
- f.window_materialization.get("continuous_resolver", None),
825
- )
826
- if isinstance(f.window_materialization, dict)
827
- else None,
828
- continuous_buffer_duration_seconds=_try_parse_duration(
829
- "continuous_buffer_duration",
830
- f.window_materialization.get("continuous_buffer_duration", None),
831
- )
832
- if isinstance(f.window_materialization, dict)
833
- else None,
826
+ backfill_resolver=(
827
+ _try_parse_resolver_fqn(
828
+ "backfill_resolver",
829
+ f.window_materialization.get("backfill_resolver", None),
830
+ )
831
+ if isinstance(f.window_materialization, dict)
832
+ else None
833
+ ),
834
+ backfill_schedule=(
835
+ f.window_materialization.get("backfill_schedule", None)
836
+ if isinstance(f.window_materialization, dict)
837
+ else None
838
+ ),
839
+ backfill_lookback_duration_seconds=(
840
+ _try_parse_duration(
841
+ "backfill_lookback_duration",
842
+ f.window_materialization.get("backfill_lookback_duration", None),
843
+ )
844
+ if isinstance(f.window_materialization, dict)
845
+ else None
846
+ ),
847
+ backfill_start_time=(
848
+ _try_parse_datetime(
849
+ "backfill_start_time",
850
+ f.window_materialization.get("backfill_start_time", None),
851
+ )
852
+ if isinstance(f.window_materialization, dict)
853
+ else None
854
+ ),
855
+ continuous_resolver=(
856
+ _try_parse_resolver_fqn(
857
+ "continuous_resolver",
858
+ f.window_materialization.get("continuous_resolver", None),
859
+ )
860
+ if isinstance(f.window_materialization, dict)
861
+ else None
862
+ ),
863
+ continuous_buffer_duration_seconds=(
864
+ _try_parse_duration(
865
+ "continuous_buffer_duration",
866
+ f.window_materialization.get("continuous_buffer_duration", None),
867
+ )
868
+ if isinstance(f.window_materialization, dict)
869
+ else None
870
+ ),
834
871
  )
835
872
 
836
873
 
chalk/parsed/to_proto.py CHANGED
@@ -900,7 +900,7 @@ class ToProtoConverter:
900
900
  else None,
901
901
  backfill_schedule=mat.backfill_schedule,
902
902
  approx_top_k_arg_k=aggregation_kwargs.get("k")
903
- if mat.aggregation in ("approx_top_k", "min_by_n", "max_by_n")
903
+ if mat.aggregation in ("approx_top_k", "approx_percentile", "min_by_n", "max_by_n")
904
904
  else None,
905
905
  ),
906
906
  tags=f.tags,
@@ -996,7 +996,7 @@ class ToProtoConverter:
996
996
  else None,
997
997
  continuous_resolver=wmp.continuous_resolver,
998
998
  approx_top_k_arg_k=aggregation_kwargs.get("k")
999
- if wmp.aggregation in ("approx_top_k", "min_by_n", "max_by_n")
999
+ if wmp.aggregation in ("approx_top_k", "approx_percentile", "min_by_n", "max_by_n")
1000
1000
  else None,
1001
1001
  )
1002
1002
  if wmp is not None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalkpy
3
- Version: 2.94.0
3
+ Version: 2.94.1
4
4
  Summary: Python SDK for Chalk
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -1,7 +1,7 @@
1
1
  chalk/__init__.py,sha256=9YxwkAt3Im0OCMfpmnIB_4PKjZfBCcRmwATLXdHNRm4,2609
2
- chalk/_version.py,sha256=XPockk5t5KGLl0SiMKX8zzmMUke272dOI_7A76yPNWY,23
2
+ chalk/_version.py,sha256=qZK5zpTwvJFAFEHgDYBgGFNnP2LVBn-tflwghckSoMU,23
3
3
  chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
4
- chalk/importer.py,sha256=hCEo7eqSfXZWklkFB2geeipGhiD0qNjPBpQJvOBW6N0,63083
4
+ chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
5
5
  chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
6
6
  chalk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  chalk/state.py,sha256=YG-YCA7bf-gs7zeRk5XQJlrFn2bhRwbKdaXTf-7khGs,657
@@ -699,7 +699,7 @@ chalk/parsed/branch_state_rich.py,sha256=X9st1vRMRMOfnEy3hwitsAyNcTzZlubXJt9jI1M
699
699
  chalk/parsed/duplicate_input_gql.py,sha256=IbVRKDCS-M7f9k127LpeVjRlXvzp1tuIek-bOqTULC4,20196
700
700
  chalk/parsed/expressions.py,sha256=A8U54v9jacLX4UVtLqSUYUjL-lOnI-kWvG2hHZvfYE0,554
701
701
  chalk/parsed/json_conversions.py,sha256=GRBg2KvwahP1tXwr7n--s7ueULN6prEDPO2I9B9MWzk,30459
702
- chalk/parsed/to_proto.py,sha256=5XNdQwDh7t7EVHkkr5OZdoFtla3drOii6hoq0K1DIdo,75397
702
+ chalk/parsed/to_proto.py,sha256=MoX4dQ_vERXTqql125vmVRP2Bm1_5E2gPDyad9XsNVg,75439
703
703
  chalk/parsed/user_types_to_json.py,sha256=ZJWdYFqyhr5InvItQybtHadXQjW3vjHrv8hjMGtL3Bc,13318
704
704
  chalk/parsed/validation_from_registries.py,sha256=nfiAj1tvWRu0RrkhkGtElhAsL8V7ayEKUisrKQF-wYc,7900
705
705
  chalk/parsed/_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -799,8 +799,8 @@ chalk/utils/tracing.py,sha256=Glx8YrtjWy0zE5YbpgfgcsLDshAKnnYm9poiWNeCxXs,11075
799
799
  chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
800
800
  chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
801
801
  chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
802
- chalkpy-2.94.0.dist-info/METADATA,sha256=vlttFvZFqwnmh8bqb0un_q2XeNLqWUpA9PTcBzZW-pI,27494
803
- chalkpy-2.94.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
804
- chalkpy-2.94.0.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
805
- chalkpy-2.94.0.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
806
- chalkpy-2.94.0.dist-info/RECORD,,
802
+ chalkpy-2.94.1.dist-info/METADATA,sha256=8dIOxHpczvNIshVjjvO_AQ0GXOf3FrjQ70QBkAY5h28,27494
803
+ chalkpy-2.94.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
804
+ chalkpy-2.94.1.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
805
+ chalkpy-2.94.1.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
806
+ chalkpy-2.94.1.dist-info/RECORD,,