Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ KX only officially supports versions of PyKX built by KX, i.e. versions of PyKX
PyKX depends on the following third-party Python packages:

- `pandas>=1.2, <2.0; python_version=='3.8'`
- `pandas>=1.2, <=2.3.0; python_version>'3.8'`
- `numpy~=1.22; python_version<'3.11'`
- `numpy~=1.23, <2.3.0; python_version=='3.11'`
- `numpy~=1.26, <2.3.0; python_version>'3.11'`
- `pandas>=1.2, <3.0; python_version>'3.8'`
- `numpy>=1.22; python_version<'3.11'`
- `numpy>=1.23; python_version=='3.11'`
- `numpy>=1.26; python_version>'3.11'`
- `pytz>=2022.1`
- `toml~=0.10.2`
- `dill>=0.2.0`
- `requests>=2.25.0`

They are installed automatically by `pip` when PyKX is installed.

PyKX also has an optional Python dependency of `pyarrow>=3.0.0, <19.0.0`, which can be included by installing the `pyarrow` extra, e.g. `pip install pykx[pyarrow]`
PyKX also has an optional Python dependency of `pyarrow>=3.0.0`, which can be included by installing the `pyarrow` extra, e.g. `pip install pykx[pyarrow]`

When using PyKX with KX Dashboards users will be required to install `ast2json~=0.3` this can be installed using the `dashboards` extra, e.g. `pip install pykx[dashboards]`

Expand Down
1 change: 1 addition & 0 deletions conda-recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ python:
- 3.11
- 3.12
- 3.13
- 3.14
20 changes: 13 additions & 7 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ requirements:
- python
- setuptools>=68.0
- setuptools_scm[toml]>=8.0.0
- cython==3.0.*
- numpy==2.*, <2.3.0 # [py==313]
- cython==3.0.* # [py<314]
- cython>=3.1.3 # [py>=314]
- numpy>=2.3.0 # [py==314]
- numpy==2.* # [py==313]
- numpy==2.0.* # [py==312]
- numpy==2.0.* # [py==311]
- numpy==2.0.* # [py==310]
Expand All @@ -28,16 +30,20 @@ requirements:
- numpy==1.20.* # [py==37]
- tomli>=2.0.1
- wheel>=0.36
- sysroot_linux-64 2.17 # [linux64]
- kernel-headers_linux-64 3.10.0 # [linux64]
- sysroot_linux-64 ==2.17 # [linux and py<314]
- kernel-headers_linux-64==3.10.0 # [linux and py<314]
- sysroot_linux-64>=2.28 # [linux and py>=314]
- kernel-headers_linux-64 # [linux and py>=314]

run:
- python
- numpy>=1.20 # [py==37]
- numpy>=1.22, <2.3.0 # [py>37]
- pandas>=1.2, <=2.3.0 # [py>38]
- numpy>=1.22 # [py>37 , py<314]
- numpy>=2.3.0 # [py==314]
- pandas>=1.2, <3.0 # [py>38 , py<314]
- pandas>=2.3.3, <3.0 # [py==314]
- pandas<2.0 # [py==38]
- pyarrow>=3.0.0, <19.0.0
- pyarrow>=3.0.0
- pytz>=2022.1
- toml>=0.10.2
- dill>=0.2.0
Expand Down
2 changes: 1 addition & 1 deletion docs/extras/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ A database schema is a fundamental concept in database management. It describes
The `#!python sorted` attribute ensures that all items in the `#!python Vector`/`#!python Table` column are sorted in ascending order.

