Upgrade from PyKX 2.5.* to 3.*
This page outlines key differences when upgrading PyKX versions from 2.5.* to 3.*.
API Changes
Remote Python execution
-
Remote Python Execution is no longer a Beta feature. To use this feature, remove the setting of the
PYKX_BETA_FEATURESenvironment variable. -
Additional required dependencies for this feature are now part of the required dependencies.
-
Generation of a remote session which can be used previously was a two-step process:
- Initialize the session object
- Create the session
This changed to a single function call.
-
How users specify the Python libraries which should be available on remote processes has changed:
-
Previously this was done using a function call to
session.add_library. This function would specify the libraries to be loaded on first execution of the function and expected the names of the libraries to be loaded as a list of arguments. -
Now you can use the keyword #libraries at session creation to load the libraries. Also, the library addition function is now called
session.librariesto match the API for streaming with PyKX. Finally thelibrarieskeyword and function take a dictionary mapping the aliased name for the library to the library which is to be imported, namelyimport numpy as npwould be defined as{'np': 'numpy'}.
Previous behaviour
New behaviour
Python
Copy>>> import pykx as kx
>>> session = kx.remote.session()
>>> session.create(host='localhost', port=5050)
>>> session.add_library('numpy', 'pykx')Python
Copy>>> import pykx as kx
# Initialise libraries at session creation
>>> session = kx.remote.session(port=5050, libraries = {'kx': 'pykx', 'np': 'numpy'})
# Add Libraries after session creation
>>> session = kx.remote.session(port=5050)
>>> session.libraries({'kx': 'pykx', 'np': 'numpy'}) -
-
The
clearmethod provided forsessionobjects is now calledclose. This change aligns the naming with IPC communication channels being 'closed' when stopping communication with a remote session and aligns with the naming used within the IPC module
Deprecations
-
The following table outlines environment variables/configuration options which are now fully deprecated and the updated name for these values if they exist.
Deprecated option
Supported option
PYKX_NO_SIGINTPYKX_NO_SIGNALIGNORE_QHOMEPYKX_IGNORE_QHOMEKEEP_LOCAL_TIMESPYKX_KEEP_LOCAL_TIMESSKIP_UNDERQPYKX_SKIP_UNDERQUNDER_PYTHONPYKX_UNDER_PYTHONUNSET_PYKX_GLOBALSNo longer applicable
PYKX_UNSET_GLOBALSNo longer applicable
PYKX_ENABLE_PANDAS_APINo longer applicable
-
Removal of deprecated
modifykeyword forselect,exec,updateanddeleteoperations onpykx.Tableandpykx.KeyedTable. This has been permanently changed to be useinplace.
Error message changes
Various pykx.QError error messages now provide more verbose explanations for users. Any code which relies on specific error string returns may need to be updated, some messages below are truncated for display purposes.
|
Previous error message |
Updated error message |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Null and Infinite conversion changes
PyKX previously left some null and infinite values unconverted, now these are converted to native Python objects.
The behaviour of Atom and Vector conversions has also been updated to more closely match each other.
The links below outline the full before and after behaviour.
Pandas 2.2.X Update
PyKX now works with Pandas 2.2.X, introducing some breaking changes in behavior. Specifically, the .equals method now checks the _mgr type of DataFrames, which can result in unilateral behavior when comparing PyKX and Pandas objects.
These changes may affect compatibility with code written for earlier versions of Pandas.
The link below outline the full details of the changes and their implications.