Skip to main content

Pythonic interface to the TileDB array storage manager

Project description

TileDB logo

Travis status Documentation Status

Array data management made fast and easy.

TileDB is an efficient multi-dimensional array management system which introduces a novel on-disk format that can effectively store dense and sparse array data with support for fast updates and reads. It also features excellent compression and an efficient parallel I/O system with high scalability.

TileDB-Py is the official Python interface to TileDB.

Quickstart

First, install TileDB-Py with pip:

$ pip install tiledb

This may take a while, as the pip package will automatically download and build the native TileDB library in addition to the Python bindings.

Next, save the quickstart program into a file and run it:

$ wget https://raw.githubusercontent.com/TileDB-Inc/TileDB-Py/dev/examples/quickstart_dense.py
$ python quickstart_dense.py
[[2 3 4]
 [6 7 8]]

The dense quickstart program simply creates a dense array on disk, writes some simple data to it, and reads a slice of the data back, printing the slice to the console.

Documentation

The full TileDB documentation can be found at https://docs.tiledb.io and includes many tutorials and examples to get you started.

The latest Python API reference can be found at https://docs.tiledb.io/projects/tiledb-py/en/latest/python-api.html.

Installation

Pip

A PyPI package is available which can be installed with Pip. This package will download and install the native TileDB library inside the site package if TileDB is not already installed on your system.

$ pip install tiledb

Note: if the Numpy and Cython dependencies are not installed, pip will try to build them from source. This can take a long time and make the install appear to “hang.” Pass the -v flag to pip to monitor the build process.

If you wish to use a custom version of the TileDB library and the install location is not in the compiler search path, create a requirements.txt file that specifies the tiledb install path manually.

$ cat > tiledb_requirements.txt <<EOF
  tiledb==<version> --install-option="--tiledb=<path/to/tiledb/install>"
  EOF
$ pip install -r tiledb_requirements.txt

Do not forget to put the built .so / .dylib / .dll on the dynamic linker path, otherwise TileDB-Py will fail to load the shared library upon import.

Conda Package

A pre-built Conda package is available that will install TileDB as well.

$ conda install -c conda-forge tiledb-py

Note: Currently the pre-built TileDB conda package does not include the HDFS storage backend.

Installing From Source

TileDB-Py Build Dependencies

  • Numpy

  • Cython

  • C++11 compiler

  • CMake

TileDB-Py Runtime Dependencies

  • Numpy

Linux / OSX

Simply execute the following commands:

$ git clone https://github.com/TileDB-Inc/TileDB-Py.git
$ cd TileDB-Py
$ pip install -r requirements_dev.txt
$ python setup.py build_ext --inplace
$ python setup.py install

If you wish to use a custom version of the TileDB library and it is installed in a non-standard location, pass the path to setup.py with the --tiledb= flag. If you want to pass extra compiler/linker flags during the C++ extension compilation step use --cxxflags= or --lflags=.

$ python setup.py build_ext --inplace --tiledb=/home/tiledb/dist

If TileDB is installed in a non-standard location, you also need to make the dynamic linker aware of libtiledb’s location. Otherwise when importing the tiledb module you will get an error that the built extension module cannot find libtiledb’s symbols:

$ env LD_LIBRARY_PATH="/home/tiledb/dist/lib:$LD_LIBRARY_PATH" python -m unittest -v

For macOS the linker environment variable is DYLD_LIBRARY_PATH

Installing on Windows

If you are building the extension on Windows, first install a Python distribution such as Miniconda. You can then either build TileDB from source, or download the pre-built binaries.

Once you’ve installed Miniconda and TileDB, open the Miniconda command prompt and execute:

> cd TileDB-Py
> conda install conda-build
> conda install virtualenv
> virtualenv venv
> venv\Scripts\activate
> pip install -r requirements_dev.txt
> python setup.py build_ext --inplace --tiledb=C:\path\to\TileDB\
> set PATH=%PATH%;C:\path\to\TileDB\bin
> python -m unittest -v

Note that if you built TileDB from source, then replace C:\path\to\TileDB with C:\path\to\TileDB\dist.

Developing and testing TileDB-Py

TileDB-Py includes a handy Conda environment definition file for setting up a test environment:

$ conda env create -f environment.yml

