Compiliation, Evaluation, & Execution (xonsh.execer)

Implements the xonsh executer.

class xonsh.execer.Execer(filename='<xonsh-code>', debug_level=0, parser_args=None, unload=True, xonsh_ctx=None, scriptcache=True, cacheall=False)[source]

Executes xonsh code in a context.

Parameters:

filename : str, optional

File we are to execute.

debug_level : int, optional

Debugging level to use in lexing and parsing.

parser_args : dict, optional

Arguments to pass down to the parser.

unload : bool, optional

Whether or not to unload xonsh builtins upon deletion.

xonsh_ctx : dict or None, optional

Xonsh xontext to load as builtins.__xonsh_ctx__

scriptcache : bool, optional

Whether or not to use a precompiled bytecode cache when execing code, default: True.

cacheall : bool, optional

Whether or not to cache all xonsh code, and not just files. If this is set to true, it will cache command line input too, default: False.

compile(input, mode='exec', glbs=None, locs=None, stacklevel=2, filename=None, transform=True)[source]

Compiles xonsh code into a Python code object, which may then be execed or evaled.

eval(input, glbs=None, locs=None, stacklevel=2, filename=None, transform=True)[source]

Evaluates (and returns) xonsh code.

exec(input, mode='exec', glbs=None, locs=None, stacklevel=2, filename=None, transform=True)[source]

Execute xonsh code.

parse(input, ctx, mode='exec', filename=None, transform=True)[source]

Parses xonsh code in a context-aware fashion. For context-free parsing, please use the Parser class directly or pass in transform=False.