Save / Restore IPython Global Kernel Kernels

I am currently working on creating an interactive python terminal using the IPython kernel.

I managed to create a working interpreter (via the web interface using web maps) using the KernelManager class ('IPython.kernel.manager.KernelManager'). However, I also want to implement a function in which I can save a “snapshot” of the current state of the kernel. In other words, I want to keep a copy of the locals () and globals () dict of the kernel, which I will then have to apply back to the kernel at a later time, in order to practically go back (or forward) in time.

To do this, I need to understand how I can directly access the interpreter namespace, without actually passing through the kernel messaging channels. That is, I need actual references to objects in the namespace.

Is it possible? I try to work through the documentation on IPython for most of the day without much success.

Many thanks for your help.

Eirik

+4
source share

Source: https://habr.com/ru/post/1540220/


All Articles