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
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ requirements:
build:
- git
- python
- setuptools>=68.0
- setuptools>=68.0, <81.0
- setuptools_scm[toml]>=8.0.0
- cython==3.0.* # [py<314]
- cython>=3.1.3 # [py>=314]
Expand Down
2 changes: 1 addition & 1 deletion custom_theme/partials/header.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@
}
</style>
<body>
<button class="open-button md-typeset" onclick="window.location.href='https://community.kx.com/t5/forums/postpage/choose-node/true/interaction-style/forum/override-styles/true/board-id/kxinsights'"><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 32C114.6 32 0 125.1 0 240c0 47.6 19.9 91.2 52.9 126.3C38 405.7 7 439.1 6.5 439.5c-6.6 7-8.4 17.2-4.6 26S14.4 480 24 480c61.5 0 110-25.7 139.1-46.3C192 442.8 223.2 448 256 448c141.4 0 256-93.1 256-208S397.4 32 256 32zm0 368c-26.7 0-53.1-4.1-78.4-12.1l-22.7-7.2-19.5 13.8c-14.3 10.1-33.9 21.4-57.5 29 7.3-12.1 14.4-25.7 19.9-40.2l10.6-28.1-20.6-21.8C69.7 314.1 48 282.2 48 240c0-88.2 93.3-160 208-160s208 71.8 208 160-93.3 160-208 160z"></path></svg></span>&nbsp;Ask a question</button>
<button class="open-button md-typeset" onclick="window.location.href='https://kx.com/slack'"><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 32C114.6 32 0 125.1 0 240c0 47.6 19.9 91.2 52.9 126.3C38 405.7 7 439.1 6.5 439.5c-6.6 7-8.4 17.2-4.6 26S14.4 480 24 480c61.5 0 110-25.7 139.1-46.3C192 442.8 223.2 448 256 448c141.4 0 256-93.1 256-208S397.4 32 256 32zm0 368c-26.7 0-53.1-4.1-78.4-12.1l-22.7-7.2-19.5 13.8c-14.3 10.1-33.9 21.4-57.5 29 7.3-12.1 14.4-25.7 19.9-40.2l10.6-28.1-20.6-21.8C69.7 314.1 48 282.2 48 240c0-88.2 93.3-160 208-160s208 71.8 208 160-93.3 160-208 160z"></path></svg></span>&nbsp;Ask a question</button>
</body>
4 changes: 4 additions & 0 deletions docs/getting-started/what_is_pykx.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ _This page briefly describes PyKX, its use cases, and its connection with q/kdb+

**PyKX** is a Python-first interface to **kdb+** (the world's fastest time-series database) and **q** (kdb+'s underlying vector programming language). PyKX is the result of 10+ years of integrations between two languages: Python and q. Its aim is to help users query and analyze huge amounts of in-memory and on-disk time-series data, significantly faster than other libraries.

- 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.

- For **q developers**, PyKX brings together Python's data science ecosystem and the power of kdb+'s vector and time-series analytics. This makes them available in both q and Python environments. You can use it to run q code within a Python environment or embed Python analytics within your q session.

## Use cases

PyKX supports three main use cases, allowing Python data engineers and data scientists to:
Expand Down
106 changes: 66 additions & 40 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,67 @@
# PyKX Documentation
# PyKX Home

_Welcome to the home of PyKX technical documentation._

[PyKX](./getting-started/what_is_pykx.md) is a Python-first interface to kdb+, the world's fastest time-series database, and its underlying vector programming language q. Whether you're a Python developer looking to harness kdb+'s analytics, or a q developer wanting to leverage Python's data science ecosystem, PyKX bridges both worlds.

## Ready to dive in?

