Skip to content

Context Interface

pykx.ctx

Interface to q contexts and scripts which define a namespace.

The context interface provides an easy to way access q contexts (also known as namespaces when at the top level). For more information about contexts/namespaces in q please refer to Chapter 12 of Q for Mortals.

CurrentDirectory

CurrentDirectory()

Bases: type(Path())

pathlib.Path instance for the current directory regardless of directory changes.

QContext

QContext(q, name, parent, no_ctx=False)

Interface to a q context.

Members of the context be accessed as if the QContext object was a dictionary, or by dotting off of the QContext object.

q: The q instance in which the context exists.
name: The name of the context.
parent: The parent context as a `QContext`, or `None` in the case of the global context.

_invalidate_cache

_invalidate_cache()

Clears the cached context, forcing it to be reloaded the next time it is accessed.

ZContext

ZContext(global_context)

Bases: QContext

Special interface to handle the .z context.

The .z context in q is not a normal context; it lacks a dictionary. To access it one must access its attributes directly.

_fully_qualified_name

_fully_qualified_name(name, parent)

Constructs the fully qualified name of a context given its name and parent.