[IPython-dev] filename completion - anyone working on it?

Fernando Perez fperez.net at gmail.com
Thu Nov 4 02:26:50 EDT 2010


Hi Hans,

On Mon, Nov 1, 2010 at 2:55 AM, Hans Meine <hans_meine at gmx.net> wrote:
>> Could you pull from trunk and let me know if you find the situation
>> any better?  Invoking my time machine for your question, I rewound to
>> yesterday afternoon and put more time than I'd like to admit into this
>> very problem:
>
> Aaah, I love it when you pull that trick! :-)

:)

>> Things already work as you imagine, with a custom completer for magics
>> without quotes, and a generic file completer that should work in
>> strings.  This weekend John and I actually ran into the limitations of
>> the completions-in-strings, and that prompted my effort to fix this.
>
> The strange thing is - I updated my git repo and tried it out, and it was
> certainly working to some extent (read: at least some completions I tried with
> paths containing spaces did work, so I was happy).  I planned to try it out
> more thoroughly for some days before reporting back, but right now I tried
> again (with updated git master), and it does not work at all anymore?!

I'm afraid I must run now (will try to continue tomorrow), but in the
meantime...

> Is there a good way to debug these kind of things? (completion)
> I would like to contribute test cases, but they would obviously require some
> temp. dir setup, and I don't know yet how to write good unit tests for this.

Yes, again my time machine at your service:

https://github.com/ipython/ipython/commit/ae65e73c8ec9564613aaa9acd3868b9fe15f9c63

That was added *precisely* for doing what you want (that time machine
is accurate, to boot :)

https://github.com/ipython/ipython/commit/02eecaf061408f26a3c6029886b8794f73581938

Hopefully that commit shows you the kind of code that's needed for
completions.  Debugging completion code is annoying, it typically
involves activating a bunch of print statements that you'll find in
the core/completer.py file, and likely turning on this debug flag:

https://github.com/ipython/ipython/blob/master/IPython/core/completer.py#L858

so that you can see exceptions that are otherwise silently gobbled up
by readline.

I hope this gets you started, and please don't hesitate to pester me.
Yell loud enough, I'll end up answering ;)  I'm really sorry not to be
more responsive, but 'real life' calls sometimes :)

Cheers,

f



More information about the IPython-dev mailing list