cocoindex 0.1.51__cp312-cp312-macosx_10_12_x86_64.whl → 0.1.52__cp312-cp312-macosx_10_12_x86_64.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/__init__.py CHANGED
@@ -2,7 +2,9 @@
2
2
  Cocoindex is a framework for building and running indexing pipelines.
3
3
  """
4
4
 
5
- from . import functions, sources, storages, cli, utils
5
+ from . import functions, sources, targets, cli, utils
6
+
7
+ from . import targets as storages # Deprecated: Use targets instead
6
8
 
7
9
  from .auth_registry import AuthEntryReference, add_auth_entry, ref_auth_entry
8
10
  from .flow import FlowBuilder, DataScope, DataSlice, Flow, transform_flow
@@ -21,6 +23,7 @@ __all__ = [
21
23
  "_engine",
22
24
  "functions",
23
25
  "sources",
26
+ "targets",
24
27
  "storages",
25
28
  "cli",
26
29
  "utils",
Binary file
cocoindex/cli.py CHANGED
@@ -247,8 +247,7 @@ def show(app_flow_specifier: str, color: bool, verbose: bool) -> None:
247
247
  )
248
248
  def setup(app_target: str, force: bool) -> None:
249
249
  """
250
- Check and apply backend setup changes for flows, including the internal and target storage
251
- (to export).
250
+ Check and apply backend setup changes for flows, including the internal storage and target (to export to).
252
251
 
253
252
  APP_TARGET: path/to/app.py or installed_module.
254
253
  """
cocoindex/flow.py CHANGED
@@ -327,7 +327,7 @@ class DataCollector:
327
327
  def export(
328
328
  self,
329
329
  name: str,
330
- target_spec: op.StorageSpec,
330
+ target_spec: op.TargetSpec,
331
331
  /,
332
332
  *,
333
333
  primary_key_fields: Sequence[str],
@@ -340,7 +340,7 @@ class DataCollector:
340
340
 
341
341
  `vector_index` is for backward compatibility only. Please use `vector_indexes` instead.
342
342
  """
343
- if not isinstance(target_spec, op.StorageSpec):
343
+ if not isinstance(target_spec, op.TargetSpec):
344
344
  raise ValueError(
345
345
  "export() can only be called on a CocoIndex target storage"
346
346
  )
cocoindex/op.py CHANGED
@@ -19,7 +19,7 @@ class OpCategory(Enum):
19
19
 
20
20
  FUNCTION = "function"
21
21
  SOURCE = "source"
22
- STORAGE = "storage"
22
+ TARGET = "target"
23
23
  DECLARATION = "declaration"
24
24
 
25
25
 
@@ -52,8 +52,8 @@ class FunctionSpec(metaclass=SpecMeta, category=OpCategory.FUNCTION): # pylint:
52
52
  """A function spec. All its subclass can be instantiated similar to a dataclass, i.e. ClassName(field1=value1, field2=value2, ...)"""
53
53
 
54
54
 
55
- class StorageSpec(metaclass=SpecMeta, category=OpCategory.STORAGE): # pylint: disable=too-few-public-methods
56
- """A storage spec. All its subclass can be instantiated similar to a dataclass, i.e. ClassName(field1=value1, field2=value2, ...)"""
55
+ class TargetSpec(metaclass=SpecMeta, category=OpCategory.TARGET): # pylint: disable=too-few-public-methods
56
+ """A target spec. All its subclass can be instantiated similar to a dataclass, i.e. ClassName(field1=value1, field2=value2, ...)"""
57
57
 
58
58
 
59
59
  class DeclarationSpec(metaclass=SpecMeta, category=OpCategory.DECLARATION): # pylint: disable=too-few-public-methods
@@ -1,4 +1,4 @@
1
- """All builtin storages."""
1
+ """All builtin targets."""
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from typing import Sequence
@@ -9,8 +9,8 @@ from .auth_registry import AuthEntryReference
9
9
  from .setting import DatabaseConnectionSpec
10
10
 
11
11
 
12
- class Postgres(op.StorageSpec):
13
- """Storage powered by Postgres and pgvector."""
12
+ class Postgres(op.TargetSpec):
13
+ """Target powered by Postgres and pgvector."""
14
14
 
15
15
  database: AuthEntryReference[DatabaseConnectionSpec] | None = None
16
16
  table_name: str | None = None
@@ -25,8 +25,8 @@ class QdrantConnection:
25
25
 
