Skip to content

Commit 19e2fd8

Browse files
authored
Make clear which ctx we are using in Python (#290)
1 parent d0e0317 commit 19e2fd8

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

apis/python/src/tiledb/vector_search/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from tiledb.vector_search.module import *
88
from tiledb.vector_search.storage_formats import storage_formats
9+
from tiledb.vector_search import _tiledbvspy as vspy
910

1011
MAX_UINT64 = np.iinfo(np.dtype("uint64")).max
1112
MAX_INT32 = np.iinfo(np.dtype("int32")).max
@@ -41,7 +42,7 @@ def __init__(
4142

4243
self.uri = uri
4344
self.config = config
44-
self.ctx = Ctx(config)
45+
self.ctx = vspy.Ctx(config)
4546
self.group = tiledb.Group(self.uri, "r", ctx=tiledb.Ctx(config))
4647
self.storage_version = self.group.meta.get("storage_version", "0.1")
4748
if (

apis/python/src/tiledb/vector_search/module.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import tiledb
77
from tiledb.vector_search._tiledbvspy import *
8-
8+
from tiledb.vector_search import _tiledbvspy as vspy
99

1010
def load_as_matrix(
1111
path: str,
@@ -21,8 +21,8 @@ def load_as_matrix(
2121
----------
2222
path: str
2323
Array path
24-
ctx: Ctx
25-
TileDB context
24+
ctx: vspy.Ctx
25+
The vspy Context
2626
size: int
2727
Size of vectors to load. If not set we will read from 0 to the column domain length.
2828
"""
@@ -31,7 +31,7 @@ def load_as_matrix(
3131
config = dict(config)
3232

3333
if ctx is None:
34-
ctx = Ctx(config)
34+
ctx = vspy.Ctx(config)
3535

3636
a = tiledb.ArraySchema.load(path, ctx=tiledb.Ctx(config))
3737
dtype = a.attr(0).dtype
@@ -169,9 +169,9 @@ def ivf_index_tdb(
169169
config: Dict = None,
170170
):
171171
if config is None:
172-
ctx = Ctx({})
172+
ctx = vspy.Ctx({})
173173
else:
174-
ctx = Ctx(config)
174+
ctx = vspy.Ctx(config)
175175

176176
args = tuple(
177177
[
@@ -214,9 +214,9 @@ def ivf_index(
214214
config: Dict = None,
215215
):
216216
if config is None:
217-
ctx = Ctx({})
217+
ctx = vspy.Ctx({})
218218
else:
219-
ctx = Ctx(config)
219+
ctx = vspy.Ctx(config)
220220

221221
args = tuple(
222222
[
@@ -279,11 +279,11 @@ def ivf_query_ram(
279279
Number of nn
280280
nthreads: int
281281
Number of theads
282-
ctx: Ctx
283-
Tiledb Context
282+
ctx: vspy.Ctx
283+
The vspy Context
284284
"""
285285
if ctx is None:
286-
ctx = Ctx({})
286+
ctx = vspy.Ctx({})
287287

288288
args = tuple(
289289
[
@@ -355,13 +355,13 @@ def ivf_query(
355355
Main memory budget
356356
nthreads: int
357357
Number of theads
358-
ctx: Ctx
359-
Tiledb Context
358+
ctx: vspy.Ctx
359+
The vspy Context
360360
timestamp: int
361361
Read timestamp
362362
"""
363363
if ctx is None:
364-
ctx = Ctx({})
364+
ctx = vspy.Ctx({})
365365

366366
args = tuple(
367367
[
@@ -419,7 +419,7 @@ def dist_qv(
419419
timestamp: int = 0,
420420
):
421421
if ctx is None:
422-
ctx = Ctx({})
422+
ctx = vspy.Ctx({})
423423
args = tuple(
424424
[
425425
ctx, # 0

0 commit comments

Comments
 (0)