metakernel.
MetaKernel
(*args, **kwargs)[source]¶run_as_main
()[source]¶Launch or install a metakernel.
Modules implementing a metakernel subclass can use the following lines:
- if __name__ == ‘__main__’:
- MetaKernelSubclass.run_as_main()
makeSubkernel
(kernel)[source]¶Run this method in an IPython kernel to set this kernel’s input/output settings.
get_local_magics_dir
()[source]¶Returns the path to local magics dir (eg ~/.ipython/metakernel/magics)
do_execute_file
(filename)[source]¶Default code for running a file. Just opens the file, and sends the text to do_execute_direct.
do_execute_meta
(code)[source]¶Execute meta code in the kernel. This uses the execute infrastructure but allows JavaScript to talk directly to the kernel bypassing normal processing.
When responding to the %%debug magic, the step and reset meta commands can answer with a string in the format:
“highlight: [start_line, start_col, end_line, end_col]”
for highlighting expressions in the frontend.
initialize_debug
(code)[source]¶This function is used with the %%debug magic for highlighting lines of code, and for initializing debug functions.
Return the empty string if highlighting is not supported.
do_function_direct
(function_name, arg)[source]¶Call a function in the kernel language with args (as a single item).
do_history
(hist_access_type, output, raw, session=None, start=None, stop=None, n=None, pattern=None, unique=False)[source]¶Access history at startup.
do_is_complete
(code)[source]¶Given code as string, returns dictionary with ‘status’ representing whether code is ready to evaluate. Possible values for status are:
‘complete’ - ready to evaluate ‘incomplete’ - not yet ready ‘invalid’ - invalid code ‘unknown’ - unknown; the default unless overridden
Optionally, if ‘status’ is ‘incomplete’, you may indicate an indentation string.
Example:
- return {‘status’ : ‘incomplete’,
- ‘indent’: ‘ ‘ * 4}
call_magic
(line)[source]¶Given an line, such as “%download http://example.com/”, parse and execute magic.