<div class="large-tile-grid home-offerings">
<div>
<h2>Get Started</h2>
<ul>
<li><a href="getting-started/what_is_pykx.html" target="_blank" rel="noopener">PyKX Overview</a></li>
<li><a href="getting-started/installing.html" target="_blank" rel="noopener">Install PyKX</a></li>
<li><a href="getting-started/quickstart.html" target="_blank" rel="noopener">Quick Start</a></li>
</ul>
</div>
<div>
<h2>Learn</h2>
<ul>
<li><a href="https://academy.kx.com/courses/pykx-developer-level-1/">KX Academy Course</a></li>
<li><a href="learn/objects.html" target="_blank" rel="noopener">Objects and Attributes</a></li>
<li><a href="user-guide/advanced/database/index.html">Databases</a></li>
</ul>
</div>
<div>
<h2>How-to Guides</h2>
<ul>
<li><a href="user-guide/configuration.html" target="_blank" rel="noopener">Configure PyKX</a></li>
<li><a href="user-guide/fundamentals/creating.html" target="_blank" rel="noopener">Interact with Data</a></li>
<li><a href="user-guide/advanced/database/db_gen.html" target="_blank" rel="noopener">Create Databases</a></li>
</ul>
</div>
<div>
<h2>Reference</h2>
<ul>
<li><a href="api/pykx-execution/q.html" target="_blank" rel="noopener">API References</a></li>
<li><a href="api/pykx-q-data/toq.html" target="_blank" rel="noopener">Data Types and Conversions</a></li>
<li><a href="user-guide/advanced/Pandas_API.html" target="_blank" rel="noopener">Pandas Like API</a></li>
</ul>
</div>
<div>
<h2>Integrations</h2>
<ul>
<li><a href="user-guide/advanced/numpy.html" target="_blank" rel="noopener">NumPy</a></li>
<li><a href="user-guide/advanced/streamlit.html" target="_blank" rel="noopener">Streamlit</a></li>
<li><a href="examples/charting.html" target="_blank" rel="noopener">Python Charting Libraries</a></li>
</ul>
</div>
<div>
<h2>Examples</h2>
<ul>
<li><a href="examples/interface-overview.html" target="_blank" rel="noopener">PyKX Introduction Notebook</a></li>
<li><a href="examples/subscriber/readme.html" target="_blank" rel="noopener">Subscribe to a q Process</a></li>
<li><a href="examples/compress_and_encrypt/readme.html" target="_blank" rel="noopener">Compress and Encrypt</a></li>
</ul>
</div>
</div>

## What's next?

Discover how PyKX builds upon kdb+ and what's coming soon:

