Favicon

OS X 10.6 vs iPython & readline

Is there some trick to getting the OS X readline -> libedit patch to  
work on a self-installed Python?

Installing iPython into the system python, the specific patch, as  
mentioned in the URL [1] works as expected and iPython starts with:

------------------------------------------------------------------------------------------
(~/src/ipython-0.10)# ipython
Leopard libedit detected.
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
------------------------------------------------------------------------------------------

With a virtualenv, sourced from a self-installed Python, even though  
it should be using the same general OS but a different Python binary,  
the libedit-ness is not detected and I just get:

------------------------------------------------------------------------------------------
(wssw1)(~/src/ipython-0.10)# ipython
WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library
Python 2.6.2 (r262:71600, Jun  9 2009, 10:09:41)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
------------------------------------------------------------------------------------------

Anyone know the trick for getting the built-in iPython patch to work  
(Continue reading)

Robert Kern | 1 Sep 19:45
Picon
Gravatar

Re: OS X 10.6 vs iPython & readline

On 2009-09-01 11:12 AM, Steve Steiner (listsin) wrote:
> Is there some trick to getting the OS X readline ->  libedit patch to
> work on a self-installed Python?
>
> Installing iPython into the system python, the specific patch, as
> mentioned in the URL [1] works as expected and iPython starts with:
>
> ------------------------------------------------------------------------------------------
> (~/src/ipython-0.10)# ipython
> Leopard libedit detected.
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10 -- An enhanced Interactive Python.
> ------------------------------------------------------------------------------------------
>
> With a virtualenv, sourced from a self-installed Python, even though
> it should be using the same general OS but a different Python binary,
> the libedit-ness is not detected and I just get:
>
> ------------------------------------------------------------------------------------------
> (wssw1)(~/src/ipython-0.10)# ipython
> WARNING: Readline services not available on this platform.
> WARNING: The auto-indent feature requires the readline library
> Python 2.6.2 (r262:71600, Jun  9 2009, 10:09:41)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10 -- An enhanced Interactive Python.
> ------------------------------------------------------------------------------------------
>
(Continue reading)

Ludwig Schwardt | 2 Sep 15:56
Picon
Gravatar

Re: OS X 10.6 vs iPython & readline

Hi,

I'm planning to update the readline package available at
http://pypi.python.org/pypi/readline (currently tuned for System
Python 2.5.1 on Leopard) to change to the latest GNU readline 6.0 and
to support Snow Leopard as well. You are welcome to try it yourself,
as I am currently finding little time for side-projects :-(

1. Download and unpack the readline source tarball
(readline-2.5.1.tar.gz), which creates a directory 'readline-2.5.1'.

2. Obtain the source code of your self-installed Python distribution
(or in the case of a System Python, the source code of the standard
Python distribution of the same version).

3. Copy the Modules/readline.c file (containing the Python module) to
Modules/readline.c inside the 'readline-2.5.1' directory.

4. Run 'python setup.py install' and hope for the best :-)

Regards,
Ludwig
Steve Steiner | 2 Sep 17:47
Favicon

Re: OS X 10.6 vs iPython & readline


On Sep 1, 2009, at 1:45 PM, Robert Kern wrote:
>
> Are you sure that you built readline in your self-installed Python?  
> Please do
> the following and show us the output (substituting the appropriate  
> filename of
> readline.so, of course):

No, I built and installed readline at the system level from source.   
iPython, running under the system Python (which is 2.6.1 on Snow  
Leopard 10.6), uses built-in patch to use the libedit shipped with OS  
X instead.

With system Python:

> ~/src/ipython-0.10)# ipython
> Leopard libedit detected.

I'm wondering why the iPython libedit detection doesn't work with a  
self-installed Python, not how to get readline built into the self- 
built Python.

I didn't do anything special to build readline into the self-built  
Python; I just built from the source from python.org.

It actually looks like I get a mess in my virtualenv, now that I take  
a look, and that could explain why the readline detection is failing  
in a bad way and not falling back to the normal 'darwin' use of libedit:

(Continue reading)

Dennis Muhlestein | 3 Sep 20:30
Picon
Gravatar

Re: New GUI integration in IPython

Brian Granger wrote:

> At this point, we need developers to begin to try out the new stuff and 
> adapt their projects to use the new capabilities.  Here are some things 
> you will get:
> 
> * Stability and robustness have been improved greatly.
> * KeyboardInterrupts should work on all platforms reliably.
> * No more command line flags - instead everything can be 
> activated/de-activated/switched at runtime.  This should allow projects 
> like matplotlib to enable reliable backend switching.  See the new %gui 
> magic for more information on this.
> * We have a new developer module for working with these features 
> (IPython.lib.inputhook).
> * Unless someone complains very loudly *and* steps up to the plate to 
> maintain them, the old threaded shells will be removed in the next 
> release of IPython.

I gave the 0.11 branch a run this morning.  My initial impression is
that it's much nicer.  I didn't see if there was a current way to do a
couple things.

1) It would be nice if I could run commands in the shell while my
application is running that don't block the GUI.
2) I'd like to have the shell close if the application closes.

