On Monday, November 6, 2017 at 7:06:27 AM UTC-6, Edward K. Ream wrote:

But for now I'm enjoying learning as much as I can about the jupyter code.  
> So I'll follow the high-energy path and not worry about where it leads...
>

I'm beginning to doubt whether the code can be distilled as I first 
envisioned.  For example, the following fails when run from Leo:

    # from jupyter_console.__main__.py
    from jupyter_console import app
    app.launch_new_instance()

This code gives the message endlessly when run from Leo:

    QCoreApplication::exec: The event loop is already running

Apparently, there is Qt code in the jupyter console app.  It's extremely 
messy.

The alternative would be to perform a more radical distillation of the 
code, trying to create a working analog of Terry's "totally made up" pseudo 
code, namely:

    connection = zeromq.connect("http://127.0.0.1:8901/notebooks/book2";)
    cell_id = connection.add_cell(type='code')
    connection.set_content(cell_id, "import math\na=math.sin(1)")
    connection.run_cell(cell_id)
    html = connection.get_html(cell_id)

There are too many details to keep straight in my mind.  My previous, 
not-really-working code was:

    def make_channel(channel_name):
    
        print('-'*20)
        put('channel_name', channel_name)
        url = cl._make_url(channel_name)
        put('url', url)
        cl.log.debug("connecting %s channel to %s" % (channel_name, url))
        socket = cl.connect_shell(identity=cl.session.bsession)
        put('socket', socket)
        channel = ZMQSocketChannel(socket, cl.session)
            # New code: don't use the various _x_channel_class values.
        put('channel', channel)
        return channel
       
    put('g.isPython3', g.isPython3)
    cl = client.KernelClient()
    put('shell_channel_class', cl.shell_channel_class)
    put('session', cl.session)
    cl._shell_channel = make_channel('shell')
    cl._iopub_channel = make_channel('iopub')
    cl._stdin_channel = make_channel('stdin')
    cl._hb_channel = make_channel('hb')
    cl.allow_stdin = True

*Summary*

I am at my limit of my working memory, trying to keep all the various 
approaches in my head.  

The "distilling" project is foundering during initialization, which is 
mind-boggling.

The "prototype" project is foundering because of it's incompleteness.

The solution may be to ignore "packaging" (existing classes) and just focus 
on these tasks:

- Create and init a kernel.
- Send and receive an "execute" message.

It's not clear that *any* jupyter code can be used, except imports...

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to