[IPython-dev] IPython on Python 3

Fernando Perez fperez.net at gmail.com
Mon Sep 6 19:57:15 EDT 2010


Hi Thomas,

On Mon, Sep 6, 2010 at 6:07 AM, Thomas Kluyver <takowl at gmail.com> wrote:
> Hi all,
>
> I know running IPython on Python 3 has been discussed before, and that doing
> a proper port might take a long time. However, I was messing about with
> Python 3, and found IPython was the thing I missed most, so I thought I'd
> investigate how difficult it was to get it running.
>
> Using 2to3, and tweaking the result a bit (mostly for the new Unicode
> strings), I have a version that works, at least for basic use on my
> computers:
> http://github.com/takowl/ipython
>
> Basic use includes starting it up, running commands, docstrings ("object?"),
> tab completion (see below) and history. I don't claim that the codebase is
> neat: I've done a largely automatic conversion, without attempting to
> understand how it all fits together.
>
> One specific issue I'd like some advice on: tab completion currently doesn't
> work in the main namespace, before any dots. So mystring.isdig<tab> works,
> but prin<tab> doesn't do anything. Filenames within strings don't
> tab-complete either. I've tried to investigate, but I guess the code
> silences any errors, and I don't really know where to start looking. I
> imagine it's the Unicode question again.
>
> Naturally, anyone is welcome to use it or improve it.

First, many, many thanks for this!

Now that with zeromq we have a way forward for our entire codebase on
py3k, it's really time to start thinking about it.  It may be a while
until we completely shed the bulk of the py2-only code, but we should
be able to move with partial functionality forward.

I see you worked off trunk, which is great.  We have a fair amount of
new code in a separate branch that we're waiting to stabilize before
we merge it in, it's here:

http://github.com/ipython/ipython/tree/newkernel

It should be no more than a couple of weeks before we merge it in,
I'll leave it up to you to decide if you want to track that or just
wait for us.

The tab completion issues you mention are indeed tricky to debug, but
I'd suggest if you want to go there, that you do work off the
newkernel branch, since we've cleaned things up quite a bit in the
completion code.  I just don't want you having to redo any bug fixing
you may do now, manually again later after we merge.

For debugging the completion mechanism, see this comment/flag (which I
added just yesterday :) :

http://github.com/ipython/ipython/blob/newkernel/IPython/core/completer.py#L819

Once newkernel is merged, we can do a branch comparison between it and
your code, and start looking at integrating as much as possible
straight in.

Having an easier path to 3.x is one of the reasons why we went for 2.6
as a minimum requirement for trunk, and in all new code we're using
print() as a function as well as trying to keep 3.x in mind all the
time.

And if you want/can play with pyzmq to produce 3.x bindings and run
the new PyQt code on 3.x, I won't stop you :)

Regards,

f



More information about the IPython-dev mailing list