This will create a tiledbpy conda environment with all the development library dependencies.

The easiest way to test / develop TileDB-Py across Python versions (2.7, 3.5, and 3.6), is using tox. TileDB includes a tox.ini file, simply run tox in the toplevel source directory to run the test suite against multiple installed Python versions:

$ tox

You can specify a particular Python version using the -e flag:

$ tox -e py27

If TileDB is not installed in a global system location, you must specify the install path to tox:

$ env TILEDB_PATH=/path/to/tiledb LD_LIBRARY_PATH=/path/to/tiledb/libdir:${LD_LIBRARY_PATH} tox

You can also run the unittests from the source folder without having the package installed. First build the package in place from the source directory:

$ python setup.py build_ext --inplace

Tests can now be run using Python’s unittest framework:

$ python -m unittest -v

Doctests can be run using the doctest module:

$ python -m doctest -o NORMALIZE_WHITESPACE -f tiledb/libtiledb.pyx

You can also install a symlink named site-packages/tiledb.egg-link to the development folder of TileDB-Py with:

$ pip install --editable .

This enables local changes to the current development repo to be reflected globally.

Building TileDB-Py against libtiledb from conda

TileDB core (libtiledb) is distributed as a separate conda package, [tiledb](https://anaconda.org/conda-forge/tiledb), which may be used for local builds of TileDB-Py:

  • activate the desired conda environment

  • run conda install tiledb

  • run python setup.py build_ext –inplace –tiledb=$CONDA_PREFIX

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiledb-0.4.4.tar.gz (86.4 kB view details)

Uploaded Source

Built Distributions

tiledb-0.4.4-cp37-cp37m-manylinux1_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.7m

tiledb-0.4.4-cp36-cp36m-manylinux1_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.6m

tiledb-0.4.4-cp35-cp35m-manylinux1_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.5m

tiledb-0.4.4-cp27-cp27mu-manylinux1_x86_64.whl (6.7 MB view details)

Uploaded CPython 2.7mu

File details

Details for the file tiledb-0.4.4.tar.gz.

File metadata

  • Download URL: tiledb-0.4.4.tar.gz
  • Upload date:
  • Size: 86.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.4.tar.gz
Algorithm Hash digest
SHA256 ec8c9e07804af34e4db0a23503d0f58635b05e71252aff4a528560bebbb5bee4
MD5 4653df56d6d7a105776023733225edf8
BLAKE2b-256 56beabe841a7575801507d1fb15fc9ba1cf5f0d2d59e0d33badda10d692a97ce

See more details on using hashes here.

Provenance

File details

Details for the file tiledb-0.4.4-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tiledb-0.4.4-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b24bc2d306fb030ef4b2483c3fcf7a9d9fdfe04f0c3aa45d0697ce49669ea0e0
MD5 5e8448710d60c0ead452233dd2ae4180
BLAKE2b-256 ac1cf339b897da51d8e464d256cf57622be3bf4ab18b03c5c143217ef1a57a88

See more details on using hashes here.

Provenance

File details

Details for the file tiledb-0.4.4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tiledb-0.4.4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 161d5ef1056d3de3f7f84543aaaa38c75aa3f303521075882caa93515f656a5a
MD5 9004c504caf805df82707110e7b3906a
BLAKE2b-256 6e95b2f30569cb0bd767c81bdf111317722828f3a95a90a7f4dc9eeb57fbc56d

See more details on using hashes here.

Provenance

File details

Details for the file tiledb-0.4.4-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tiledb-0.4.4-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 979a4fee0ae366d693f0bcf203237b6d30be77b0a779e8899877637a9839ea3d
MD5 20754ead244e9229aa2469fe98ddb8e2
BLAKE2b-256 b47f0306cbe38381510ed183d476c500ec0665272e2c32af3bd8954a634ed5db

See more details on using hashes here.

Provenance

File details

Details for the file tiledb-0.4.4-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

  • Download URL: tiledb-0.4.4-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.4-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ae90f291926fa40bfc2353ee25e27d16ed67dbb8c4db219cb8117a468eaf0f03
MD5 4f022a3ec4ea6171139b38e7c38a9edf
BLAKE2b-256 97bc3c374914ed379357e6f4f98e3b2ee20d76ce67c0fa3e6f8e4013ee0970a7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page