Tuesday, August 02, 2011

IPython & PyDev

IPython is a Python shell that provides many improvements over the standard Python shell (more details may be found at http://ipython.org/ ).

To use it, install IPython (0.10.x or 0.11) in your Python interpreter (if you use easy-install, just do easy_install ipython), make sure that the IPython paths are properly added in your interpreter configuration inside of PyDev ( http://pydev.org/manual_101_interpreter.html ) and start up the interactive console in PyDev ( http://pydev.org/manual_adv_interactive_console.html ). If all is properly configured, the interactive shell should use IPython as the backend (if it's not found, it'll fallback to the standard PyDev shell and warn that IPython could not be found).

Another improvement in the shell is that the output for a long running command will now be printed while it's executing, and not only after it returns.

I'm waiting for feedback to know if there's something missing in the integration before a final release is provided with the integration...

Actually, it seems you have an IPython-based shell (it's just that IPython 0.11 no longer prints a welcome as it did on 0.10, but it's being used as your backend -- is there some IPython command you're trying that's not working as it should?)

I think you're trying to configure ipython.exe. What you should do is configure python.exe (as regular following the steps at: http://pydev.org/manual_101_interpreter.html ), and start the shell and it'll automatically pick IPython (PyDev imports IPython and uses it -- the ipython executable is not used)

On linux it's not working with indigo and helios. I still have the standard pydev console but no warning at all. Do I have to remove or modify something in the "interactive console" configuration? (Actually the initial interpreter command is: mport sys; print('%s %s' % (sys.executable or sys.platform, sys.version)))

Some more feedback. I have been trying to start ipython as well but with no luck so far.

Actually I cannot get the python interpreter to be configured properly, as when I add the absolute path to the ipython executable, this one seems to be replaced with some message, and what appears in the Location field of the Python Interpreter is a long string like

/User/homedir/.ipythonInitializing from configuration: /some/path/Ipython/UserConfigSuccessful Upgrade!All files in your directory /Users/homedir/.ipythonwhich would have been overwritten by the upgrade bla bla bla...

Thanks for great iPython integration with PyDev - works a treat. The only other thing I would really like is to use iPython also in the debug console. I find it quite frustrating in particular that there is no command history with 'up arrow', as well as other iPython features. Matt

To get Ipython as standard shell do the followings: go to Window-->Preferences-->PyDev-->Interactive Console. In the Initial Interpreter Commands filed add this 2 commands: import IPython; IPython.Shell.IPShell().mainloop() Now every time you'll start your console IPython will be launched as default.

Note1: of course,you need IPython installed of your system for this to workNote2: the interpreter will still complain with something like "In [1]: PyDev console: using default backend (IPython not available)" but it is because it prints it automatically before you have the chance to import IPython.

I have ipython installed and the pydev console is running with it as the backend of the interactive console. Is there any way I can choose NOT to use ipython? It is preventing sys.last_traceback from being set such that pdb.pm and ipdb.pm both fail to return me to the last uncaught error.