[IPython-dev] Fwd: [Pythonmac-SIG] readline support for OS X Leopard

Brian Granger ellisonbg.net@gmail....
Fri Oct 26 16:51:55 CDT 2007


Boyd,

Great, I don't have Leopard yet, and it will be a few weeks before my
main system is running it.  In the meantime if you want to work on
this, I would simply start digging into the ipython source to see
where readline is used.  Fernando and Ville are probably the experts
on this....but Fernando doesn't run OS X (I'm not sure about Ville).
But maybe they could point you in the right direction for where to
start looking.  Here are some of the relevant files in the ipython
source:

http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/rlineimpl.py
http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/iplib.py
http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/completer.py

If you start searching for readline you will quickly see what needs to
be done.  I would start by looking at rlineimpl.py, which imports the
correct readline.  This is called by iplib.py, which passes the
readline module to a completer object.

Let us know if you have questions.

Brian

On 10/26/07, Boyd Waters <bwaters@nrao.edu> wrote:
> If someone can point me in the right direction I'd love to solve this
> one.
>
> The Python that ships with Leopard uses libedit, which includes a
> readline wrapper.
>
> It seems to work, but I can't get the tab-completion to work in IPython.
>
> ANSI color works fine. History navigation works fine. Command-line
> editing works fine.
>
> No tab completion.
>
> I can enter the lines one at a time at a Python console, everything
> seems to work. readline is imported. But I don't get the actual tab
> completion.
>
> Got it to work on Tiger (OS X 10.4.x) no problem.
>
>
> On Oct 22, 2007, at 7:48 PM, Brian Granger wrote:
>
> > This is a heads up for ipython devs who use OS X.  I guess the builtin
> > python on Leopard will have  a working readline module, but it won't
> > use readline underneath the hood.  Instead is will use EditLine
> > library:
> >
> > http://thrysoee.dk/editline/
> >
> > Once Leopard is out in the public, we can investigate how this will
> > play with ipython.
> >
> > Cheers,
> >
> > Brian
> >
> > ---------- Forwarded message ----------
> > From: Edward Moy <emoy@apple.com>
> > Date: Oct 22, 2007 12:19 PM
> > Subject: Re: [Pythonmac-SIG] readline support for OS X Leopard
> > To: Noah Gift <noah.gift@gmail.com>
> > Cc: PythonMac mac <pythonmac-sig@python.org>
> >
> >
> >
> > 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.
> >
> > emoy@apple.com
> >
> > _______________________________________________
> > Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> > http://mail.python.org/mailman/listinfo/pythonmac-sig
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev@scipy.org
> > http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
>


More information about the IPython-dev mailing list