## Time-series analysis
Time-series analysis is a specific way of analyzing a sequence of data points collected over an interval of time. Unlike sporadic or random data collection, time-series analysis involves recording data points at consistent intervals within a set period. Use cases include finance, Internet of Things (IoT), and other domains where data evolves over time. PyKX time-series analysis uses q’s query language (qSQL) against kdb+. Learn more about [time-series models](https://code.kx.com/insights/1.9/api/machine-learning/q/analytics/api/variadic/timeseries.html).
Time-series analysis is a specific way of analyzing a sequence of data points collected over an interval of time. Unlike sporadic or random data collection, time-series analysis involves recording data points at consistent intervals within a set period. Use cases include finance, Internet of Things (IoT), and other domains where data evolves over time. PyKX time-series analysis uses q’s query language (qSQL) against kdb+. Learn more about [time-series models](https://code.kx.com/insights/api/machine-learning/q/analytics/api/variadic/timeseries.html).

## Thread
A thread is an independent sequence of instructions within a program that can be executed independently of other code. Threads share the same memory space as the process they belong to, allowing them to communicate and share data efficiently. In Python, the threading module provides an intuitive API for working with threads. Learn about [PyKX calling into q from multiple threads](../examples/threaded_execution/threading.md).
Expand Down
55 changes: 39 additions & 16 deletions docs/getting-started/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _This page explains how to install PyKX on your machine._

Before you start, make sure you have:

- [**Python**](https://www.python.org/downloads/) (versions 3.8-3.13)
- [**Python**](https://www.python.org/downloads/) (versions 3.8-3.14)
- [**pip**](https://pypi.org/project/pip/)

Recommended: a virtual environment with packages such as [venv](https://docs.python.org/3/library/venv.html) from the standard library.
Expand All @@ -30,9 +30,9 @@ Recommended: a virtual environment with packages such as [venv](https://docs.pyt

KX only supports versions of PyKX built by KX (installed from wheel files) for:

- **Linux** (`manylinux_2_17_x86_64`, `linux-arm64`) with CPython 3.8-3.13
- **macOS** (`macosx_10_10_x86_64`, `macosx_10_10_arm`) with CPython 3.8-3.13
- **Windows** (`win_amd64`) with CPython 3.8-3.13
- **Linux** (`manylinux_2_17_x86_64`, `linux-arm64`) with CPython 3.8-3.14
- **macOS** (`macosx_10_15_x86_64`, `macosx_10_15_arm`) with CPython 3.8-3.14
- **Windows** (`win_amd64`) with CPython 3.8-3.14

We provide assistance to user-built installations of PyKX only on a best-effort basis.

Expand Down Expand Up @@ -87,6 +87,31 @@ You can install PyKX from three sources:

```

=== "Install PyKX from UV"

Ensure you have `#!bash uv` installed, instructions can be found [here.](https://docs.astral.sh/uv/getting-started/installation/)

Then install the latest version of PyKX with the following command:

```sh
uv pip install pykx

```

=== "Install PyKX from pipx"

Ensure you have `#!bash pipx` installed, installation guide can be found [here.](https://pipx.pypa.io/stable/installation/)

Then install PyKX using the flag to install dependencies:

```sh
pipx install pykx --include-deps

```

This will create a virtual environment to run PyKX in, make sure you activate this to access the package.


At this point you have [partial access to PyKX](../user-guide/advanced/modes.md#1a-running-in-unlicensed-mode). To gain access to all PyKX features, follow the steps in the next section, otherwise go straight to [3. Verify PyKX Installation](#3-verify-pykx-installation).

## 2. Install a kdb Insights license
Expand Down Expand Up @@ -267,10 +292,10 @@ This command should display the installed version of PyKX.
PyKX depends on the following third-party Python packages:

- `pandas>=1.2, <2.0; python_version=='3.8'`
- `pandas>=1.2, <=2.3.0; python_version>'3.8'`
- `numpy~=1.22; python_version<'3.11'`
- `numpy~=1.23, <2.3.0; python_version=='3.11'`
- `numpy~=1.26, <2.3.0; python_version>='3.12'`
- `pandas>=1.2, <3.0; python_version>'3.8'`
- `numpy>=1.22; python_version<'3.11'`
- `numpy>=1.23; python_version=='3.11'`
- `numpy>=1.26; python_version>='3.12'`
- `pytz>=2022.1`
- `toml~=0.10.2`
- `dill>=0.2.0`
Expand All @@ -291,12 +316,10 @@ This command should display the installed version of PyKX.

**Optional Python dependencies:**

- **`pyarrow >=3.0.0, <19.0.0`**: install `pyarrow` extra, for example `pip install pykx[pyarrow]`.
- **`pyarrow >=3.0.0`**: install `pyarrow` extra, for example `pip install pykx[pyarrow]`.
- **`find-libpython ~=0.2`**: install `debug` extra, for example `pip install pykx[debug]`.
- **`ast2json ~=0.3`**: install with `dashboards` extra, for example `pip install pykx[dashboards]`
- **`dill >=0.2`**: install via pip, with `remote` extra, for example `pip install pykx[remote]`
- **`beautifulsoup4 >=4.10.0`**: install with `help` extra, for example `pip install pykx[help]`
- **`markdown2 >=2.5.0`**: install with `help` extra, for example `pip install pykx[help]`
- **`psutil >=5.0.0`**: install via pip, with `streaming` extra, for example `pip install pykx[streaming]`
- **`torch >2.1`**: install via pip, with `torch` extra, for example `pip install pykx[torch]`

Expand Down Expand Up @@ -331,11 +354,11 @@ This command should display the installed version of PyKX.
| Mac ARM | kdb+ 4.0 | libq.dylib | 2025.02.18 |
| Mac x86 | kdb+ 4.0 | libq.dylib | 2025.02.18 |
| Windows | kdb+ 4.0 | q.dll/q.lib | 2025.02.18 |
| Linux ARM | kdb+ 4.1 | libq.so | 2025.11.25 |
| Linux x86 | kdb+ 4.1 | libq.so | 2025.11.25 |
| Mac ARM | kdb+ 4.1 | libq.dylib | 2025.11.25 |
| Mac x86 | kdb+ 4.1 | libq.dylib | 2025.11.25 |
| Windows | kdb+ 4.1 | q.dll/q.lib | 2025.11.25 |
| Linux ARM | kdb+ 4.1 | libq.so | 2026.01.23 |
| Linux x86 | kdb+ 4.1 | libq.so | 2026.01.23 |
| Mac ARM | kdb+ 4.1 | libq.dylib | 2026.01.23 |
| Mac x86 | kdb+ 4.1 | libq.dylib | 2026.01.23 |
| Windows | kdb+ 4.1 | q.dll/q.lib | 2026.01.23 |
| Linux ARM | Unlicensed | libe.so | 2023.11.22 |
| Linux x86 | Unlicensed | libe.so | 2023.11.22 |
| Mac ARM | Unlicensed | libe.so | 2023.11.22 |
Expand Down
31 changes: 16 additions & 15 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ To access PyKX, import it within your Python code using the following syntax:
```
!!! Info "The use of the shortened name `#!python kx` is optional and provides a terse convention for interacting with methods and objects from the PyKX library."

Many examples in this guide make use of NumPy so we import this:

```python
>>> import numpy as np
```

## 2. Generate PyKX objects

You can generate PyKX objects in three ways. Click on the tabs below to follow the instructions:
Expand Down Expand Up @@ -64,7 +70,6 @@ You can generate PyKX objects in three ways. Click on the tabs below to follow t
>>> qlist
pykx.LongVector(pykx.q('10 20 30'))

>>> import numpy as np
>>> nplist = np.arange(0, 10, 2)
>>> qlist = kx.toq(nplist)
>>> qlist
Expand Down Expand Up @@ -204,7 +209,7 @@ You can interact with PyKX objects in a variety of ways, for example, through [i

```python
>>> qfunction = kx.q('{x+til 10}')
>>> qfunction(kx.toq([random() for _ in range(10)], kx.FloatVector))
>>> qfunction(kx.FloatVector([np.random.random() for _ in range(10)]))
pykx.FloatVector(pykx.q('0.3992327 1.726329 2.488636 3.653597 4.028107 5.444905 6.542917 7.00628 8.152..'))
```

Expand All @@ -218,7 +223,7 @@ You can interact with PyKX objects in a variety of ways, for example, through [i
pykx.LongVector(pykx.q('5 8 3 3 10 5 3 1 9 1'))
```

* Pass PyKX arrays of objects to Numpy functions:
* Pass PyKX arrays of objects to NumPy functions:

```python
>>> qarray1 = kx.random.random(10, 1.0)
Expand All @@ -242,7 +247,7 @@ You can interact with PyKX objects in a variety of ways, for example, through [i
>>> N = 100
>>> qtable = kx.Table(
data={
'x': kx.random.random(N, ['a', 'b', 'c'],
'x': kx.random.random(N, ['a', 'b', 'c']),
'x1': kx.random.random(N, 1.0),
'x2': 5 * kx.random.random(N, 1.0),
}
Expand All @@ -268,7 +273,7 @@ You can interact with PyKX objects in a variety of ways, for example, through [i
a 0.6212161 3.97236
..
'))
>>> qtable.select(where=kx.Column('col1')=='a')
>>> qtable.select(where=kx.Column('x')=='a')
pykx.Table(pykx.q('
x x1 x2
---------------------
Expand Down Expand Up @@ -320,7 +325,7 @@ You can interact with PyKX objects in a variety of ways, for example, through [i

## 4. Convert PyKX objects to Python types

To convert the objects generated via the PyKX library to the corresponding `#!python Python`, `#!python Numpy`, `#!python Pandas`, and `#!python PyArrow` types, use `#!python py`, `#!python np`, `#!python pd`, and `#!python pa` methods. Click on the tabs below to go through the examples:
To convert the objects generated via the PyKX library to the corresponding `#!python Python`, `#!python NumPy`, `#!python Pandas`, and `#!python PyArrow` types, use `#!python py`, `#!python np`, `#!python pd`, and `#!python pa` methods. Click on the tabs below to go through the examples:

=== "Convert to Python"

Expand All @@ -334,22 +339,18 @@ To convert the objects generated via the PyKX library to the corresponding `#!py
'))
>>> qdictionary.py()
{'a': 5, 'b': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'c': [0.014509072760120034, 0.9131434387527406, 0.5745006683282554, 0.9619080068077892, 0.7609488749876618]}
>>>
>>> qvec = kx.toq(np.random.randint(5, size=10))
>>> qvec.py()
[0, 2, 4, 1, 2, 1, 0, 1, 0, 1]
```

=== "Convert to Numpy"
=== "Convert to NumPy"

```python
>>> import numpy as np
>>> random = np.random.random
>>> randint = np.random.randint
>>> qvec = kx.q('10?5')
>>> qvec.np()
array([0, 2, 4, 1, 2, 1, 0, 1, 0, 1])
>>> qtab = kx.Table([[random(), randint(0, 5)] for _ in range(5)])
>>> qtab = kx.Table([[np.random.random(), np.random.randint(0, 5)] for _ in range(5)])
>>> qtab
pykx.Table(pykx.q('
x x1
Expand Down Expand Up @@ -382,7 +383,7 @@ To convert the objects generated via the PyKX library to the corresponding `#!py
8 0
9 1
dtype: int64
>>> df = pd.DataFrame(data={'x': [random() for _ in range(5)], 'x1': [randint(0, 4) for _ in range(5)]})
>>> df = pd.DataFrame(data={'x': [np.random.random() for _ in range(5)], 'x1': [np.random.randint(0, 4) for _ in range(5)]})
>>> qtab = kx.toq(df)
>>> qtab.pd()
x x1
Expand Down Expand Up @@ -410,7 +411,7 @@ To convert the objects generated via the PyKX library to the corresponding `#!py
8 2
9 0
dtype: int64[pyarrow]
>>> df = pd.DataFrame(data={'x': [random() for _ in range(5)], 'x1': [randint(0, 4) for _ in range(5)]})
>>> df = pd.DataFrame(data={'x': [np.random.random() for _ in range(5)], 'x1': [np.random.randint(0, 4) for _ in range(5)]})
>>> qtab = kx.toq(df)
>>> qtab.pd(as_arrow=True)
x x1
Expand Down Expand Up @@ -443,7 +444,7 @@ To convert the objects generated via the PyKX library to the corresponding `#!py
0,
1
]
>>> df = pd.DataFrame(data={'x': [random() for _ in range(5)], 'x1': [randint(0, 4) for _ in range(5)]})
>>> df = pd.DataFrame(data={'x': [np.random.random() for _ in range(5)], 'x1': [np.random.randint(0, 4) for _ in range(5)]})
>>> qtab = kx.toq(df)
>>> qtab.pa()
pyarrow.Table
Expand Down
2 changes: 2 additions & 0 deletions docs/help/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _This page details known issues and functional limitations when using PyKX eithe
* Enabling the NEP-49 NumPy allocators will often segfault when running in a multiprocess setting.
* The timeout value is always set to 0 when using PYKX_Q_LOCK.
* Enabling PYKX_ALLOCATOR and using PyArrow tables can cause segfaults.
* Multiprocessing is not available on Windows. When using PyKX in a multiprocessing setup, PyKX must be imported and initialized within each subprocess where it is needed, regardless of the multiprocessing start method used (spawn, fork, or forkserver).
* Multithreading mode is not available on Windows.
* `#!python kurl` functions require their `#!python options` dictionary to have mixed type values. Add a `#!python None` value to bypass: `#!python {'': None, ...}`
* `#!python None` and `#!python pykx.Identity(pykx.q('::'))` do not pass through to single argument Python functions set under q as outlined in this example:
```python
Expand Down
Loading