Skip to content

Overview

Quickstart

Install PyKX using pip:

pip install --extra-index-url=https://$KX_PYPI_USER:$KX_PYPI_PASS@nexus.dl.kx.com/repository/pykx/simple/ pykx

Then if you have a q license, run q embedded within Python:

$ python
>>> import pykx as kx
>>> kx.q.show('Hello PyKX')
`Hello PyKX
pykx.Identity(pykx.q('::'))
>>> kx.q('10 {x,sum -2#x}/ 1 1') # Run q code within Python
pykx.LongVector(pykx.q('1 1 2 3 5 8 13 21 34 55 89 144'))

To run PyKX without a license, refer to the modes of operation documentation.

For more installation details, refer to the installation documentation.

About

For any inquires or feedback regarding PyKX, please contact pykx@kx.com

PyKX is an interface between Python and q. It takes a Python-first approach to this integration. This is to say it takes the stance that q should be used primarily as a data processing engine and database, and q should be used primarily as a domain-specific language (DSL) embedded within Python, which is a more general-purpose.

This is not to say that the interface is limiting to developers familiar to q. Expert users of q using this interface are capable of running the same analyses they would normally run within a q process using PyKX. If a user so chooses, they can simply run q code through PyKX. However, through PyKX, Python developers who have no experience with q can access and leverage q through a Pythonic interface.

As explained in the modes of operation documentation, the interface provides two key modalities:

  1. It operates as a truly embedded version of q within Python; a q license is required.
  2. It provides an IPC interface allowing users to query q data on external q processes; no q license is required.

See Comparisons for comparisons between PyKX and other Python/q integration options.

The Interface Overview is a Python notebook that demonstrates some key features of the interface.