List Info

Thread: readline support for OS X Leopard




readline support for OS X Leopard
user name
2007-10-22 00:51:57
I have been getting ready for the official leopard release in a few days, and have been a bit worried about readline support.  I forgot what I did to get it to work for IPython, which I absolutely cannot live without anymore.  Is there a plan for a Leopard binary that fixes readline, or can I help someone prepare some documentation on getting readline working properly.  I don't have a lot of time during the next couple of weeks to get into compile hell, but if someone has any easy fix to get readline to work, I would greatly appreciate it.
Re: readline support for OS X Leopard
user name
2007-10-22 08:02:09
    Noah> ... if someone has any easy fix to get readline
to work, I would
    Noah> greatly appreciate it.

Just install GNU readline and point the build system at it. 
For example, I
have MacPorts (http://www.macports.org/
) installed in /opt/local.  GNU
readline is installed there, and my readline module is
linked against that:

    % otool -L ~/local/lib/python2.6/lib-dynload/readline.so

   
/Users/skip/local/lib/python2.6/lib-dynload/readline.so:
            /opt/local/lib/libreadline.5.2.dylib
(compatibility version 5.0.0, current version 5.2.0)
            /opt/local/lib/libncursesw.5.dylib
(compatibility version 5.0.0, current version 5.0.0)
            /usr/lib/libmx.A.dylib (compatibility version
1.0.0, current version 93.0.0)
            /usr/lib/libSystem.B.dylib (compatibility
version 1.0.0, current version 88.1.10)

Configured like so:

    ./configure  --prefix=/Users/skip/local
CPPFLAGS=-I/opt/local/include 
        LDFLAGS=-L/opt/local/lib

I don't do framework builds, but if CPPFLAGS and LDFLAGS are
set
appropriately those should work as well.

Skip
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: readline support for OS X Leopard
user name
2007-10-22 13:19:28
On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:

I have been getting ready for the official leopard release in a few days, and have been a bit worried about readline support.  I forgot what I did to get it to work for IPython, which I absolutely cannot live without anymore.  Is there a plan for a Leopard binary that fixes readline, or can I help someone prepare some documentation on getting readline working properly.  I don't have a lot of time during the next couple of weeks to get into compile hell, but if someone has any easy fix to get readline to work, I would greatly appreciate it.

The installed version of python on Leopard will actually have readline support turned on by default, but it uses the EditLine (libedit) library, not the GNU Readline (due to licensing reasons).  While functionally equivalent, the command syntax is different.  From the python(1) man page:

INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
       The Python inteterpreter supports editing of the current input line and
 ;      history substitution, similar to facilities found in the Korn shell and
 ;      the  GNU  Bash shell.  However, rather than being implemented using the
 ;      GNU Readline library, this Python interpreter  uses  the  BSD  EditLine
 ;      library editline(3) with a GNU Readline emulation layer.

       The  readline  module  provides the access to the EditLine library, but
 ;      there are a few major differences compared to a traditional implementa-
       tion  using  the  Readline  library.   The command language used in the
 ;      preference files is that of EditLine, as described in editrc(5) and not
 ;      that   used  by  the  Readline  library.   This  also  means  that  the
       parse_and_bind() routines uses EditLine commands.  And  the  preference
       file itself is ~/.editrc instead of ~/.inputrc.

       For  example,  the rlcompleter module, which defines a completion func-
       tion for the  readline  modules,  works  correctly  with  the  EditLine
 ;      libraries, but needs to be initialized somewhat differently:

              import rlcompleter
              import readline
  ;            readline.parse_and_bind("bind ^I rl_complete")

       For vi mode, one needs:

              readline.parse_and_bind("bind -v")

--------------------------------------------------------------------------

Edward Moy

Apple Computer, Inc.

emoyapple.com">emoyapple.com


Re: readline support for OS X Leopard
user name
2007-10-22 13:35:39
Edward,

Thanks for the information.  Do you know of a way to get IPython to use edline instead?  IPython is growing in popularity for Python programmers, and it seems like getting a way forward that works with edline makes sense, or maybe I am wrong and people will need to just manually install readline themselves.

Noah

On 10/22/07, Edward Moy < emoyapple.com">emoyapple.com> wrote:
On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:

I have been getting ready for the official leopard release in a few days, and have been a bit worried about readline support.&nbsp; I forgot what I did to get it to work for IPython, which I absolutely cannot live without anymore.&nbsp; Is there a plan for a Leopard binary that fixes readline, or can I help someone prepare some documentation on getting readline working properly.&nbsp; I don't have a lot of time during the next couple of weeks to get into compile hell, but if someone has any easy fix to get readline to work, I would greatly appreciate it.

&nbsp;
The installed version of python on Leopard will actually have readline support turned on by default, but it uses the EditLine (libedit) library, not the GNU Readline (due to licensing reasons).  While functionally equivalent, the command syntax is different.  From the python(1) man page:

 
INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
 &nbsp;     The Python inteterpreter supports editing of the current input line and
 ;      history substitution, similar to facilities found in the Korn shell and
&nbsp;      the  GNU  Bash shell.  However, rather than being implemented using the
 ;      GNU Readline library, this Python interpreter  uses  the  BSD  EditLine
 ;      library editline(3) with a GNU Readline emulation layer.

 
&nbsp;      The  readline  module  provides the access to the EditLine library, but
 ;      there are a few major differences compared to a traditional implementa-
 &nbsp;     tion  using  the  Readline  library.   The command language used in the
&nbsp;      preference files is that of EditLine, as described in editrc(5) and not
 ;      that   used  by  the  Readline  library.   This  also  means  that  the
 &nbsp;     parse_and_bind() routines uses EditLine commands.  And  the  preference
&nbsp;      file itself is ~/.editrc instead of ~/.inputrc.

 
 &nbsp;     For  example,  the rlcompleter module, which defines a completion func-
&nbsp;      tion for the  readline  modules,  works  correctly  with  the  EditLine
&nbsp;      libraries, but needs to be initialized somewhat differently:

 
 &nbsp;            import rlcompleter
 &nbsp;            import readline
  ;            readline.parse_and_bind ("bind ^I rl_complete")

 
&nbsp;      For vi mode, one needs:

&nbsp;
&nbsp;             readline.parse_and_bind(&quot;bind -v")

 

--------------------------------------------------------------------------

Edward Moy

Apple Computer, Inc.

emoyapple.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">emoyapple.com


 

 
Re: readline support for OS X Leopard
user name
2007-10-22 13:55:02
Interesting.

FWIW I just built IPython against the system python (with
libedit,  
apparently) and it works fine; I have readline-like command 

navigation, history support, etc.

I was not aware of any change from using readline (which is
what I  
used with 10.4.x)


On Oct 22, 2007, at 12:35 PM, Noah Gift wrote:

> Edward,
>
> Thanks for the information.  Do you know of a way to
get IPython to  
> use edline instead?  IPython is growing in popularity
for Python  
> programmers, and it seems like getting a way forward
that works with  
> edline makes sense, or maybe I am wrong and people will
need to just  
> manually install readline themselves.
>
> Noah
>
> On 10/22/07, Edward Moy <emoyapple.com> wrote:
> On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:
>
>> I have been getting ready for the official leopard
release in a few  
>> days, and have been a bit worried about readline
support.  I forgot  
>> what I did to get it to work for IPython, which I
absolutely cannot  
>> live without anymore.  Is there a plan for a
Leopard binary that  
>> fixes readline, or can I help someone prepare some
documentation on  
>> getting readline working properly.  I don't have a
lot of time  
>> during the next couple of weeks to get into compile
hell, but if  
>> someone has any easy fix to get readline to work, I
would greatly  
>> appreciate it.
>
>
> The installed version of python on Leopard will
actually have  
> readline support turned on by default, but it uses the
EditLine  
> (libedit) library, not the GNU Readline (due to
licensing reasons).   
> While functionally equivalent, the command syntax is
different.   
> From the python(1) man page:
>
>
> INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
>        The Python inteterpreter supports editing of the
current  
> input line and
>        history substitution, similar to facilities
found in the Korn  
> shell and
>        the  GNU  Bash shell.  However, rather than
being implemented  
> using the
>        GNU Readline library, this Python interpreter 
uses  the   
> BSD  EditLine
>        library editline(3) with a GNU Readline
emulation layer.
>
>
>        The  readline  module  provides the access to
the EditLine  
> library, but
>        there are a few major differences compared to a
traditional  
> implementa-
>        tion  using  the  Readline  library.   The
command language  
> used in the
>        preference files is that of EditLine, as
described in  
> editrc(5) and not
>        that   used  by  the  Readline  library.   This 
also  means   
> that  the
>        parse_and_bind() routines uses EditLine
commands.  And  the   
> preference
>        file itself is ~/.editrc instead of ~/.inputrc.
>
>
>        For  example,  the rlcompleter module, which
defines a  
> completion func-
>        tion for the  readline  modules,  works 
correctly  with   
> the  EditLine
>        libraries, but needs to be initialized somewhat
differently:
>
>
>               import rlcompleter
>               import readline
>               readline.parse_and_bind ("bind ^I
rl_complete")
>
>
>        For vi mode, one needs:
>
>
>               readline.parse_and_bind("bind
-v")
>
>
>
------------------------------------------------------------
--------------
> Edward Moy
> Apple Computer, Inc.
> emoyapple.com
>
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: readline support for OS X Leopard
user name
2007-10-22 14:02:17
We did fix a few bugs related to IPython and Leopard's python, so to some degree, it does work (sorry, I don't use IPython myself).  There was a problem with IPython explicitly loading ~/.inputrc when readline support is available, which will fail due to the command syntax problem.  Just guessing, but converting the .inputrc to EditLine syntax *should* probably fix that problem.

Ed

On Oct 22, 2007, at 11:35 AM, Noah Gift wrote:

Edward,

Thanks for the information.  Do you know of a way to get IPython to use edline instead?  IPython is growing in popularity for Python programmers, and it seems like getting a way forward that works with edline makes sense, or maybe I am wrong and people will need to just manually install readline themselves.

Noah

On 10/22/07, Edward Moy < emoyapple.com">emoyapple.com> wrote:
On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:

I have been getting ready for the official leopard release in a few days, and have been a bit worried about readline support.&nbsp; I forgot what I did to get it to work for IPython, which I absolutely cannot live without anymore.&nbsp; Is there a plan for a Leopard binary that fixes readline, or can I help someone prepare some documentation on getting readline working properly.&nbsp; I don't have a lot of time during the next couple of weeks to get into compile hell, but if someone has any easy fix to get readline to work, I would greatly appreciate it.

 
The installed version of python on Leopard will actually have readline support turned on by default, but it uses the EditLine (libedit) library, not the GNU Readline (due to licensing reasons).  While functionally equivalent, the command syntax is different.  From the python(1) man page:

 
INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
 &nbsp;     The Python inteterpreter supports editing of the current input line and
 ;      history substitution, similar to facilities found in the Korn shell and
 &nbsp;     the  GNU  Bash shell.  However, rather than being implemented using the
 ;      GNU Readline library, this Python interpreter  uses  the  BSD  EditLine
 ;      library editline(3) with a GNU Readline emulation layer.

 
 &nbsp;     The  readline  module  provides the access to the EditLine library, but
 ;      there are a few major differences compared to a traditional implementa-
 &nbsp;     tion  using  the  Readline  library.   The command language used in the
 &nbsp;     preference files is that of EditLine, as described in editrc(5) and not
 ;      that   used  by  the  Readline  library.   This  also  means  that  the
 &nbsp;     parse_and_bind() routines uses EditLine commands.  And  the  preference
 &nbsp;     file itself is ~/.editrc instead of ~/.inputrc.

 
 &nbsp;     For  example,  the rlcompleter module, which defines a completion func-
&nbsp;      tion for the  readline  modules,  works  correctly  with  the  EditLine
 &nbsp;     libraries, but needs to be initialized somewhat differently:

 
 &nbsp;            import rlcompleter
 &nbsp;            import readline
  ;            readline.parse_and_bind ("bind ^I rl_complete")

 ;
 &nbsp;     For vi mode, one needs:

&nbsp;
&nbsp;             readline.parse_and_bind("bind -v")

&nbsp;
--------------------------------------------------------------------------
Edward Moy
Apple Computer, Inc.
emoyapple.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">emoyapple.com

 

 

Re: readline support for OS X Leopard
user name
2007-10-22 20:45:47
I am forwarding this to the ipython-dev list.  A number of
the core
ipython dev's use OS X, so we will surely jump on this one
as soon as
we get our hands on Leopard.  This (libedit support) is
great news as
it has been one of the main problems with the built-in
Python on OS X
for a long time.

Cheers,

Brian

On 10/22/07, Noah Gift <noah.giftgmail.com> wrote:
> Edward,
>
> Thanks for the information.  Do you know of a way to
get IPython to use
> edline instead?  IPython is growing in popularity for
Python programmers,
> and it seems like getting a way forward that works with
edline makes sense,
> or maybe I am wrong and people will need to just
manually install readline
> themselves.
>
> Noah
>
>
> On 10/22/07, Edward Moy <emoyapple.com> wrote:
> >
> >
> >
> > On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:
> >
> > I have been getting ready for the official leopard
release in a few days,
> and have been a bit worried about readline support.  I
forgot what I did to
> get it to work for IPython, which I absolutely cannot
live without anymore.
> Is there a plan for a Leopard binary that fixes
readline, or can I help
> someone prepare some documentation on getting readline
working properly.  I
> don't have a lot of time during the next couple of
weeks to get into compile
> hell, but if someone has any easy fix to get readline
to work, I would
> greatly appreciate it.
> >
> > The installed version of python on Leopard will
actually have readline
> support turned on by default, but it uses the EditLine
(libedit) library,
> not the GNU Readline (due to licensing reasons).  While
functionally
> equivalent, the command syntax is different.  From the
python(1) man page:
> >
> >
> >
> > INTERACTIVE INPUT EDITING AND HISTORY
SUBSTITUTION
> >        The Python inteterpreter supports editing
of the current input line
> and
> >        history substitution, similar to facilities
found in the Korn shell
> and
> >        the  GNU  Bash shell.  However, rather than
being implemented using
> the
> >        GNU Readline library, this Python
interpreter  uses  the  BSD
> EditLine
> >        library editline(3) with a GNU Readline
emulation layer.
> >
> >
> >        The  readline  module  provides the access
to the EditLine library,
> but
> >        there are a few major differences compared
to a traditional
> implementa-
> >        tion  using  the  Readline  library.   The
command language used in
> the
> >        preference files is that of EditLine, as
described in editrc(5) and
> not
> >        that   used  by  the  Readline  library.  
This  also  means  that
> the
> >        parse_and_bind() routines uses EditLine
commands.  And  the
> preference
> >        file itself is ~/.editrc instead of
~/.inputrc.
> >
> >
> >        For  example,  the rlcompleter module,
which defines a completion
> func-
> >        tion for the  readline  modules,  works 
correctly  with  the
> EditLine
> >        libraries, but needs to be initialized
somewhat differently:
> >
> >
> >               import rlcompleter
> >               import readline
> >               readline.parse_and_bind ("bind
^I rl_complete")
> >
> >
> >        For vi mode, one needs:
> >
> >
> >               readline.parse_and_bind("bind
-v")
> >
> >
> >
> >
> >
> >
>
------------------------------------------------------------
--------------
> >
> > Edward Moy
> >
> > Apple Computer, Inc.
> >
> > emoyapple.com
> >
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIGpython.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: readline support for OS X Leopard
user name
2007-10-22 20:55:42
Brian,

Thanks, I was just considering doing this myself.&nbsp; I would be happy to help document this if there is a suitable wiki for it, once a clear path gets figured out.  If you do google searches for readline os x, or ipython, etc, you will tons, of people who have had this problem for quite some time. ; Getting clear documentation for OS X users will help the IPython cause greatly.

I know in the book Jeremy Jones and I are writing, we covering IPython quite a bit, as we think it is the preferred tool for sysadmins to write code in.  This is slightly off topic, but the doctest inclusion is the icing on the cake as far as I am concerned with IPython.

Noah

On 10/22/07, Brian Granger < ellisonbg.netgmail.com">ellisonbg.netgmail.com> wrote:
I am forwarding this to the ipython-dev list. ; A number of the core
ipython dev's use OS X, so we will surely jump on this one as soon as
we get our hands on Leopard.&nbsp; This (libedit support) is great news as
it has been one of the main problems with the built-in Python on OS X
for a long time.

Cheers,

Brian

On 10/22/07, Noah Gift < noah.giftgmail.com">noah.giftgmail.com> wrote:
&gt; Edward,
&gt;
> Thanks for the information. &nbsp;Do you know of a way to get IPython to use
> edline instead?&nbsp; IPython is growing in popularity for Python programmers,
> and it seems like getting a way forward that works with edline makes sense,
&gt; or maybe I am wrong and people will need to just manually install readline
&gt; themselves.
>
> Noah
>
>
> On 10/22/07, Edward Moy < emoyapple.com">emoyapple.com > wrote:
>; >
> >
> >
> > On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:
>; >
> > I have been getting ready for the official leopard release in a few days,
> and have been a bit worried about readline support.&nbsp; I forgot what I did to
> get it to work for IPython, which I absolutely cannot live without anymore.
&gt; Is there a plan for a Leopard binary that fixes readline, or can I help
> someone prepare some documentation on getting readline working properly.&nbsp; I
> don't have a lot of time during the next couple of weeks to get into compile
&gt; hell, but if someone has any easy fix to get readline to work, I would
> greatly appreciate it.
> >
> > The installed version of python on Leopard will actually have readline
> support turned on by default, but it uses the EditLine (libedit) library,
&gt; not the GNU Readline (due to licensing reasons).&nbsp; While functionally
> equivalent, the command syntax is different.  ;From the python(1) man page:
&gt; >
> >
> >
> > INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
> >   ; &nbsp; &nbsp; The Python inteterpreter supports editing of the current input line
> and
> >   ; &nbsp; &nbsp; history substitution, similar to facilities found in the Korn shell
&gt; and
> >   ; &nbsp; &nbsp; the &nbsp;GNU  Bash shell.&nbsp; However, rather than being implemented using
> the
> >   ; &nbsp; &nbsp; GNU Readline library, this Python interpreter &nbsp;uses ; the&nbsp; BSD
> EditLine
&gt; >   ; &nbsp; &nbsp; library editline(3) with a GNU Readline emulation layer.
&gt; >
> >
> >   ; &nbsp; &nbsp; The &nbsp;readline&nbsp; module ; provides the access to the EditLine library,
&gt; but
> >   ; &nbsp; &nbsp; there are a few major differences compared to a traditional
> implementa-
> >   ; &nbsp; &nbsp; tion &nbsp;using&nbsp; the &nbsp;Readline&nbsp; library.&nbsp;  The command language used in
> the
> >   ; &nbsp; &nbsp; preference files is that of EditLine, as described in editrc(5) and
> not
> >   ; &nbsp; &nbsp; that &nbsp; used  by&nbsp; the &nbsp;Readline&nbsp; library.&nbsp;  This  also&nbsp; means  that
> the
> >   ; &nbsp; &nbsp; parse_and_bind() routines uses EditLine commands.&nbsp; And &nbsp;the
>; preference
> >   ; &nbsp; &nbsp; file itself is ~/.editrc instead of ~/.inputrc.
> >
> >
> >   ; &nbsp; &nbsp; For &nbsp;example,&nbsp; the rlcompleter module, which defines a completion
> func-
>  ; &nbsp; &nbsp; tion for the &nbsp;readline &nbsp;modules,  ;works ; correctly  with&nbsp; the
> EditLine
&gt; >   ; &nbsp; &nbsp; libraries, but needs to be initialized somewhat differently:
> >
> >
>; >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; import rlcompleter
> >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; import readline
&gt; >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; readline.parse_and_bind ("bind ^I rl_complete")
&gt; >
> >
> >   ; &nbsp; &nbsp; For vi mode, one needs:
&gt; >
> >
> >   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; readline.parse_and_bind("bind -v")
> >
> >
> >
> >
> >
> >
> --------------------------------------------------------------------------
> >
> > Edward Moy
> >
> > Apple Computer, Inc.
> >
> > emoyapple.com">emoyapple.com
> >
>
>
> _______________________________________________
> Pythonmac-SIG maillist&nbsp; -  ; Pythonmac-SIGpython.org">Pythonmac-SIGpython.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>;

[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )