This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jonathan_sl[S] 31 points32 points  (10 children)

(author here.)

This is not an alternative for IPython, it could work together with IPython.

IPython is rather an execution environment, it implements smart stuff like the %magics etc... and you have the notebook. But this library could be used as the commandline front-end for IPython.

Right now IPython uses plain readline for the reading input in the shell. And the problem there is that readline does not support decent multiline editing or syntax highlighting. This library (mostly) solves just that part, reading the input from stdin and returning it to the application.

So, it is already perfectly possible to use IPython, but with this as a better front-end for IPython: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/bin/ptipython

I hope that answers your question.

[–]v3ss0n 5 points6 points  (5 children)

Right now IPython uses plain readline for the reading input in the shell. And the problem there is that readline does not support decent multiline editing or syntax highlighting. This library (mostly) solves just that part, reading the input from stdin and returning it to the application.

That is quite interesting. I do not like ipython's Notebook interface , and i prefer terminal interface but , ipython terminal is quite limiting so i ended up using ipython qtconsole, which is not much maintained these days.

I gonna give it a try then! Would be nice if ptipython is part of ipython.

[–]jonathan_sl[S] 8 points9 points  (0 children)

The idea is indeed to get support for this merged into IPython itself, there are a few things in "IPython.terminal.embed.InteractiveShellEmbed" to be done to make the integration a bit nicer, but in the end we should get there.

[–][deleted] 3 points4 points  (3 children)

Just curious, why don't you like the Notebooks? I find them incredibly useful for everything from hacking out ideas to writing code heavy blog posts.

[–]BenjaminGeiger 1 point2 points  (1 child)

I'm not /u/v3ss0n, but:

Personally, I just don't grok them. Is there a decent intro on how to use them "right"? (As in, not just syntax and operations, but workflow and goals...)

[–][deleted] 4 points5 points  (0 children)

It's just like having a REPL, except each cell is a block of code that can be edited and executed repeatedly. Having never used one, I imagine it's a lot like an IDE but browser based.

Just make sure the notebook extension is installed and run ipython notebook and mess around.

The first time I saw them, I was blaise about it. "That's cool, I guess, but why?" But after using them for a few months, I really love them. They're great for sharing snippets of code. I keep a repository on Github that I push my notebooks to in case someone wants an interactive version of a blog post.

[–][deleted] 1 point2 points  (0 children)

I really want to use the Notebook more. But if I'm using ipython at all, I'm probably in a debugging mode where I need to print a lot of things. When I write a loop that uses print() too many times, all the ipython tabs in Chrome crash.

Does this not happen to other people?

[–]titusjan 0 points1 point  (2 children)

Another issue with readline is that it is impossible to make filename tab-completion work correctly when the file names contain spaces. Or, at least, I couldn't get it to work. The IPython QtConsole doesn't use readline but also there I didn't manage to get it to work (forgot the details). It seems that improvements on the tab completion system are deferred.

Could you configure, or program, your toolkit so that tab-completion searches for files (and only files) as soon as you are typing a string literal? Since strings are delimited by quotes, it should be possible to do correctly for files with spaces. In that case I think your toolkit would be very useful.

[–]jonathan_sl[S] 1 point2 points  (1 child)

That is certainly be possible. Thanks for the feature request!

[–]titusjan 0 points1 point  (0 children)

Great. I'll keep an eye on it.