- Submit a [feature request](https://forum.kx.com/c/ideas-feature-requests/10)
- Stay updated with the latest [release notes](release-notes/changelog.md){target="_blank"}
- Join our [community channels](https://kx-community.slack.com/) to get assistance

## About

Welcome to [PyKX](./getting-started/what_is_pykx.md)! 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.

For q developers, PyKX brings together Python's data science ecosystem and the power of kdb+'s vector and time-series analytics. This makes them available in both q and Python environments. You can use it to run q code within a Python environment or embed Python analytics within your q session.

To begin your journey with PyKX, follow the sections below:

## Documentation overview

!!! home-page "[Get Started](./getting-started/installing.md)"

This section is for new users. Includes everything you need to begin your journey with PyKX: [installation instructions](./getting-started/installing.md) and a [quickstart guide](./getting-started/quickstart.md).

!!! home-page "[Learn](./getting-started/what_is_pykx.md)"

Explore the core concepts of our technology. This section provides you with detailed explanations and access to [KX Academy](https://learninghub.kx.com/courses/introduction-to-pykx/) materials.

!!! home-page "[How To](./user-guide/configuration.md)"

Follow step-by-step guides to take you from initial setup to advanced production systems. You’ll find practical advice and best practices here.

!!! home-page "[Reference](./api/pykx-execution/q.md)"

Find detailed technical references for methods, functions, and APIs. This is your go-to source for all technical definitions and usage examples.

!!! home-page "[Integrations](./user-guide/advanced/numpy.md)"

Learn how to integrate PyKX with other tools and platforms. This section includes guides and compatibility information to ensure seamless interoperability.

!!! home-page "[Releases](./release-notes/changelog.md)"

Stay updated with the latest release notes. You’ll find information on the latest releases/fixes, and previous versions.

!!! home-page "[Help and Support](./help/troubleshooting.md)"

Get assistance with any questions or issues you might have. This section includes [troubleshooting](./help/troubleshooting.md) guides, [FAQs](./help/faq.md), and [support](./help/support.md) contact information.
48 changes: 47 additions & 1 deletion docs/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,53 @@

The changelog presented here outlines changes to PyKX when operating within a Python environment specifically, if you require changelogs associated with PyKX operating under a q environment see [here](./underq-changelog.md).

# PyKX 3.1.8
## PyKX 3.1.9

#### Release Date

2026-04-02

### Additions

- Added `.np()` method to `pykx.serialize` function, this returns the serialized data as a NumPy array.
- Added support for calling `pykx.deserialize` on NumPy arrays of serialized `K` objects.

```python
>>> import pykx as kx
>>> vec = kx.q('til 10')
>>> vec
pykx.LongVector(pykx.q('0 1 2 3 4 5 6 7 8 9'))
>>> ser = kx.serialize(vec)
>>> type(ser)
<class 'pykx.serialize.serialize'>
>>> ser_np = ser.np()
>>> type(ser_np)
<class 'numpy.ndarray'>
>>> ser_np.dtype
dtype('uint8')
>>> kx.deserialize(ser_np)
pykx.LongVector(pykx.q('0 1 2 3 4 5 6 7 8 9'))
```

- Added `.bin()` method to `pykx.Column` class, to perform a binary search using the data in a `pykx.Column` object.

```python
>>> import pykx as kx
>>> t = kx.q('([] n: 2 4)')
>>> t.select(kx.Column('n').bin([1,3,5]))
pykx.Table(pykx.q('
n
-
0
1
'))
```

### Fixes and Improvements

- Updated 4.1 to 2026.04.01 for all platforms.

## PyKX 3.1.8

#### Release Date

Expand Down
150 changes: 150 additions & 0 deletions docs/scripts/strip-q-prompt-copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// When a user clicks a code copy button, copy the code but remove
// leading REPL prompts (q), >>>, and Python continuation ...).
//
// Add this file to mkdocs extra_javascript as javascript/strip-repl-prompts.js
// and ensure it loads after the Material copy button script.

(function () {

// Robust selectors covering Material for MkDocs variations
// (theme versions use slightly different class names)
const COPY_BUTTON_SELECTORS = [
'.md-code .md-clipboard', // older / generic
'button.md-code__copy', // theme internal
'button.md-clipboard', // fallback
'.md-code__copy-button' // some custom builds
].join(',');

// Regex to remove leading REPL prompts (allow optional leading whitespace)
// Matches:
// q)
// >>>
// ...
const REPL_PROMPT_RE = /^\s*(q\)|>>>|\.\.\.)\s?/;

// Helper: find nearest ancestor matching a selector
function closest(el, selector) {
while (el) {
if (el.matches && el.matches(selector)) return el;
el = el.parentElement;
}
return null;
}

// Clean the code text by removing REPL prompts at the start of each line
function stripReplPrompts(text) {
return text
.split('\n')
.map(line => line.replace(REPL_PROMPT_RE, ''))
.join('\n');
}

// Retrieve visible code text from a code block container
function getCodeTextFromBlock(container) {
if (!container) return '';

// Typical structure:
// <div class="md-code">
// <pre><code>...</code></pre>
// </div>
const codeElem =
container.querySelector('pre > code') ||
container.querySelector('code');

if (!codeElem) return '';

// Use textContent to preserve visible text only (no markup)
return codeElem.textContent || '';
}

// Clipboard write with modern API and legacy fallback
function writeToClipboard(text) {
if (navigator.clipboard && navigator.clipboard.writeText) {
return navigator.clipboard.writeText(text);
}

// Fallback for older browsers
const textarea = document.createElement('textarea');
textarea.value = text;
textarea.style.position = 'fixed';
textarea.style.left = '-9999px';
document.body.appendChild(textarea);
textarea.select();

try {
document.execCommand('copy');
document.body.removeChild(textarea);
return Promise.resolve();
} catch (err) {
document.body.removeChild(textarea);
return Promise.reject(err);
}
}

// Attach copy interception to all copy buttons
function wireCopyButtons() {
document.querySelectorAll(COPY_BUTTON_SELECTORS).forEach(btn => {

// Prevent duplicate binding if MutationObserver re-runs
if (btn.__replPromptBound) return;
btn.__replPromptBound = true;

btn.addEventListener('click', function (ev) {
try {
// Locate the containing code block
const codeContainer =
closest(btn, '.md-code') ||
closest(btn, 'pre') ||
closest(btn, 'code') ||
btn.parentElement;

const raw = getCodeTextFromBlock(codeContainer);

if (!raw) {
// If no code found, allow default behavior
return;
}

// Remove REPL prompts before copying
const cleaned = stripReplPrompts(raw);

// Override default copy behavior
ev.preventDefault();
ev.stopPropagation();

writeToClipboard(cleaned).then(() => {
// Optional: emit event for future UI feedback hooks
btn.dispatchEvent(
new CustomEvent('repl-copy-success', { bubbles: true })
);
}).catch(() => {
// On failure, allow theme fallback behavior
});

} catch (e) {
// Fail silently and allow default copy behavior
return;
}

}, { capture: false });

});
}

// Initial binding once DOM is ready
document.addEventListener('DOMContentLoaded', () => {
wireCopyButtons();

// Re-bind if new code blocks are dynamically added
const observer = new MutationObserver(() => {
wireCopyButtons();
});

observer.observe(document.body, {
childList: true,
subtree: true
});
});

})();

Loading
Loading