I experimented yesterday a bit w/ IPython trunk, to discover that Gaƫl
Varoquaux has written a wx based front end for IPython (IPythonx, and
IPtyon-wx, but I found the former at this point more interesting, as
it has nice, scrolling completion).

I tried to "quickly"  hack up gluon/shell.py to see if I could call
ipythonx instead of ipython.   Besides the graphical completion, I
also played with activating an editor through ipython startup scripts,
and even enabling a shell-like profile (which turns out to be pretty
cool; see http://ipython.scipy.org/moin/Cookbook/ShProfile).   The
editor, for example, you can invoke the editor like this:  %edit
os.path.isfile).

Anyway - my "quick" experiment failed, and I wound up exchanging a few
emails w/ Gael.  This caused me to look into the ipython docs more,
and in different places.

Among other things, I managed to call up ipython through ipapi, rather
than as it's currently called.   I'm not yet sure of all the
implications - but Massimo encouraged me to start a thread.

It looks like thru the ipapi, we can set user contexts - that is,
attach the the current environment.   This, along with enabling shell
behaviors and other "magic" - the IPythin structure looks pretty good
-  I think we might be able to enable a shell in a different way:   we
might be able to start web2py during development WITH a running
ipythin in the invoking window, and - as we load applications, set
their context for the ipython window.   I think we could also be able
to set some ipapi hooks, or document them for developers to use during
code development to make this tailored to the web2py environment.

Currently, the only "test" change I've made is in gluon/shell.py, and
it's just this:

            try:
                # yarko's trying this a different way:
                # import IPython
                # shell = IPython.Shell.IPShell(argv=[], user_ns=_env)
                # shell.mainloop()
                import IPython.ipapi
                # Clear the options, to avoid having the ipython0
instance complain
                import sys
                sys.argv = sys.argv[:1]
                print "launching Ipython instance...."

                IPython.ipapi.launch_new_instance(_env)
                print "Exited Ipython instance..."  # do you want to
go to main now?
                return
            except:

With a little poking around the ipapi today, we can create a context
of ip before launching it (in main), and invoke it.  As we run, I
imagine we can attach the current context to the ipython instance -
perhaps from the admin interface - "push context to shell".

I thought I'd put this out there so people can start looking at the
IPython Extension API - there's lots of potential and "magic"
available, and a lot to read and learn about.  Hopefully, someone
(Stuart?) can help trying to move shell into an interactive one that
works with the server running in normal mode.    Perhaps others will
get ideas of what hooks into the python level api might be useful for
develping / testing web apps.

I'm looking at this

     http://ipython.scipy.org/moin/IpythonExtensionApi
     http://ipython.scipy.org/doc/manual/html/interactive/extension_api.html

Let me know if you're interested.   If there's enough, we could work
w/ Massimo to start an experimental branch on Launchpad to explose
this a bit.

Regards,
Yarko


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to