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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

tiledb-0.4.2-cp27-cp27mu-manylinux1_x86_64.whl (5.7 MB view details)

Uploaded CPython 2.7mu

File details

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

File metadata

  • Download URL: tiledb-0.4.2.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • 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.2.tar.gz
Algorithm Hash digest
SHA256 9d055d6b239ee11e836ea72e4b94208ecfd1214d84d065f4192d5261010c4c17
MD5 3918fec7cf8af32ff948a81522566ef4
BLAKE2b-256 89e5d32ca4cef2af7578740fa07a9abe449ff740066a1a8bb013dee0282fe807

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.2-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7c1c209e1701ef852b42ad647cd15bb99d01cb9c6742cd005b8fb720c6f012f
MD5 2569b2dc9109dfdc22f36f850d301ea7
BLAKE2b-256 0390b5771854c7b220869fab76c5d90ea4ecd6863221ff019a7c986f762b6157

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.2-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ad691cfd706acc4823e30ffc699b573f9d3aea29e5435b0b580552bfee543a8e
MD5 670866d6966bbf5382e7e10f8d516498
BLAKE2b-256 c834320e5686642b082b5a14f2b608e2c73c62983477d0a3e891a5b58cf75bf4

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.2-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5a411c022263f2c6999897ab07239dc981f946d02fb4113f91d33f5e2e4450a1
MD5 dbb75cf75342ce34e66f2319c71e7113
BLAKE2b-256 1dee530549d55aa703f81bd7b6838ee7d4e892ee196345e460bf760a0d121732

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tiledb-0.4.2-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.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.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for tiledb-0.4.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2dcc81d62e2e0274b726a67914780f375716a7803399bd62be04a2d155309704
MD5 d481151501b70ebbf9e04130f1ad2b9e
BLAKE2b-256 73aa3cdc6a6229b36d38535f8c27739fda949c4e224c2c784d16a36d3933742a

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