/embedPy

Allows the kdb+ interpreter to call Python functions

Primary LanguageCApache License 2.0Apache-2.0

embedPy

Allows the kdb+ interpreter to manipulate Python objects and call Python functions. Part of the Fusion for kdb+ interface collection.

Please direct any questions to ai@kx.com.

Please report issues in this repository.

Requirements

  • kdb+ >=3.5 64-bit
  • Anaconda Python 3.x

Installation

Download

Download the appropriate release archive from the releases page.

Run tests with

q test.q

To install, place p.q and p.k in $QHOME and place the library file (p.so for OSX/Linux or p.dll for Windows) in $QHOME/{l64|m64|w64}

Watch out On OSX and Linux if you are using Anaconda python rather than the system python, you should set your LD_LIBRARY_PATH (on Linux) or DYLD_LIBRARY_PATH (on OSX) to your python distributions library directory before starting q to avoid conflicts between libraries which both q and python use (e.g. libz, libssl) , you can find this directory's location in python.

>>> import sysconfig
>>> sysconfig.get_config_var('LIBDIR')

Watch out If you are currently using PyQ, it also has a file p.so in $QHOME/{l64|m64}. In this case, you may want to run initially from the local directory without installing. Skip the install step and run q in the directory where you unzipped the release to do this.

Building from source

Build the interface and run sanity checks with

make p.so && q test.q

If running in an environment without Internet access, you will need to download the kdb+ C API header file manually and place in the build directory.

To install, place p.q and p.k in $QHOME and p.so in $QHOME/{l64|m64}.

Usage

From q, load p.q.

q)\l p.q

Documentation

Documentation is available on the embedPy homepage.

Back-incompatible changes

V1.0 -> V 1.1

.p.key and .p.value removed

V0.2-beta -> V1.0

  • Attribute access from embedPy object
q)obj`ATTRNAME   / old
q)obj`:ATTRNAME  / new
  • embedPy objects can be called directly without explicitly specifying the call return type, the default return type is an embedPy object

V0.1-beta -> V0.2beta in V0.2-beta

V0.2-beta features a number of changes back-incompatible with the previous release, V0.1-beta.

Most notably, the default type used in many operations is now the embedPy type, rather than the foreign type.