Skip to content

Commit ee9262b

Browse files
authored
Add cc alias for libtiledb (#2145)
1 parent e096e6a commit ee9262b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tiledb/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ctypes
22
import os
33
import sys
4+
import warnings
45

56
if os.name == "posix":
67
if sys.platform == "darwin":
@@ -107,6 +108,29 @@
107108
__version__ = version.version
108109
group_create = Group.create
109110

111+
# Create a proxy object to wrap libtiledb and provide a `cc` alias
112+
class CCProxy:
113+
def __init__(self, module):
114+
self._module = module
115+
116+
def __getattr__(self, name):
117+
warnings.warn(
118+
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
119+
)
120+
return getattr(self._module, name)
121+
122+
def __repr__(self):
123+
warnings.warn(
124+
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
125+
)
126+
return self._module.__repr__()
127+
128+
129+
cc = CCProxy(libtiledb)
130+
sys.modules["tiledb.cc"] = cc
131+
cc = cc
132+
del CCProxy
133+
110134
# Note: we use a modified namespace packaging to allow continuity of existing TileDB-Py imports.
111135
# Therefore, 'tiledb/__init__.py' must *only* exist in this package.
112136
# Furthermore, in sub-packages, the `find_packages` helper will not work at the

0 commit comments

Comments
 (0)