Skip to content

License management

This page documents utility functions that allow users to manage their PyKX licenses.

check

check(license, *, format='FILE', license_type=lic_type)

Validate the license key information you provided matches the license saved to disk which is read by PyKX

Parameters:

Name Type Description Default
license str

If using "FILE" format this is the location of the file being used for comparison. If "STRING" this is the base64 encoded string provided in your license email

required
format Optional[str]

Is the license check being completed using a downloaded file or base64 encoded string. Accepted inputs are "FILE"(default) or "STRING".

'FILE'
license_type Optional[str]

The license file type/name which is to be checked, by default this is 'kc.lic' which is the version provided with personal and commercial evaluation licenses but can be changed to 'k4.lic' or 'kx.lic' if appropriate

lic_type

Returns:

Type Description
bool

A boolean indicating if the license is correct or not and a printed message describing the issue

Examples:

Validate that a provided license matches an existing persisted license

>>> import pykx as kx
>>> kx.license.check('/usr/location/kc.lic')
True

Attempt to check a new license against an existing installed license

>>> import pykx as kx
>>> check = kx.license.check('/usr/location/kc.lic')
Supplied license information does not match.
Please consider reinstalling your license using pykx.util.install_license

Installed license representation:
b'iIXSiEWzCNTkkCWK5Gggy..'
User expected license representation:
b'IyEvdXNyL2Jpbi9lbngDf..'
>>> check
False

Attempt to check a license in the case no license is currently installed

>>> import pykx as kx
>>> check = kx.license.check('setup.py', license_type='kc.lic')
Unable to find an installed license: kc.lic at location: /usr/local/anaconda3/envs/qenv/q.
Please consider installing your license again using pykx.util.install_license
>>> check
False

expires

expires()

The number of days until the license is set to expire.

Returns:

Type Description
int

The number of days until the license is set to expire

The number of days until your license expires:

>>> import pykx as kx
>>> kx.license.expires()
265

install

install(license, *, format='FILE', license_type='kc.lic', force=False)

(Re)install a KX license key, optionally overwriting the currently installed license.

Parameters:

Name Type Description Default
license str

If using "FILE" this is the location of the file being used for comparison. If "STRING" this is the base64 encoded string provided in your license email

required
format Optional[str]

Is the license check being completed using a downloaded file or base64 encoded string. Accepted inputs are "FILE"(default) or "STRING".

'FILE'
license_type Optional[str]

The license file type/name which is to be checked, by default this is 'kc.lic' which is the version provided with personal and commercial evaluation licenses but can be changed to 'k4.lic' or 'kx.lic' if appropriate

'kc.lic'
force Optional[bool]

Enforce overwrite without opt-in message for overwrite

False

Returns:

Type Description
bool

A boolean indicating if the license has been correctly overwritten

Examples:

Install a license using a supplied file location

>>> import pykx as kx
>>> kx.license.install('/path/to/license')
True

Install a k4.lic base64 encoded string representation of the license

>>> import pykx as kx
>>> b64_string = 'IdyannfDangfa4FasdjD9fcda' # Example
>>> kx.license.install(b64_string, format = "STRING", license_type = "k4.lic")
True