{"id":18743101,"url":"https://github.com/kxsystems/pykx","last_synced_at":"2025-08-03T00:34:20.942Z","repository":{"id":182838720,"uuid":"643950142","full_name":"KxSystems/pykx","owner":"KxSystems","description":"PyKX is a Python first interface to the worlds fastest time-series database kdb+ and it's underlying vector programming language q.","archived":false,"fork":false,"pushed_at":"2025-03-18T16:16:35.000Z","size":14027,"stargazers_count":53,"open_issues_count":3,"forks_count":15,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-08T21:02:18.731Z","etag":null,"topics":["kdb","kdb-q","python","q","qpython"],"latest_commit_sha":null,"homepage":"https://code.kx.com/pykx","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KxSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/support.md","governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-22T13:46:21.000Z","updated_at":"2025-03-18T16:12:14.000Z","dependencies_parsed_at":"2023-09-22T19:36:49.019Z","dependency_job_id":"5276b194-afe2-4338-889b-535148e2f528","html_url":"https://github.com/KxSystems/pykx","commit_stats":null,"previous_names":["kxsystems/pykx"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fpykx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fpykx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fpykx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fpykx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KxSystems","download_url":"https://codeload.github.com/KxSystems/pykx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075988,"owners_count":21043682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kdb","kdb-q","python","q","qpython"],"created_at":"2024-11-07T16:10:06.530Z","updated_at":"2025-08-03T00:34:20.910Z","avatar_url":"https://github.com/KxSystems.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyKX\n\n## Introduction\n\nPyKX 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.\n\nThis 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 but rather empowers those who want to make use of the power of kdb+/q who lack this expertise to get up and running fast.\n\nPyKX supports three principal use cases:\n\n- It allows users to store, query, manipulate and use q objects within a Python process.\n- It allows users to query external q processes via an IPC interface.\n- It allows users to embed Python functionality within a native q session using it's under q functionality.\n\nUsers wishing to install the library can do so following the instructions [here](https://code.kx.com/pykx/getting-started/installing.html).\n\nOnce you have the library installed you can get up and running with PyKX following the quickstart guide [here](https://code.kx.com/pykx/getting-started/quickstart.html).\n\n### What is q/kdb+?\n\nMentioned throughout the documentation q and kdb+ are respectively a highly efficient vector programming language and highly optimised time-series database used to analyse streaming, real-time and historical data. Used throughout the financial sector for 25+ years this technology has been a cornerstone of modern financial markets providing a storage mechanism for historical market data and tooling to make the analysis of this vast data performant.\n\nKdb+ is a high-performance column-oriented database designed to process and store large amounts of data. Commonly accessed data is available in RAM which makes it faster to access than disk stored data. Operating with temporal data types as a first class entity the use of q and it's query language qsql against this database creates a highly performant time-series analysis tool.\n\nq is the vector programming language which is used for all interactions with kdb+ databases and which is known both for its speed and expressiveness.\n\nFor more information on using q/kdb+ and getting started with see the following links:\n\n- [An introduction to q/kdb+](https://code.kx.com/q/learn/tour/)\n- [Tutorial videos introducing kdb+/q](https://code.kx.com/q/learn/q-for-all/)\n\n## Installation\n\n### Installing PyKX using `pip`\n\nEnsure you have a recent version of pip:\n\n```bash\npip install --upgrade pip\n```\n\nThen install the latest version of PyKX with the following command:\n\n```bash\npip install pykx\n```\n\nTo install a specific version of PyKX run the following command replacing \u003cINSERT_VERSION\u003e with a specific released semver version of the interface\n\n```bash\npip install pykx==\u003cINSERT_VERSION\u003e\n```\n\n**Warning:** Python packages should typically be installed in a virtual environment. [This can be done with the venv package from the standard library](https://docs.python.org/3/library/venv.html).\n\n### PyKX License access and enablement\n\nInstallation of PyKX via pip provides users with access to the library with limited functional scope, full details of these limitations can be found [here](docs/user-guide/advanced/modes.md). To access the full functionality of PyKX you must first download and install a kdb+ license, this can be achieved either through use of a personal evaluation license or receipt of a commercial license.\n\n#### Personal Evaluation License\n\nThe following steps outline the process by which a user can gain access to an install a kdb Insights license which provides access to PyKX\n\n1. Visit https://kx.com/kdb-insights-sdk-personal-edition-download/ and fill in the attached form following the instructions provided.\n2. On receipt of an email from KX providing access to your license download this file and save to a secure location on your computer.\n3. Set an environment variable on your computer pointing to the folder containing the license file (instructions for setting environment variables on PyKX supported operating systems can be found [here](https://chlee.co/how-to-setup-environment-variables-for-windows-mac-and-linux/).\n\t* Variable Name: `QLIC`\n\t* Variable Value: `/user/path/to/folder`\n\n#### Commercial Evaluation License\n\nThe following steps outline the process by which a user can gain access to an install a kdb Insights license which provides access to PyKX\n\n1. Contact you KX sales representative or sales@kx.com requesting a trial license for PyKX evaluation. Alternately apply through https://kx.com/book-demo.\n2. On receipt of an email from KX providing access to your license download this file and save to a secure location on your computer.\n3. Set an environment variable on your computer pointing to the folder containing the license file (instructions for setting environment variables on PyKX supported operating systems can be found [here](https://chlee.co/how-to-setup-environment-variables-for-windows-mac-and-linux/).\n\t* Variable Name: `QLIC`\n\t* Variable Value: `/user/path/to/folder`\n\n__Note:__ PyKX will not operate with a vanilla or legacy kdb+ license which does not have access to specific feature flags embedded within the license. In the absence of a license with appropriate feature flags PyKX will fail to initialise with full feature functionality.\n\n### Supported Environments\n\nKX only officially supports versions of PyKX built by KX, i.e. versions of PyKX installed from wheel files. Support for user-built installations of PyKX (e.g. built from the source distribution) is only provided on a best-effort basis. Currently, PyKX provides wheels for the following environments:\n\n- Linux (`manylinux_2_17_x86_64`) with CPython 3.8-3.11\n- macOS (`macosx_10_10_x86_64`) with CPython 3.8-3.11\n- Windows (`win_amd64`) with CPython 3.8-3.11\n\n### Dependencies\n\n#### Python Dependencies\n\nPyKX depends on the following third-party Python packages:\n\n- `pandas\u003e=1.2, \u003c2.0; python_version=='3.8'`\n- `pandas\u003e=1.2, \u003c=2.3.0; python_version\u003e'3.8'`\n- `numpy~=1.22; python_version\u003c'3.11'`\n- `numpy~=1.23, \u003c2.3.0; python_version=='3.11'`\n- `numpy~=1.26, \u003c2.3.0; python_version\u003e'3.11'`\n- `pytz\u003e=2022.1`\n- `toml~=0.10.2`\n- `dill\u003e=0.2.0`\n- `requests\u003e=2.25.0`\n\nThey are installed automatically by `pip` when PyKX is installed.\n\nPyKX also has an optional Python dependency of `pyarrow\u003e=3.0.0, \u003c19.0.0`, which can be included by installing the `pyarrow` extra, e.g. `pip install pykx[pyarrow]`\n\nWhen 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]`\n\nWhen using PyKX Streaming users may require the ability to stop processes initialized in a now unavailable process to facilitate this PyKX can make use of `psutil` this can be installed using the `streaming` extra, e.g. `pip install pykx[streaming]`\n\nWhen using Streamlit users will be required to install `streamlit~=1.28` this can be installed using the `streamlit` extra, e.g. `pip install pykx[streamlit]`\n\nWhen attempting to convert data to/from PyTorch users will be required to install `torch\u003e2.1` this can be installed using the `torch` extra, e.g. `pip install pykx[torch]`\n\n**Warning:** Trying to use the `pa` conversion methods of `pykx.K` objects or the `pykx.toq.from_arrow` method when PyArrow is not installed (or could not be imported without error) will raise a `pykx.PyArrowUnavailable` exception.\n\n#### Optional Non-Python Dependencies\n\n- `libssl` for TLS on [IPC connections](docs/api/ipc.md).\n- `libpthread` on Linux/MacOS when using the `PYKX_THREADING` environment variable.\n\n## Building from source\n\n### Installing Dependencies\n\nThe full list of supported environments is detailed [here](https://code.kx.com/pykx/getting-started/installing.html#supported-environments). Installation of dependencies will vary on different platforms.\n\n`apt` example:\n\n```bash\napt-install python3 python3-venv build-essential python3-dev\n```\n\n`yum` example:\n\n```bash\nyum install python3 gcc gcc-c++ python3-devel.x86_64\n```\n\nWindows:\n\n* [Python](https://www.python.org/downloads/windows/)\n* [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/?q=build+tools).\n* [dlfcn-win32](https://github.com/dlfcn-win32/dlfcn-win32). Can be installed using [Vcpkg](https://github.com/microsoft/vcpkg).\n\nTo install the above dependencies, you can run the `w64_install.ps1` script as an administrator:\n\n```PowerShell\ncd pykx\n.\\w64_install.ps1\n```\n\n### Building\n\nUsing a Python virtual environment is recommended:\n\n```bash\npython3 -m venv pykx-dev\nsource pykx-dev/bin/activate\n```\n\nBuild and install PyKX:\n\n```bash\ncd pykx\npip3 install -U '.[all]'\n```\n\nTo run PyKX in licensed mode ensure to follow the steps to receive a [Personal Evaluation License](https://code.kx.com/pykx/getting-started/installing.html#personal-evaluation-license)\n\nNow you can run/test PyKX:\n\n```bash\n(pykx-dev) /data/pykx$ python\nPython 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e import pykx\n\u003e\u003e\u003e pykx.q('1+1')\npykx.LongAtom(pykx.q('2'))\n```\n\n### Testing\n\nContributions to the project must pass a linting check:\n\n```bash\npflake8\n```\n\nContributions to the project must include tests. To run tests:\n\n```bash\nexport PATH=\"$PATH:/location/of/your/q/l64\" # q must be on PATH for tests\nexport QHOME=/location/of/your/q #q needs QHOME available\npython -m pytest -vvv -n 0 --no-cov --junitxml=report.xml\n```\n\n## PyKX Licenses\n\nThis work is dual licensed under [Apache 2.0](https://code.kx.com/pykx/license.html#apache-2-license) and the [Software License for q.so](https://code.kx.com/pykx/license.html#qso-license) and users are required to abide by the terms of both licenses in their entirety.\n\n## Community Help\n\nIf you have any issues or questions you can post them to [community.kx.com](https://community.kx.com/). Also available on Stack Overflow are the tags [pykx](https://stackoverflow.com/questions/tagged/pykx) and [kdb](https://stackoverflow.com/questions/tagged/kdb).\n\n## Customer Support\n\n* Inquires or feedback: [`pykx@kx.com`](mailto:pykx@kx.com)\n* Support for Licensed Subscribers: [support.kx.com](https://client.support.kx.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkxsystems%2Fpykx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkxsystems%2Fpykx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkxsystems%2Fpykx/lists"}