Skip to content

Commit

Permalink
Merge pull request #31 from KxSystems/pykx-2.5.1
Browse files Browse the repository at this point in the history
PyKX 2.5.1
  • Loading branch information
cmccarthy1 authored Jun 11, 2024
2 parents 80cee70 + 1c63196 commit 57a42b4
Show file tree
Hide file tree
Showing 23 changed files with 390 additions and 112 deletions.
1 change: 1 addition & 0 deletions docs/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ The aim of this page is to include a list of the contributors to our project bot
- [neutropolis](https://github.com/neutropolis)
- [nipsn](https://github.com/nipsn)
- [marcosvm13](https://github.com/marcosvm13)
- [tortolavivo23](https://github.com/tortolavivo23)
2 changes: 1 addition & 1 deletion docs/getting-started/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _This section explains how to install PyKX on your machine._
Before you start, make sure you have:

- **Python** (versions 3.8-3.12)
- **Pip**
- **pip**

Recommended: a virtual environment with packages such as [venv](https://docs.python.org/3/library/venv.html) from the standard library.

Expand Down
19 changes: 9 additions & 10 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ To complete the quickstart guide below you will need to have completed the follo
To access PyKX and it's functionality import it within your Python code using the following syntax

```python
import pykx as kx
>>> import pykx as kx
```

The use of the shortened name `kx` is intended to provide a terse convention for interacting with methods and objects from this library.

## How to generate PyKX objects

The generation of PyKX objects is supported pricipally in two ways
The generation of PyKX objects is supported principally in two ways

1. Execution of q code to create these entities
2. Conversion of Python objects to analagous PyKX objects

2. Conversion of Python objects to analogous PyKX objects

### Creation of PyKX objects using inbuilt PyKX functions

Expand Down Expand Up @@ -52,19 +51,21 @@ x x1

### Creation of PyKX objects from Python data types

Generation of PyKX objects from Python, Numpy, Pandas and PyArrow objects can be completed as follows using the `kx.toq` method.
Generation of PyKX objects from Python, NumPy, Pandas and PyArrow objects can be completed as follows using the `kx.toq` method.

```python
>>> pylist = [10, 20, 30]
>>> qlist = kx.toq(pylist)
>>> qlist
pykx.LongVector(pykx.q('10 20 30'))

>>> import numpy as np
>>> nplist = np.arange(0, 10, 2)
>>> qlist = kx.toq(nplist)
>>> qlist
pykx.LongVector(pykx.q('0 2 4 6 8'))

>>> import pandas as pd
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df
col1 col2
Expand All @@ -78,6 +79,7 @@ col1 col2
2 4
'))

>>> import pyarrow as pa
>>> patab = pa.Table.from_pandas(df)
>>> patab
pyarrow.Table
Expand Down Expand Up @@ -115,8 +117,7 @@ x x1 x2

## Interacting with PyKX Objects

PyKX objects can be interacted with in a variety of ways, through indexing using Pythonic syntax, passing PyKX objects to q/numpy functions, querying via SQL/qSQL syntax or through the use of q functionality via the context interface. Each of these is described in more depth throughout this documentation but examples of each are provided here

PyKX objects can be interacted with in a variety of ways, through indexing using Pythonic syntax, passing PyKX objects to q/NumPy functions, querying via SQL/qSQL syntax or through the use of q functionality via the context interface. Each of these is described in more depth throughout this documentation but examples of each are provided here.

* Create a PyKX list and interact with the list using indexing and slices.

Expand Down Expand Up @@ -192,7 +193,7 @@ PyKX objects can be interacted with in a variety of ways, through indexing using
0.2062569 3.852387 a
0.481821 0.07970141 a
'))
```
```

* Pass a PyKX object to q function

Expand All @@ -211,8 +212,6 @@ PyKX objects can be interacted with in a variety of ways, through indexing using
>>> qvec.apply(lambda x:x+1)
pykx.LongVector(pykx.q('5 8 3 3 10 5 3 1 9 1'))
```



* Pass a PyKX array objects to a Numpy functions

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/what_is_pykx.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Introduction

PyKX is a Python first interface to the worlds fastest time-series database kdb+ and it's underlying vector programming language q. PyKX takes a Python first approach to integrating q/kdb+ with Python following 10+ years of integrations between these two languages. Fundamentally it provides users with the ability to efficiently query and analyze huge amounts of in-memory and on-disk time-series data.
PyKX is a Python first interface to the world's fastest time-series database kdb+ and its underlying vector programming language, q. PyKX takes a Python first approach to integrating q/kdb+ with Python following 10+ years of integrations between these two languages. Fundamentally it provides users with the ability to efficiently query and analyze huge amounts of in-memory and on-disk time-series data.

This interface exposes q as a domain-specific language (DSL) embedded within Python, taking the approach that q should principally be used for data processing and management of databases. This approach does not diminish the ability for users familiar with q or those wishing to learn more about it from making the most of advanced analytics and database management functionality rather empowers those who want to make use of the power of kdb+/q who lack this expertise to get up and running fast.
This interface exposes q as a domain-specific language (DSL) embedded within Python, taking the approach that q should principally be used for data processing and management of databases. This approach does not diminish the ability for users familiar with q, or those wishing to learn more about it, from making the most of its advanced analytics and database management functionality. Rather it empowers those who want to make use of the power of kdb+/q who lack this expertise to get up and running quickly.

PyKX supports three principal use cases:

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

PyKX is a Python-first interface for the q language and its time-series vector database kdb+.
PyKX is a Python first interface to the world's fastest time-series database kdb+ and its underlying vector programming language, q.

For Python developers, PyKX unlocks the speed and power of kdb+ for data processing and storage from within your Python environment. It enables anyone with Python knowledge to apply analytics against vast amounts of data, both in-memory and on-disk, in a fraction of the time, allowing you to focus on getting the best from your data.

Expand Down
110 changes: 110 additions & 0 deletions docs/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,116 @@

Currently PyKX is not compatible with Pandas 2.2.0 or above as it introduced breaking changes which cause data to be cast to the incorrect type.

## PyKX 2.5.1

#### Release Date

2024-06-11

### Additions

- [Pandas API](../user-guide/advanced/Pandas_API.ipynb) additions: `isnull`, `isna`, `notnull`, `notna`, `idxmax`, `idxmin`, `kurt`, `sem`.
- Addition of `filter_type`, `filter_columns`, and `custom` parameters to `QReader.csv()` to add options for CSV type guessing.

```python
>>> import pykx as kx
>>> reader = kx.QReader(kx.q)
>>> reader.csv("myFile0.csv", filter_type = "like", filter_columns="*name", custom={"SYMMAXGR":15})
pykx.Table(pykx.q('
firstname lastname
----------------------
"Frieda" "Bollay"
"Katuscha" "Paton"
"Devina" "Reinke"
"Maurene" "Bow"
"Iseabal" "Bashemeth"
..
'))
```

### Fixes and Improvements

- Fix to regression in PyKX 2.5.0 where PyKX initialisation on Windows would result in a segmentation fault when using an `k4.lic` license type.
- Previously user could not make direct use of `kx.SymbolicFunction` type objects against a remote process, this has been rectified

=== "Behaviour prior to change"

```python
>>> import pykx as kx
>>> kx.q('.my.func:{x+1}')
pykx.Identity(pykx.q('::'))
>>> kx.q.my.func
pykx.SymbolicFunction(pykx.q('`.my.func'))
>>> conn = kx.q.SyncQConnection(port=5050)
>>> conn(kx.q.my.func, 1)
... Error Message ...
pykx.exceptions.QError: .my.func
```

=== "Behaviour post change"

```python
>>> import pykx as kx
>>> kx.q('.my.func:{x+1}')
pykx.Identity(pykx.q('::'))
>>> kx.q.my.func
pykx.SymbolicFunction(pykx.q('`.my.func'))
>>> conn = kx.q.SyncQConnection(port=5050)
>>> conn(kx.q.my.func, 1)
pykx.LongAtom(pykx.q('2'))
```

- Previously use of the context interface for q primitive functions in licensed mode via IPC would partially run the function on the client rather than server, thus limiting usage for named entities on the server.

=== "Behaviour prior to change"

```python
>>> import pykx as kx
>>> conn = kx.SyncQConnection(port=5050)
>>> conn.q('tab:([]10?1f;10?1f)')
>>> conn.q.meta('tab')
... Error Message ...
pykx.exceptions.QError: tab
```

=== "Behaviour post change"

```python
>>> import pykx as kx
>>> conn = kx.SyncQConnection(port=5050)
>>> conn.q('tab:([]10?1f;10?1f)')
>>> conn.q.meta('tab')
pykx.KeyedTable(pykx.q('
c | t f a
--| -----
x | f
x1| f
'))
```

- With the release of PyKX 2.5.0 and support of PyKX usage in paths containing spaces the context interface functionality could fail to load a requested context over IPC if PyKX was not loaded on the server.

=== "Behaviour prior to change"

```python
>>> import pykx as kx
>>> conn = kx.SyncQConnection(port=5050)
>>> conn.my_ctx
... Error Message ...
```

=== "Behaviour post change"

```python
>>> import pykx as kx
>>> conn = kx.SyncQConnection(port=5050)
>>> conn.my_ctx
<pykx.ctx.QContext of .csvutil with [my_function]>
```

- Updated CSV analysis logic to be based on `csvutil.q` 2020.06.20.
- Fix for config value `PYKX_4_1_ENABLED` to only use 4.1 if set to `True`, `true`, or `1`. Previously any non empty value enabled 4.1.

## PyKX 2.5.0

#### Release Date
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/underq-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This changelog provides updates from PyKX 2.0.0 and above, for information relat

#### Release Date

TBD
2024-05-15

### Fixes and Improvements

Expand Down
10 changes: 2 additions & 8 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you need a feature that's not included in this list please let us know by rai
>>> table.select(kx.col('x1').wavg('x2'))
```

- Addition of support for q primatives as methods off PyKX Vector and Table objects. Syntax for this will be similar to the following
- Addition of support for q primitives as methods off PyKX Vector and Table objects. Syntax for this will be similar to the following:

```python
>>> import pykx as kx
Expand All @@ -31,13 +31,7 @@ If you need a feature that's not included in this list please let us know by rai
>>> vec.abs()
```

- Performance improvements for conversions from Numpy arrays to PyKX Vector objects and vice-versa through enhanced use of C++ over Cython.
- Additions to the Pandas Like API for PyKX.
- `isnull`
- `idxmax`
- `kurt`
- `sem`

- Performance improvements for conversions from NumPy arrays to PyKX Vector objects and vice-versa through enhanced use of C++ over Cython.
- Addition of functionality for the development of streaming workflows using PyKX.
- Configurable initialisation logic in the absence of a license. Thus allowing users who have their own workflows for license access to modify the instructions for their users.
- Promotion of Beta functionality currently available in PyKX to full production support
Expand Down
Loading

0 comments on commit 57a42b4

Please sign in to comment.