cocoindex 0.2.16__cp311-abi3-macosx_11_0_arm64.whl → 0.2.17__cp311-abi3-macosx_11_0_arm64.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.
- cocoindex/_engine.abi3.so +0 -0
- cocoindex/auth_registry.py +1 -1
- cocoindex/cli.py +121 -41
- cocoindex/engine_object.py +272 -0
- cocoindex/{convert.py → engine_value.py} +64 -208
- cocoindex/flow.py +7 -2
- cocoindex/functions/__init__.py +45 -0
- cocoindex/functions/_engine_builtin_specs.py +62 -0
- cocoindex/functions/colpali.py +250 -0
- cocoindex/functions/sbert.py +63 -0
- cocoindex/lib.py +1 -1
- cocoindex/op.py +7 -3
- cocoindex/sources/__init__.py +5 -0
- cocoindex/{sources.py → sources/_engine_builtin_specs.py} +3 -3
- cocoindex/targets/_engine_builtin_specs.py +9 -0
- cocoindex/tests/test_engine_object.py +331 -0
- cocoindex/tests/{test_convert.py → test_engine_value.py} +150 -26
- cocoindex/typing.py +125 -3
- {cocoindex-0.2.16.dist-info → cocoindex-0.2.17.dist-info}/METADATA +4 -1
- cocoindex-0.2.17.dist-info/RECORD +43 -0
- {cocoindex-0.2.16.dist-info → cocoindex-0.2.17.dist-info}/WHEEL +1 -1
- {cocoindex-0.2.16.dist-info → cocoindex-0.2.17.dist-info}/licenses/THIRD_PARTY_NOTICES.html +22 -19
- cocoindex/tests/test_load_convert.py +0 -118
- cocoindex-0.2.16.dist-info/RECORD +0 -37
- {cocoindex-0.2.16.dist-info → cocoindex-0.2.17.dist-info}/entry_points.txt +0 -0
cocoindex/typing.py
CHANGED
@@ -21,6 +21,21 @@ from typing import (
|
|
21
21
|
import numpy as np
|
22
22
|
from numpy.typing import NDArray
|
23
23
|
|
24
|
+
# Optional Pydantic support
|
25
|
+
try:
|
26
|
+
import pydantic
|
27
|
+
|
28
|
+
PYDANTIC_AVAILABLE = True
|
29
|
+
except ImportError:
|
30
|
+
pydantic = None # type: ignore[assignment]
|
31
|
+
PYDANTIC_AVAILABLE = False
|
32
|
+
|
33
|
+
if TYPE_CHECKING:
|
34
|
+
if PYDANTIC_AVAILABLE:
|
35
|
+
from pydantic import BaseModel
|
36
|
+
else:
|
37
|
+
BaseModel = object # type: ignore[misc,assignment]
|
38
|
+
|
24
39
|
|
25
40
|
class VectorInfo(NamedTuple):
|
26
41
|
dim: int | None
|
@@ -108,9 +123,19 @@ def is_namedtuple_type(t: type) -> bool:
|
|
108
123
|
return isinstance(t, type) and issubclass(t, tuple) and hasattr(t, "_fields")
|
109
124
|
|
110
125
|
|
126
|
+
def is_pydantic_model(t: Any) -> bool:
|
127
|
+
"""Check if a type is a Pydantic model."""
|
128
|
+
if not PYDANTIC_AVAILABLE or not isinstance(t, type):
|
129
|
+
return False
|
130
|
+
try:
|
131
|
+
return issubclass(t, pydantic.BaseModel)
|
132
|
+
except TypeError:
|
133
|
+
return False
|
134
|
+
|
135
|
+
|
111
136
|
def is_struct_type(t: Any) -> bool:
|
112
137
|
return isinstance(t, type) and (
|
113
|
-
dataclasses.is_dataclass(t) or is_namedtuple_type(t)
|
138
|
+
dataclasses.is_dataclass(t) or is_namedtuple_type(t) or is_pydantic_model(t)
|
114
139
|
)
|
115
140
|
|
116
141
|
|
@@ -334,7 +359,9 @@ def _encode_struct_schema(
|
|
334
359
|
) -> tuple[dict[str, Any], int | None]:
|
335
360
|
fields = []
|
336
361
|
|
337
|
-
def add_field(
|
362
|
+
def add_field(
|
363
|
+
name: str, analyzed_type: AnalyzedTypeInfo, description: str | None = None
|
364
|
+
) -> None:
|
338
365
|
try:
|
339
366
|
type_info = encode_enriched_type_info(analyzed_type)
|
340
367
|
except ValueError as e:
|
@@ -344,6 +371,8 @@ def _encode_struct_schema(
|
|
344
371
|
)
|
345
372
|
raise
|
346
373
|
type_info["name"] = name
|
374
|
+
if description is not None:
|
375
|
+
type_info["description"] = description
|
347
376
|
fields.append(type_info)
|
348
377
|
|
349
378
|
def add_fields_from_struct(struct_type: type) -> None:
|
@@ -353,6 +382,17 @@ def _encode_struct_schema(
|
|
353
382
|
elif is_namedtuple_type(struct_type):
|
354
383
|
for name, field_type in struct_type.__annotations__.items():
|
355
384
|
add_field(name, analyze_type_info(field_type))
|
385
|
+
elif is_pydantic_model(struct_type):
|
386
|
+
# Type guard: ensure we have pydantic available and struct_type has model_fields
|
387
|
+
if hasattr(struct_type, "model_fields"):
|
388
|
+
for name, field_info in struct_type.model_fields.items(): # type: ignore[attr-defined]
|
389
|
+
# Get the annotation from the field info
|
390
|
+
field_type = field_info.annotation
|
391
|
+
# Extract description from Pydantic field info
|
392
|
+
description = getattr(field_info, "description", None)
|
393
|
+
add_field(name, analyze_type_info(field_type), description)
|
394
|
+
else:
|
395
|
+
raise ValueError(f"Invalid Pydantic model: {struct_type}")
|
356
396
|
else:
|
357
397
|
raise ValueError(f"Unsupported struct type: {struct_type}")
|
358
398
|
|
@@ -482,6 +522,13 @@ class VectorTypeSchema:
|
|
482
522
|
element_type: "BasicValueType"
|
483
523
|
dimension: int | None
|
484
524
|
|
525
|
+
def __str__(self) -> str:
|
526
|
+
dimension_str = f", {self.dimension}" if self.dimension is not None else ""
|
527
|
+
return f"Vector[{self.element_type}{dimension_str}]"
|
528
|
+
|
529
|
+
def __repr__(self) -> str:
|
530
|
+
return self.__str__()
|
531
|
+
|
485
532
|
@staticmethod
|
486
533
|
def decode(obj: dict[str, Any]) -> "VectorTypeSchema":
|
487
534
|
return VectorTypeSchema(
|
@@ -500,6 +547,13 @@ class VectorTypeSchema:
|
|
500
547
|
class UnionTypeSchema:
|
501
548
|
variants: list["BasicValueType"]
|
502
549
|
|
550
|
+
def __str__(self) -> str:
|
551
|
+
types_str = " | ".join(str(t) for t in self.variants)
|
552
|
+
return f"Union[{types_str}]"
|
553
|
+
|
554
|
+
def __repr__(self) -> str:
|
555
|
+
return self.__str__()
|
556
|
+
|
503
557
|
@staticmethod
|
504
558
|
def decode(obj: dict[str, Any]) -> "UnionTypeSchema":
|
505
559
|
return UnionTypeSchema(
|
@@ -539,6 +593,23 @@ class BasicValueType:
|
|
539
593
|
vector: VectorTypeSchema | None = None
|
540
594
|
union: UnionTypeSchema | None = None
|
541
595
|
|
596
|
+
def __str__(self) -> str:
|
597
|
+
if self.kind == "Vector" and self.vector is not None:
|
598
|
+
dimension_str = (
|
599
|
+
f", {self.vector.dimension}"
|
600
|
+
if self.vector.dimension is not None
|
601
|
+
else ""
|
602
|
+
)
|
603
|
+
return f"Vector[{self.vector.element_type}{dimension_str}]"
|
604
|
+
elif self.kind == "Union" and self.union is not None:
|
605
|
+
types_str = " | ".join(str(t) for t in self.union.variants)
|
606
|
+
return f"Union[{types_str}]"
|
607
|
+
else:
|
608
|
+
return self.kind
|
609
|
+
|
610
|
+
def __repr__(self) -> str:
|
611
|
+
return self.__str__()
|
612
|
+
|
542
613
|
@staticmethod
|
543
614
|
def decode(obj: dict[str, Any]) -> "BasicValueType":
|
544
615
|
kind = obj["kind"]
|
@@ -569,6 +640,18 @@ class EnrichedValueType:
|
|
569
640
|
nullable: bool = False
|
570
641
|
attrs: dict[str, Any] | None = None
|
571
642
|
|
643
|
+
def __str__(self) -> str:
|
644
|
+
result = str(self.type)
|
645
|
+
if self.nullable:
|
646
|
+
result += "?"
|
647
|
+
if self.attrs:
|
648
|
+
attrs_str = ", ".join(f"{k}: {v}" for k, v in self.attrs.items())
|
649
|
+
result += f" [{attrs_str}]"
|
650
|
+
return result
|
651
|
+
|
652
|
+
def __repr__(self) -> str:
|
653
|
+
return self.__str__()
|
654
|
+
|
572
655
|
@staticmethod
|
573
656
|
def decode(obj: dict[str, Any]) -> "EnrichedValueType":
|
574
657
|
return EnrichedValueType(
|
@@ -590,14 +673,27 @@ class EnrichedValueType:
|
|
590
673
|
class FieldSchema:
|
591
674
|
name: str
|
592
675
|
value_type: EnrichedValueType
|
676
|
+
description: str | None = None
|
677
|
+
|
678
|
+
def __str__(self) -> str:
|
679
|
+
return f"{self.name}: {self.value_type}"
|
680
|
+
|
681
|
+
def __repr__(self) -> str:
|
682
|
+
return self.__str__()
|
593
683
|
|
594
684
|
@staticmethod
|
595
685
|
def decode(obj: dict[str, Any]) -> "FieldSchema":
|
596
|
-
return FieldSchema(
|
686
|
+
return FieldSchema(
|
687
|
+
name=obj["name"],
|
688
|
+
value_type=EnrichedValueType.decode(obj),
|
689
|
+
description=obj.get("description"),
|
690
|
+
)
|
597
691
|
|
598
692
|
def encode(self) -> dict[str, Any]:
|
599
693
|
result = self.value_type.encode()
|
600
694
|
result["name"] = self.name
|
695
|
+
if self.description is not None:
|
696
|
+
result["description"] = self.description
|
601
697
|
return result
|
602
698
|
|
603
699
|
|
@@ -606,6 +702,13 @@ class StructSchema:
|
|
606
702
|
fields: list[FieldSchema]
|
607
703
|
description: str | None = None
|
608
704
|
|
705
|
+
def __str__(self) -> str:
|
706
|
+
fields_str = ", ".join(str(field) for field in self.fields)
|
707
|
+
return f"Struct({fields_str})"
|
708
|
+
|
709
|
+
def __repr__(self) -> str:
|
710
|
+
return self.__str__()
|
711
|
+
|
609
712
|
@classmethod
|
610
713
|
def decode(cls, obj: dict[str, Any]) -> Self:
|
611
714
|
return cls(
|
@@ -624,6 +727,13 @@ class StructSchema:
|
|
624
727
|
class StructType(StructSchema):
|
625
728
|
kind: Literal["Struct"] = "Struct"
|
626
729
|
|
730
|
+
def __str__(self) -> str:
|
731
|
+
# Use the parent's __str__ method for consistency
|
732
|
+
return super().__str__()
|
733
|
+
|
734
|
+
def __repr__(self) -> str:
|
735
|
+
return self.__str__()
|
736
|
+
|
627
737
|
def encode(self) -> dict[str, Any]:
|
628
738
|
result = super().encode()
|
629
739
|
result["kind"] = self.kind
|
@@ -636,6 +746,18 @@ class TableType:
|
|
636
746
|
row: StructSchema
|
637
747
|
num_key_parts: int | None = None # Only for KTable
|
638
748
|
|
749
|
+
def __str__(self) -> str:
|
750
|
+
if self.kind == "KTable":
|
751
|
+
num_parts = self.num_key_parts if self.num_key_parts is not None else 1
|
752
|
+
table_kind = f"KTable({num_parts})"
|
753
|
+
else: # LTable
|
754
|
+
table_kind = "LTable"
|
755
|
+
|
756
|
+
return f"{table_kind}({self.row})"
|
757
|
+
|
758
|
+
def __repr__(self) -> str:
|
759
|
+
return self.__str__()
|
760
|
+
|
639
761
|
@staticmethod
|
640
762
|
def decode(obj: dict[str, Any]) -> "TableType":
|
641
763
|
row_obj = obj["row"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cocoindex
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.17
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
5
5
|
Classifier: License :: OSI Approved :: Apache Software License
|
6
6
|
Classifier: Operating System :: OS Independent
|
@@ -31,13 +31,16 @@ Requires-Dist: pre-commit ; extra == 'dev'
|
|
31
31
|
Requires-Dist: sentence-transformers>=3.3.1 ; extra == 'embeddings'
|
32
32
|
Requires-Dist: colpali-engine ; extra == 'colpali'
|
33
33
|
Requires-Dist: lancedb>=0.25.0 ; extra == 'lancedb'
|
34
|
+
Requires-Dist: pydantic>=2.11.9 ; extra == 'pydantic'
|
34
35
|
Requires-Dist: sentence-transformers>=3.3.1 ; extra == 'all'
|
35
36
|
Requires-Dist: colpali-engine ; extra == 'all'
|
36
37
|
Requires-Dist: lancedb>=0.25.0 ; extra == 'all'
|
38
|
+
Requires-Dist: pydantic>=2.11.9 ; extra == 'all'
|
37
39
|
Provides-Extra: dev
|
38
40
|
Provides-Extra: embeddings
|
39
41
|
Provides-Extra: colpali
|
40
42
|
Provides-Extra: lancedb
|
43
|
+
Provides-Extra: pydantic
|
41
44
|
Provides-Extra: all
|
42
45
|
License-File: THIRD_PARTY_NOTICES.html
|
43
46
|
Summary: With CocoIndex, users declare the transformation, CocoIndex creates & maintains an index, and keeps the derived index up to date based on source update, with minimal computation and changes.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
cocoindex-0.2.17.dist-info/METADATA,sha256=VT02gV4JvKs_nxD1w68zXfgsvVhCyHjObsZiuux-s74,13444
|
2
|
+
cocoindex-0.2.17.dist-info/WHEEL,sha256=BPcpVNWh7abDWQ6kKt5q-RuYwIKzww408C4ilVLQQjU,103
|
3
|
+
cocoindex-0.2.17.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
|
4
|
+
cocoindex-0.2.17.dist-info/licenses/THIRD_PARTY_NOTICES.html,sha256=T4xZEO3pHeY2VJKPgFiBzPezNc5aUPqHtK2HGNdGMkE,718076
|
5
|
+
cocoindex/__init__.py,sha256=6qZWVkK4WZ01BIAg3CPh_bRRdA6Clk4d4Q6OnZ2jFa4,2630
|
6
|
+
cocoindex/_engine.abi3.so,sha256=ZH-5NTfoIzha37qEqM-6GAJz73BArLaIHV1tMm2Pa7A,70831552
|
7
|
+
cocoindex/auth_registry.py,sha256=g-uLDWLYW5NMbYe7q4Y-sU5dSyrlJXBEciyWtAiP9KE,1340
|
8
|
+
cocoindex/cli.py,sha256=19IszBXOzqGn0xOV1SaS-oR9NupTmIm18uzFNET7NTQ,23978
|
9
|
+
cocoindex/engine_object.py,sha256=5YTuWoR3WILhyt3PW-d9es3MAas_xD6tZZqvipN-sjg,10050
|
10
|
+
cocoindex/engine_value.py,sha256=8M7MbwVG2bfd3kFptGGbQHBAp9pD3TVjrBiBDOAhD5M,23211
|
11
|
+
cocoindex/flow.py,sha256=JWPTR2G6TdPJkO5ZlrCcyDyQ8utUS4zZWNR8zsHTeW8,40074
|
12
|
+
cocoindex/functions.py,sha256=V4ljBnCprvA25XlCVvNLwK5ergXiEcKU76jkOGC-X3A,12882
|
13
|
+
cocoindex/functions/__init__.py,sha256=RUFel0JtG42Er27OCbroHUaOmi07ffsIeUux5Ka0r-s,1083
|
14
|
+
cocoindex/functions/_engine_builtin_specs.py,sha256=zeEbXmbw26ys4B9AgDHsm1iZqsB_Oskk-Ue-bxuye-Q,1681
|
15
|
+
cocoindex/functions/colpali.py,sha256=oACyG3qG2dquyCJ6bT7FkMkua5rXDLSxnOHcgoz9waU,8865
|
16
|
+
cocoindex/functions/sbert.py,sha256=1z5OJT-blXT6tVN5vEvEzvYAzOnzs1RCnu1UbCUP6wM,2162
|
17
|
+
cocoindex/index.py,sha256=tz5ilvmOp0BtroGehCQDqWK_pIX9m6ghkhcxsDVU8WE,982
|
18
|
+
cocoindex/lib.py,sha256=spfdU4IbzdffHyGdrQPIw_qGo9aX0OAAboqsjj8bTiQ,2290
|
19
|
+
cocoindex/llm.py,sha256=Pv_cdnRngTLtuLU9AUmS8izIHhcKVnuBNolC33f9BDI,851
|
20
|
+
cocoindex/op.py,sha256=Ycvr6lJf7hcCCjYUqHtXZqzSeDD-FQdP3_jcmZUV_zI,26896
|
21
|
+
cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
+
cocoindex/query_handler.py,sha256=X-SQT71LHiOOXn6-TJlQcGodJk-iT8p_1TcIMvRLBRI,1344
|
23
|
+
cocoindex/runtime.py,sha256=4NxcltaDZvA3RR3Pnt6gH_f99jcWSyMH_1Xi5BjbtwY,1342
|
24
|
+
cocoindex/setting.py,sha256=1Dx8ktjwf-8BiXrbsmfn5Mzudb2SQYqFdRnSNGVKaLk,4960
|
25
|
+
cocoindex/setup.py,sha256=7uIHKN4FOCuoidPXcKyGTrkqpkl9luL49-6UcnMxYzw,3068
|
26
|
+
cocoindex/sources/__init__.py,sha256=Yu9VHNaGlOEE3jpqfIseswsg25Le3HzwDr6XJAn22Ns,78
|
27
|
+
cocoindex/sources/_engine_builtin_specs.py,sha256=NI4Uq6ffX5nfsgzneDErSBK4YH8hccaYj-InEBihJpo,3191
|
28
|
+
cocoindex/subprocess_exec.py,sha256=r1xO84uek4VP4I6i87JMwsH5xFm3vKW0ABvgn0jskt4,10088
|
29
|
+
cocoindex/targets/__init__.py,sha256=HQG7I4U0xQhHiYctiUvwEBLxT2727oHP3xwrqotjmhk,78
|
30
|
+
cocoindex/targets/_engine_builtin_specs.py,sha256=kiIIpPBwSfIYjZpcEBszKSGHytkWsvTqL-C8DXL9dD4,3032
|
31
|
+
cocoindex/targets/lancedb.py,sha256=1nzCre5p-fvKkmLOTvfpiLTfnhF3qMLqTvsTwNuGwVU,15749
|
32
|
+
cocoindex/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
+
cocoindex/tests/test_engine_object.py,sha256=9llG3jMyP9_hM8FT4VXagCBh8qWU8U9_U5a2mLXiQ-4,11238
|
34
|
+
cocoindex/tests/test_engine_value.py,sha256=QOmHAWz2lofiVoTCdbyzWZqJZsIDNi9R-NZafqjpuuM,55254
|
35
|
+
cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt3Jt_9df4Cgdc,8506
|
36
|
+
cocoindex/tests/test_transform_flow.py,sha256=G69w-n-vnCTo3r9hVIk2lJNAQEkGUA7PZfHsXna3oS0,6030
|
37
|
+
cocoindex/tests/test_typing.py,sha256=JoR-oMK-ZWjOGQi0pH5Etg5jp4oL_JSIreGBH247GCg,16291
|
38
|
+
cocoindex/tests/test_validation.py,sha256=X6AQzVs-hVKIXcrHMEMQnhfUE8at7iXQnPq8nHNhZ2Q,4543
|
39
|
+
cocoindex/typing.py,sha256=so_RusbhBmg_uLoZTY7W_pqU0aIJwFarkTF5NQufl4o,23944
|
40
|
+
cocoindex/user_app_loader.py,sha256=bc3Af-gYRxJ9GpObtpjegZY855oQBCv5FGkrkWV2yGY,1873
|
41
|
+
cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
|
42
|
+
cocoindex/validation.py,sha256=PZnJoby4sLbsmPv9fOjOQXuefjfZ7gmtsiTGU8SH-tc,3090
|
43
|
+
cocoindex-0.2.17.dist-info/RECORD,,
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
<h2>Overview of licenses:</h2>
|
46
46
|
<ul class="licenses-overview">
|
47
|
-
<li><a href="#Apache-2.0">Apache License 2.0</a> (
|
47
|
+
<li><a href="#Apache-2.0">Apache License 2.0</a> (415)</li>
|
48
48
|
<li><a href="#MIT">MIT License</a> (125)</li>
|
49
49
|
<li><a href="#Unicode-3.0">Unicode License v3</a> (19)</li>
|
50
50
|
<li><a href="#ISC">ISC License</a> (8)</li>
|
@@ -691,7 +691,7 @@
|
|
691
691
|
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
692
692
|
<h4>Used by:</h4>
|
693
693
|
<ul class="license-used-by">
|
694
|
-
<li><a href=" https://github.com/jhpratt/deranged ">deranged 0.4
|
694
|
+
<li><a href=" https://github.com/jhpratt/deranged ">deranged 0.5.4</a></li>
|
695
695
|
</ul>
|
696
696
|
<pre class="license-text">
|
697
697
|
Apache License
|
@@ -2428,7 +2428,7 @@ Software.
|
|
2428
2428
|
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
2429
2429
|
<h4>Used by:</h4>
|
2430
2430
|
<ul class="license-used-by">
|
2431
|
-
<li><a href=" https://crates.io/crates/cocoindex ">cocoindex 0.2.
|
2431
|
+
<li><a href=" https://crates.io/crates/cocoindex ">cocoindex 0.2.17</a></li>
|
2432
2432
|
<li><a href=" https://github.com/awesomized/crc-fast-rust ">crc-fast 1.3.0</a></li>
|
2433
2433
|
<li><a href=" https://github.com/qdrant/rust-client ">qdrant-client 1.15.0</a></li>
|
2434
2434
|
</ul>
|
@@ -6891,6 +6891,7 @@ limitations under the License.
|
|
6891
6891
|
<li><a href=" https://github.com/smol-rs/event-listener-strategy ">event-listener-strategy 0.5.4</a></li>
|
6892
6892
|
<li><a href=" https://github.com/smol-rs/event-listener ">event-listener 2.5.3</a></li>
|
6893
6893
|
<li><a href=" https://github.com/smol-rs/event-listener ">event-listener 5.4.1</a></li>
|
6894
|
+
<li><a href=" https://github.com/rust-analyzer/expect-test ">expect-test 1.5.1</a></li>
|
6894
6895
|
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 1.9.0</a></li>
|
6895
6896
|
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 2.3.0</a></li>
|
6896
6897
|
<li><a href=" https://github.com/rust-lang/flate2-rs ">flate2 1.1.2</a></li>
|
@@ -9540,22 +9541,23 @@ limitations under the License.
|
|
9540
9541
|
<li><a href=" https://github.com/elastio/bon ">bon-macros 3.7.0</a></li>
|
9541
9542
|
<li><a href=" https://github.com/elastio/bon ">bon 3.7.0</a></li>
|
9542
9543
|
<li><a href=" https://github.com/kobzol/rust-delegate ">delegate 0.10.0</a></li>
|
9544
|
+
<li><a href=" https://github.com/dtolnay/dissimilar ">dissimilar 1.0.10</a></li>
|
9543
9545
|
<li><a href=" https://gitlab.com/kornelski/dunce ">dunce 1.0.5</a></li>
|
9544
9546
|
<li><a href=" https://github.com/dtolnay/dyn-clone ">dyn-clone 1.0.20</a></li>
|
9545
9547
|
<li><a href=" https://github.com/dtolnay/erased-serde ">erased-serde 0.4.6</a></li>
|
9546
9548
|
<li><a href=" https://github.com/lunacookies/etcetera ">etcetera 0.8.0</a></li>
|
9547
9549
|
<li><a href=" https://github.com/jpopesculian/eventsource-stream ">eventsource-stream 0.2.3</a></li>
|
9548
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-aiplatform-v1 0.4.
|
9549
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-api 0.4.
|
9550
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-auth 0.22.
|
9551
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-gax-internal 0.5.
|
9552
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-gax 0.
|
9553
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-iam-v1 0.4.
|
9554
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-location 0.4.
|
9555
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-longrunning 0.25.
|
9556
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-lro 0.3.
|
9557
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-rpc 0.4.
|
9558
|
-
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-type 0.4.
|
9550
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-aiplatform-v1 0.4.5</a></li>
|
9551
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-api 0.4.5</a></li>
|
9552
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-auth 0.22.4</a></li>
|
9553
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-gax-internal 0.5.1</a></li>
|
9554
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-gax 0.24.0</a></li>
|
9555
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-iam-v1 0.4.5</a></li>
|
9556
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-location 0.4.5</a></li>
|
9557
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-longrunning 0.25.5</a></li>
|
9558
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-lro 0.3.5</a></li>
|
9559
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-rpc 0.4.5</a></li>
|
9560
|
+
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-type 0.4.5</a></li>
|
9559
9561
|
<li><a href=" https://github.com/googleapis/google-cloud-rust/tree/main ">google-cloud-wkt 0.5.4</a></li>
|
9560
9562
|
<li><a href=" https://github.com/TedDriggs/ident_case ">ident_case 1.0.1</a></li>
|
9561
9563
|
<li><a href=" https://github.com/yaahc/indenter ">indenter 0.3.4</a></li>
|
@@ -9587,8 +9589,9 @@ limitations under the License.
|
|
9587
9589
|
<li><a href=" https://github.com/dtolnay/ryu ">ryu 1.0.20</a></li>
|
9588
9590
|
<li><a href=" https://github.com/dtolnay/semver ">semver 1.0.26</a></li>
|
9589
9591
|
<li><a href=" https://github.com/dtolnay/serde-untagged ">serde-untagged 0.1.8</a></li>
|
9590
|
-
<li><a href=" https://github.com/serde-rs/serde ">serde 1.0.
|
9591
|
-
<li><a href=" https://github.com/serde-rs/serde ">
|
9592
|
+
<li><a href=" https://github.com/serde-rs/serde ">serde 1.0.228</a></li>
|
9593
|
+
<li><a href=" https://github.com/serde-rs/serde ">serde_core 1.0.228</a></li>
|
9594
|
+
<li><a href=" https://github.com/serde-rs/serde ">serde_derive 1.0.228</a></li>
|
9592
9595
|
<li><a href=" https://github.com/serde-rs/serde ">serde_derive_internals 0.29.1</a></li>
|
9593
9596
|
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.142</a></li>
|
9594
9597
|
<li><a href=" https://github.com/dtolnay/path-to-error ">serde_path_to_error 0.1.17</a></li>
|
@@ -9602,9 +9605,9 @@ limitations under the License.
|
|
9602
9605
|
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 2.0.14</a></li>
|
9603
9606
|
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror 1.0.69</a></li>
|
9604
9607
|
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror 2.0.14</a></li>
|
9605
|
-
<li><a href=" https://github.com/time-rs/time ">time-core 0.1.
|
9606
|
-
<li><a href=" https://github.com/time-rs/time ">time-macros 0.2.
|
9607
|
-
<li><a href=" https://github.com/time-rs/time ">time 0.3.
|
9608
|
+
<li><a href=" https://github.com/time-rs/time ">time-core 0.1.6</a></li>
|
9609
|
+
<li><a href=" https://github.com/time-rs/time ">time-macros 0.2.24</a></li>
|
9610
|
+
<li><a href=" https://github.com/time-rs/time ">time 0.3.44</a></li>
|
9608
9611
|
<li><a href=" https://github.com/dtolnay/typeid ">typeid 1.0.3</a></li>
|
9609
9612
|
<li><a href=" https://github.com/dtolnay/unicode-ident ">unicode-ident 1.0.18</a></li>
|
9610
9613
|
<li><a href=" https://github.com/dtolnay/indoc ">unindent 0.2.4</a></li>
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import dataclasses
|
2
|
-
import datetime
|
3
|
-
from typing import TypedDict, NamedTuple
|
4
|
-
|
5
|
-
import numpy as np
|
6
|
-
from numpy.typing import NDArray
|
7
|
-
|
8
|
-
from cocoindex.convert import dump_engine_object, load_engine_object
|
9
|
-
|
10
|
-
|
11
|
-
@dataclasses.dataclass
|
12
|
-
class LocalTargetFieldMapping:
|
13
|
-
source: str
|
14
|
-
target: str | None = None
|
15
|
-
|
16
|
-
|
17
|
-
@dataclasses.dataclass
|
18
|
-
class LocalNodeFromFields:
|
19
|
-
label: str
|
20
|
-
fields: list[LocalTargetFieldMapping]
|
21
|
-
|
22
|
-
|
23
|
-
@dataclasses.dataclass
|
24
|
-
class LocalNodes:
|
25
|
-
kind = "Node"
|
26
|
-
label: str
|
27
|
-
|
28
|
-
|
29
|
-
@dataclasses.dataclass
|
30
|
-
class LocalRelationships:
|
31
|
-
kind = "Relationship"
|
32
|
-
rel_type: str
|
33
|
-
source: LocalNodeFromFields
|
34
|
-
target: LocalNodeFromFields
|
35
|
-
|
36
|
-
|
37
|
-
class LocalPoint(NamedTuple):
|
38
|
-
x: int
|
39
|
-
y: int
|
40
|
-
|
41
|
-
|
42
|
-
class UserInfo(TypedDict):
|
43
|
-
id: str
|
44
|
-
age: int
|
45
|
-
|
46
|
-
|
47
|
-
def test_timedelta_roundtrip_via_dump_load() -> None:
|
48
|
-
td = datetime.timedelta(days=1, hours=2, minutes=3, seconds=4, microseconds=500)
|
49
|
-
dumped = dump_engine_object(td)
|
50
|
-
loaded = load_engine_object(datetime.timedelta, dumped)
|
51
|
-
assert isinstance(loaded, datetime.timedelta)
|
52
|
-
assert loaded == td
|
53
|
-
|
54
|
-
|
55
|
-
def test_ndarray_roundtrip_via_dump_load() -> None:
|
56
|
-
value: NDArray[np.float32] = np.array([1.0, 2.0, 3.0], dtype=np.float32)
|
57
|
-
dumped = dump_engine_object(value)
|
58
|
-
assert dumped == [1.0, 2.0, 3.0]
|
59
|
-
loaded = load_engine_object(NDArray[np.float32], dumped)
|
60
|
-
assert isinstance(loaded, np.ndarray)
|
61
|
-
assert loaded.dtype == np.float32
|
62
|
-
assert np.array_equal(loaded, value)
|
63
|
-
|
64
|
-
|
65
|
-
def test_nodes_kind_is_carried() -> None:
|
66
|
-
node = LocalNodes(label="User")
|
67
|
-
dumped = dump_engine_object(node)
|
68
|
-
# dumped should include discriminator
|
69
|
-
assert dumped.get("kind") == "Node"
|
70
|
-
# load back
|
71
|
-
loaded = load_engine_object(LocalNodes, dumped)
|
72
|
-
assert isinstance(loaded, LocalNodes)
|
73
|
-
# class-level attribute is preserved
|
74
|
-
assert getattr(loaded, "kind", None) == "Node"
|
75
|
-
assert loaded.label == "User"
|
76
|
-
|
77
|
-
|
78
|
-
def test_relationships_union_discriminator() -> None:
|
79
|
-
rel = LocalRelationships(
|
80
|
-
rel_type="LIKES",
|
81
|
-
source=LocalNodeFromFields(
|
82
|
-
label="User", fields=[LocalTargetFieldMapping("id")]
|
83
|
-
),
|
84
|
-
target=LocalNodeFromFields(
|
85
|
-
label="Item", fields=[LocalTargetFieldMapping("id")]
|
86
|
-
),
|
87
|
-
)
|
88
|
-
dumped = dump_engine_object(rel)
|
89
|
-
assert dumped.get("kind") == "Relationship"
|
90
|
-
loaded = load_engine_object(LocalNodes | LocalRelationships, dumped)
|
91
|
-
assert isinstance(loaded, LocalRelationships)
|
92
|
-
assert getattr(loaded, "kind", None) == "Relationship"
|
93
|
-
assert loaded.rel_type == "LIKES"
|
94
|
-
assert dataclasses.asdict(loaded.source) == {
|
95
|
-
"label": "User",
|
96
|
-
"fields": [{"source": "id", "target": None}],
|
97
|
-
}
|
98
|
-
assert dataclasses.asdict(loaded.target) == {
|
99
|
-
"label": "Item",
|
100
|
-
"fields": [{"source": "id", "target": None}],
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
def test_typed_dict_roundtrip_via_dump_load() -> None:
|
105
|
-
user: UserInfo = {"id": "u1", "age": 30}
|
106
|
-
dumped = dump_engine_object(user)
|
107
|
-
assert dumped == {"id": "u1", "age": 30}
|
108
|
-
loaded = load_engine_object(UserInfo, dumped)
|
109
|
-
assert loaded == user
|
110
|
-
|
111
|
-
|
112
|
-
def test_namedtuple_roundtrip_via_dump_load() -> None:
|
113
|
-
p = LocalPoint(1, 2)
|
114
|
-
dumped = dump_engine_object(p)
|
115
|
-
assert dumped == {"x": 1, "y": 2}
|
116
|
-
loaded = load_engine_object(LocalPoint, dumped)
|
117
|
-
assert isinstance(loaded, LocalPoint)
|
118
|
-
assert loaded == p
|
@@ -1,37 +0,0 @@
|
|
1
|
-
cocoindex-0.2.16.dist-info/METADATA,sha256=PlewUqWQWLCwQG8HT1lJed7JG9nyvPH61KjhNB_3U7Q,13316
|
2
|
-
cocoindex-0.2.16.dist-info/WHEEL,sha256=cVaoL47Ex1FxzwnkO_WCjy3a1Wl6mtZbBPTvTiNCHdY,103
|
3
|
-
cocoindex-0.2.16.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
|
4
|
-
cocoindex-0.2.16.dist-info/licenses/THIRD_PARTY_NOTICES.html,sha256=fxZXw4-pEtDeJix0DJuH2VrSsp0CTjsExMxjxU4p0ds,717769
|
5
|
-
cocoindex/__init__.py,sha256=6qZWVkK4WZ01BIAg3CPh_bRRdA6Clk4d4Q6OnZ2jFa4,2630
|
6
|
-
cocoindex/_engine.abi3.so,sha256=2Y9v-N3-aPPrMa4jy-zAQ1rF5jtXh7u2NzuzuU23Ka0,67289392
|
7
|
-
cocoindex/auth_registry.py,sha256=_DOIY42C79joLCY_XczHwP5uebkmSavweoAHc0L3hQY,1334
|
8
|
-
cocoindex/cli.py,sha256=69X30bFTFdM7c0_6lgIHR19CeQ7UEkobEQYihy8IdOQ,21599
|
9
|
-
cocoindex/convert.py,sha256=itkUBCriOk8fdauahHRqJ-L8mnHehNZsBe_FouN0K1Q,28695
|
10
|
-
cocoindex/flow.py,sha256=oAFerPoarOS9XWVumYIzT4EHJyV3Pixv2mfqpCLHNOw,39849
|
11
|
-
cocoindex/functions.py,sha256=V4ljBnCprvA25XlCVvNLwK5ergXiEcKU76jkOGC-X3A,12882
|
12
|
-
cocoindex/index.py,sha256=tz5ilvmOp0BtroGehCQDqWK_pIX9m6ghkhcxsDVU8WE,982
|
13
|
-
cocoindex/lib.py,sha256=0XheDF7fiFdqExpdqzU-VKun_Zll6DwZ5JfTm7u42aY,2284
|
14
|
-
cocoindex/llm.py,sha256=Pv_cdnRngTLtuLU9AUmS8izIHhcKVnuBNolC33f9BDI,851
|
15
|
-
cocoindex/op.py,sha256=c1xzoiWoPb6PYiCQAUsyzMRJwPvWaC3o5emPk38oY-4,26551
|
16
|
-
cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
cocoindex/query_handler.py,sha256=X-SQT71LHiOOXn6-TJlQcGodJk-iT8p_1TcIMvRLBRI,1344
|
18
|
-
cocoindex/runtime.py,sha256=4NxcltaDZvA3RR3Pnt6gH_f99jcWSyMH_1Xi5BjbtwY,1342
|
19
|
-
cocoindex/setting.py,sha256=1Dx8ktjwf-8BiXrbsmfn5Mzudb2SQYqFdRnSNGVKaLk,4960
|
20
|
-
cocoindex/setup.py,sha256=7uIHKN4FOCuoidPXcKyGTrkqpkl9luL49-6UcnMxYzw,3068
|
21
|
-
cocoindex/sources.py,sha256=FYz7cWYasLGDaYoIEQ1dF2uprgUETHWsTIrIS7n6pQE,3188
|
22
|
-
cocoindex/subprocess_exec.py,sha256=r1xO84uek4VP4I6i87JMwsH5xFm3vKW0ABvgn0jskt4,10088
|
23
|
-
cocoindex/targets/__init__.py,sha256=HQG7I4U0xQhHiYctiUvwEBLxT2727oHP3xwrqotjmhk,78
|
24
|
-
cocoindex/targets/_engine_builtin_specs.py,sha256=DM7vyO0pkoukA-aBbvm_J4irgXhXIEqWdp-hwVpVRU4,2800
|
25
|
-
cocoindex/targets/lancedb.py,sha256=1nzCre5p-fvKkmLOTvfpiLTfnhF3qMLqTvsTwNuGwVU,15749
|
26
|
-
cocoindex/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
-
cocoindex/tests/test_convert.py,sha256=pG1AkEdIKSRE0trMV2dQ6VSQEqQJnPTJzfQCVrZSz8w,50791
|
28
|
-
cocoindex/tests/test_load_convert.py,sha256=XHuXhgLcazniEYrhoz_L5RFvgUwu-iy3EB9zgR6p95A,3339
|
29
|
-
cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt3Jt_9df4Cgdc,8506
|
30
|
-
cocoindex/tests/test_transform_flow.py,sha256=G69w-n-vnCTo3r9hVIk2lJNAQEkGUA7PZfHsXna3oS0,6030
|
31
|
-
cocoindex/tests/test_typing.py,sha256=JoR-oMK-ZWjOGQi0pH5Etg5jp4oL_JSIreGBH247GCg,16291
|
32
|
-
cocoindex/tests/test_validation.py,sha256=X6AQzVs-hVKIXcrHMEMQnhfUE8at7iXQnPq8nHNhZ2Q,4543
|
33
|
-
cocoindex/typing.py,sha256=jZO3meRVL_RsFdhj8Sx6gWF-Z207VhoPtb1ZmqzAnH0,19974
|
34
|
-
cocoindex/user_app_loader.py,sha256=bc3Af-gYRxJ9GpObtpjegZY855oQBCv5FGkrkWV2yGY,1873
|
35
|
-
cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
|
36
|
-
cocoindex/validation.py,sha256=PZnJoby4sLbsmPv9fOjOQXuefjfZ7gmtsiTGU8SH-tc,3090
|
37
|
-
cocoindex-0.2.16.dist-info/RECORD,,
|
File without changes
|