26
26
 
27
27
  @dataclass
28
- class Qdrant(op.StorageSpec):
29
- """Storage powered by Qdrant - https://qdrant.tech/."""
28
+ class Qdrant(op.TargetSpec):
29
+ """Target powered by Qdrant - https://qdrant.tech/."""
30
30
 
31
31
  collection_name: str
32
32
  connection: AuthEntryReference[QdrantConnection] | None = None
@@ -52,7 +52,7 @@ class NodeFromFields:
52
52
 
53
53
  @dataclass
54
54
  class ReferencedNode:
55
- """Storage spec for a graph node."""
55
+ """Target spec for a graph node."""
56
56
 
57
57
  label: str
58
58
  primary_key_fields: Sequence[str]
@@ -95,7 +95,7 @@ class Neo4jConnection:
95
95
  db: str | None = None
96
96
 
97
97
 
98
- class Neo4j(op.StorageSpec):
98
+ class Neo4j(op.TargetSpec):
99
99
  """Graph storage powered by Neo4j."""
100
100
 
101
101
  connection: AuthEntryReference[Neo4jConnection]
@@ -119,7 +119,7 @@ class KuzuConnection:
119
119
  api_server_url: str
120
120
 
121
121
 
122
- class Kuzu(op.StorageSpec):
122
+ class Kuzu(op.TargetSpec):
123
123
  """Graph storage powered by Kuzu."""
124
124
 
125
125
  connection: AuthEntryReference[KuzuConnection]
cocoindex/utils.py CHANGED
@@ -2,12 +2,10 @@ from .flow import Flow
2
2
  from .setting import get_app_namespace
3
3
 
4
4
 
5
- def get_target_storage_default_name(
6
- flow: Flow, target_name: str, delimiter: str = "__"
7
- ) -> str:
5
+ def get_target_default_name(flow: Flow, target_name: str, delimiter: str = "__") -> str:
8
6
  """
9
7
  Get the default name for a target.
10
- It's used as the underlying storage name (e.g. a table, a collection, etc.) followed by most storage backends, if not explicitly specified.
8
+ It's used as the underlying target name (e.g. a table, a collection, etc.) followed by most targets, if not explicitly specified.
11
9
  """
