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 and S3 storage backends.

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.

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.1.tar.gz (73.6 kB view details)

Uploaded Source

Built Distributions

tiledb-0.4.1-cp37-cp37m-manylinux1_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.7m

tiledb-0.4.1-cp36-cp36m-manylinux1_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.6m

tiledb-0.4.1-cp35-cp35m-manylinux1_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.5m

tiledb-0.4.1-cp27-cp27mu-manylinux1_x86_64.whl (5.6 MB view details)

Uploaded CPython 2.7mu

File details

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

File metadata

  • Download URL: tiledb-0.4.1.tar.gz
  • Upload date:
  • Size: 73.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.1.tar.gz
Algorithm Hash digest
SHA256 6b97d45a00cc12366a599a2196489fcbdd4c1fad17b198cbeec7a2754d44ad31
MD5 b3a10382757d408d9498dcb315fb59df
BLAKE2b-256 a2add09588f0789a7b712966d0741db328bda69cbe54de73373a40d757cca48f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for tiledb-0.4.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c6f0f652c12a40080cfadbbac3754ea15725039a7935d23b707ed1102726f826
MD5 7e00de37fae30714e59da1ab969ddc84
BLAKE2b-256 6fe93702142df0f80ef403389998dbaddac433e770081490faa2a734f5f0d58d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for tiledb-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1fb11c9b4b7cd802241290c2a705298d40b712dfd2c2a09b44099453a2af3eea
MD5 93068c23a8125e3687bd46c364f87688
BLAKE2b-256 47cd45812245dfe1d753815ca18d216fb9747dc248d4741a3376ed4d3e3e60cb

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.8 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for tiledb-0.4.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7db1cb14cb1b1832a8bffb9ed390df470a2ef966afb062dd326adc408a7cf98b
MD5 a7554ac410e816a6acde3a1bb0928df0
BLAKE2b-256 533bf3742e61f0941cfc5e9dc5b121bc1a19bae29a6465992617d4d327f659b7

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.1-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for tiledb-0.4.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f440cf7e1a0e9151fa90d7eafb96a9492c6dbc5af9f442fc356ccbae13f9b7ea
MD5 f6b57908ff7f73b3d2e9460f3a354676
BLAKE2b-256 54030cf2a5a3991b6b98e2869f9cf39fd0f892156f898a5a67fc6bd9734a1fb4

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