We all discussed this a while back when looking at the older -wthread
options for doing this but I thought it a good time to re-mention them
with the new inputhook code merged into trunk.

(Continue reading)

Dennis Muhlestein | 3 Sep 21:44
Picon
Gravatar

ipython-wx and control-c

Testing out iPython .10, I can't seem to use control-c in the ipython-wx 
app.

Test:
# bash
 > ipython-wx

... app launches, terminal available to execute commands ...

# ipython-wx terminal
 > import time
 > x=1
 > while True:
 >    print x
 >    x += 1
 >    time.sleep(1)
 >
 >

Now, I start seeing numbers  executing, and I want to press cntl-c to 
stop it.  When I press cntl-c, the app hangs.

Also, I can't use cntl-r to reverse search.  Is there a way to enable 
these options or is this a limitation of the widget?

Thanks
Dennis
Brian Granger | 3 Sep 23:21
Picon

Re: New GUI integration in IPython


I gave the 0.11 branch a run this morning.  My initial impression is
that it's much nicer.  I didn't see if there was a current way to do a
couple things.

Thanks for trying it out! 

1) It would be nice if I could run commands in the shell while my
application is running that don't block the GUI.

The only way of doing this is to run the code in a tread or process.  But, then you
have a constraint.  You will need to be very careful that if your code (in the thread)
and the GUI both touch the same objects, you will need to protect things with locks
to make it thread safe.
 
2) I'd like to have the shell close if the application closes.


This is still not really possible, but I think it may become possible with some changes I
have in a branch.  Keep watching trunk as it develops.

We all discussed this a while back when looking at the older -wthread
options for doing this but I thought it a good time to re-mention them
with the new inputhook code merged into trunk.

 
Perhaps I could use the frontend.wx package or the gui.wx package
(exists in 0.10 already) to accomplish what I want but it's a little
unclear from the documentation I've found so far which classes would be
appropriate to use.


The new inputhook stuff is only used in terminal based applications.  The frontend
package is still the same and may or may not be useful to you.  I don't really
know that part of the code base.
 
Brian

Thanks
Dennis

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Ben Beuchler | 4 Sep 02:20
Picon

Binding C-l to clear-screen on OS X

I'm setting up my work environment on a clean install of OS X 10.6.  I
installed ipython 0.10 and the readline module from the scipy.org
site.  (Building it on 10.6 took a bit of work, documented here:
http://insyte.squad51.net/)

Overall readline seems to be working perfectly, but so far I haven't
been able to get back to my preferred behavior for the Ctrl-l
combination:  clearing the screen.

It seems to me that adding these two lines to the main() function in
~/.ipython/ipy_user_conf.py should have done the trick:

import readline
readline.parse_and_bind("\C-l: clear-screen")

But ctrl-l instead seems to be acting like a <TAB> key.

I've made no other modifications to the config.  Since I installed the
readline module, ipython no longer says ""Leopard libedit detected" on
startup.

Any recommendations?

Thanks...

-Ben
Favicon

Re: Binding C-l to clear-screen on OS X


On Sep 3, 2009, at 8:20 PM, Ben Beuchler wrote:

> I'm setting up my work environment on a clean install of OS X 10.6.  I
> installed ipython 0.10 and the readline module from the scipy.org
> site.  (Building it on 10.6 took a bit of work, documented here:
> http://insyte.squad51.net/)
>
> Overall readline seems to be working perfectly, but so far I haven't
> been able to get back to my preferred behavior for the Ctrl-l
> combination:  clearing the screen.
>
> It seems to me that adding these two lines to the main() function in
> ~/.ipython/ipy_user_conf.py should have done the trick:
>
> import readline
> readline.parse_and_bind("\C-l: clear-screen")
>
> But ctrl-l instead seems to be acting like a <TAB> key.
>
> I've made no other modifications to the config.  Since I installed the
> readline module, ipython no longer says ""Leopard libedit detected" on
> startup.

I started a thread on this a few days ago; maybe something in there  
will help you.

I never did figure out why the iPython patch doesn't still work on  
10.6 but I pretty much gave up on 10.6 for anything other than mail  
and TextMate; it's just too much of a pain to install dev tools in  
this bizarre setup.

I just ssh into an Ubuntu server and do everything there without  
hassle and use OS X for all the pretty parts.  That's not to say that  
it isn't the best at the pretty parts, but as a Python development  
platform, it's just too much work, especially where you can run an  
Ubuntu in a virtual machine on the same box.

S
Ben Beuchler | 4 Sep 19:23
Picon

Re: OS X 10.6 vs iPython & readline

> I'm planning to update the readline package available at
> http://pypi.python.org/pypi/readline (currently tuned for System
> Python 2.5.1 on Leopard) to change to the latest GNU readline 6.0 and
> to support Snow Leopard as well. You are welcome to try it yourself,
> as I am currently finding little time for side-projects :-(

I didn't update to the latest GNU readline, but I grabbed the package
from scipy and, with a few tweaks, was able to get it to build on
10.6.  Basically it just required commenting out the lines that
attempt to build a universal binary (-arch ppc, etc.).

http://insyte.squad51.net has more details.

Works great!

-Ben

Gmane