12
10
  return (
13
11
  get_app_namespace(trailing_delimiter=delimiter)
@@ -15,3 +13,8 @@ def get_target_storage_default_name(
15
13
  + delimiter
16
14
  + target_name
17
15
  )
16
+
17
+
18
+ get_target_storage_default_name = (
19
+ get_target_default_name # Deprecated: Use get_target_default_name instead
20
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.51
3
+ Version: 0.1.52
4
4
  Requires-Dist: sentence-transformers>=3.3.1
5
5
  Requires-Dist: click>=8.1.8
6
6
  Requires-Dist: rich>=14.0.0
@@ -130,7 +130,7 @@ def text_embedding_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoind
130
130
  # Export collected data to a vector index.
131
131
  doc_embeddings.export(
132
132
  "doc_embeddings",
133
- cocoindex.storages.Postgres(),
133
+ cocoindex.targets.Postgres(),
134
134
  primary_key_fields=["filename", "location"],
135
135
  vector_indexes=[
136
136
  cocoindex.VectorIndexDef(
@@ -1,28 +1,28 @@
1
- cocoindex-0.1.51.dist-info/METADATA,sha256=A88vlfjkMZq9o0uB23j60uueJrzBs7RPf38zSHP6MuY,9875
2
- cocoindex-0.1.51.dist-info/WHEEL,sha256=l1vhwtWCYEW2jwRYHpKxbN3fl_lgdUpY7Hrp_A4sC3c,106
3
- cocoindex-0.1.51.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
- cocoindex-0.1.51.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
- cocoindex/__init__.py,sha256=H0YmqZaLBNLtY4PWYM1w9lM_HbiGGh2xEwo1_NMDOOE,1698
6
- cocoindex/_engine.cpython-312-darwin.so,sha256=e7ubtPd1Y6ppVTsUaxuhzuJtdgcpFISfIqpr9Jd8_mU,59681300
1
+ cocoindex-0.1.52.dist-info/METADATA,sha256=8psE6rLZFYrw7cBEU-rVD1JGf4ezIIHMn-Yk2ZVNEKY,9874
2
+ cocoindex-0.1.52.dist-info/WHEEL,sha256=l1vhwtWCYEW2jwRYHpKxbN3fl_lgdUpY7Hrp_A4sC3c,106
3
+ cocoindex-0.1.52.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
+ cocoindex-0.1.52.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ cocoindex/__init__.py,sha256=3potlGouaGAznMTEqU5QKuB934qpD1xR6ZH6EL3YMWw,1782
6
+ cocoindex/_engine.cpython-312-darwin.so,sha256=LG1dO26uT5wut_6VyPWYX6KklzfZ4GGZOwBlXoUul3w,59680900
7
7
  cocoindex/auth_registry.py,sha256=1XqO7ibjmBBd8i11XSJTvTgdz8p1ptW-ZpuSgo_5zzk,716
8
- cocoindex/cli.py,sha256=mlHIgH8vgf4PuTYifAOtn2ywcbVCOT452pIg376uPLs,18224
8
+ cocoindex/cli.py,sha256=joSucqLibjZHs27fwNPzuMPGLeVJJZqaUbeSM-OnEyA,18223
9
9
  cocoindex/convert.py,sha256=s5T2IQ1tMBT9JKTzqQtQ-I0sUrfjBGKAnMjDjY6LdrI,8785
10
- cocoindex/flow.py,sha256=sC7eg0L9MkZuo7MlvGA4eYe-mEReIyPjKIILFtkWm-Y,30017
10
+ cocoindex/flow.py,sha256=uQKvIyWSysSdhNFI87QD6f2kbF-2R6zFMLZWBEk4rZU,30015
11
11
  cocoindex/functions.py,sha256=9A61Jj5a3vQoI2MIAhjXvJrDxSzDhe6VncQWbiVtwcg,2393
12
12
  cocoindex/index.py,sha256=j93B9jEvvLXHtpzKWL88SY6wCGEoPgpsQhEGHlyYGFg,540
13
13
  cocoindex/lib.py,sha256=BeRUn3RqE_wSsVtsgCzbFFKe1LXgRyRmMOcmwWBuEXo,2940
14
14
  cocoindex/llm.py,sha256=KO-R4mrAWtxXD82-Yv5ixpkKMVfkwpbdWwqPVZygLu4,352
15
- cocoindex/op.py,sha256=hOJoHC8elhLHMNVRTGTBWNSK5uYrQb-FfRV-qt08j8g,11815
15
+ cocoindex/op.py,sha256=Z7V9Fdz4qeTeozzKmp1Dk1lPUP0GBgVgD_vBEhTJS5Y,11810
16
16
  cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  cocoindex/runtime.py,sha256=bAdHYaXFWiiUWyAgzmKTeaAaRR0D_AmaqVCIdPO-v00,1056
18
18
  cocoindex/setting.py,sha256=Zl8K86r8RVvG9c3pCsH0Ot8BHhDAQAQCjoBp7TnXMLQ,3590
19
19
  cocoindex/setup.py,sha256=u5dYZFKfz4yZLiGHD0guNaR0s4zY9JAoZWrWHpAHw_0,773
20
20
  cocoindex/sources.py,sha256=JCnOhv1w4o28e03i7yvo4ESicWYAhckkBg5bQlxNH4U,1330
21
- cocoindex/storages.py,sha256=i9cPzj5LbLJVHjskEWyltUXF9kqCyc6ftMEqll6FDwI,2804
21
+ cocoindex/targets.py,sha256=Nfh_tpFd1goTnS_cxBjIs4j9zl3Z4Z1JomAQ1dl3Sic,2796
22
22
  cocoindex/tests/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
23
23
  cocoindex/tests/test_convert.py,sha256=mlCJ1U_T7sPDk1Dw78V1BKaYbfqjDjGAaOZT0zMYOwg,28960
24
24
  cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt3Jt_9df4Cgdc,8506
25
25
  cocoindex/tests/test_typing.py,sha256=4cy_6kPyGxsM6qX-O8K-jXhsgDr_FXePplERgky22qI,12313
26
26
  cocoindex/typing.py,sha256=PEV_ds7AGHAHkZmX_fWg-2mFiEXDx-V-Rlhv11_8rtk,12387
27
- cocoindex/utils.py,sha256=5a3ubVzDowJUJyUl8ecd75Th_OzON3G-MV2vXf0dQSk,503
28
- cocoindex-0.1.51.dist-info/RECORD,,
27
+ cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
28
+ cocoindex-0.1.52.dist-info/RECORD,,