Skip to content

Commit

Permalink
Add cc alias for libtiledb
Browse files Browse the repository at this point in the history
  • Loading branch information
kounelisagis committed Jan 16, 2025
1 parent e1f57bd commit c0d209a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tiledb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ctypes
import os
import sys
import warnings

if os.name == "posix":
if sys.platform == "darwin":
Expand Down Expand Up @@ -107,6 +108,28 @@
__version__ = version.version
group_create = Group.create

# Create a proxy object to wrap libtiledb and provide a `cc` alias
class CCProxy:
def __init__(self, module):
self._module = module

def __getattr__(self, name):
warnings.warn(
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
)
return getattr(self._module, name)

def __repr__(self):
warnings.warn(
"`tiledb.cc` is deprecated. Please use `tiledb.libtiledb` instead.",
)
return self._module.__repr__()

cc = CCProxy(libtiledb)
sys.modules["tiledb.cc"] = cc
cc = cc
del CCProxy

# Note: we use a modified namespace packaging to allow continuity of existing TileDB-Py imports.
# Therefore, 'tiledb/__init__.py' must *only* exist in this package.
# Furthermore, in sub-packages, the `find_packages` helper will not work at the
Expand Down

0 comments on commit c0d209a

Please sign in to comment.