Registry / database / cocoindex

cocoindex

JSON →
library1.0.11pypypi✓ verified 85d ago

CocoIndex is a Python library that automatically maintains search indexes derived from declarative transformations. Users define how to transform source data into an index, and CocoIndex incrementally updates the index when sources change, minimizing recomputation. As of version 1.0.2, it requires Python >= 3.11 and is under active development with monthly releases.

pip install cocoindex
INSTALL
IMPORT
SIG · COCOINDEX
C
cocoindex
databasepythonv1.0.11
Install
5.4s avg
Import
757ms
Disk
161MB
Pass rate
3/ 10
Env Coverage3 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✓ 5.5s
py 3.12
✕ build_error
✓ 5.2s
py 3.13
✕ build_error
✓ 5.5s
py 3.9
✕ build_error
✕ build_error
161MB installed
● package 161MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cocoindex
import cocoindex
Main entry point for declaring data flows and indexes.
DataFlow
from cocoindex import DataFlow
from cocoindex._core import DataFlow
DataFlow is part of the public API; avoid internal module paths.

Minimal example: define a DataFlow subclass, transform data, and build a persistent index.

import cocoindex import os # Define a simple data flow that indexes documents into a vector index class MyIndex(cocoindex.DataFlow): def transform(self) -> None: source = self.load_csv("data/documents.csv") # columns: id, text source["embedding"] = source["text"].apply(lambda text: [0.0] * 384) # placeholder embedding self.create_index(source, on="embedding", name="documents_index") # Build the index (synchronous example) cocoindex.build(MyIndex(), output_dir="./mydb") print("Index built successfully.")
Debug
Known issues
gotchaCocoIndex does not automatically detect changes to source files; you need to trigger a rebuild explicitly for incremental updates.
fix
Use cocoindex.rebuild() or cocoindex.update() after changing source data.
affects: <=1.0.2
gotchaEmbedding generation is user's responsibility; CocoIndex only indexes the embeddings you provide. Common footgun: forgetting to generate embeddings before indexing.
fix
Provide a valid embedding vector (list of floats) for each document in the 'embedding' column.
affects: all
deprecatedThe old import from cocoindex._core classes is deprecated and will be removed in future versions.
fix
Use public API imports: from cocoindex import DataFlow, build, rebuild, etc.
affects: <=1.0.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cocoindex'
CocoIndex not installed or installed in a different environment.
fix
Run pip install cocoindex --upgrade in the correct Python environment (>=3.11).
TypeError: 'NoneType' object is not iterable when calling cocoindex.build()
The transform() method did not call self.create_index() or returned before creating the index.
fix
Ensure transform() method always creates an index by calling self.create_index() even if no data.
Upgrade
Version history
1.0.11latest on PyPI · released Jun 17, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
28
OpenAI (training)
1
Resources