Pydev adventures

Posting about venturing (and creating) the Pydev 'world', with latest reports on what is happening in Pydev Extensions and in the 'Open Source' version.

For those that don't know about it, Pydev is a plugin for editing Python within Eclipse


Thursday, March 20, 2008

Interactive console in Pydev


Last week I started working on an interactive console and bundling it into pydev. Hopefully it'll be finished soon (probably within the next 1-2 weeks).

The main structure is already in place... code-completion, context info on hover, history (up/down arrow), colors for stdout/err/prompt/user input, auto-indent, python/jython support, it's all there already... (but I want to add an extra layer of polishment before releasing it).

Under the hood, it's almost like a whole new editor covering the console, while communicating through sockets with a python shell (but it feels a lot like a regular editor, in the sense that the same options that are used in the editor for indent, code completion, etc. are also available from the console -- with the exception that you can actually only edit the active line).

Also, this time I was able to get some code that had an initial draft of a console from dltk (which was pretty nice), but I had to do some (not so minor) changes to be able to add it to pydev, although the basic structure still has the same idea (the result can be seen at org.python.pydev/src_dltk_console).

Well, to sum it up... this is a long-awaited feature, and the plans are for surpassing all expectations on that :)

Labels:

18 Comments:

Anonymous Anonymous said...

Sweet...

5:16 PM  
Blogger Deuce868 said...

How will this compare to iPython? I've often wished I could get iPython directly into pydev and set it up so that when I run %edit it just opens a new file right there in pydev for me, saving it runs it in the iPython console. Would be great to setup an initial setup in the project definition so that when I go to work on my Django project, the shell is setup with the paths and such I need for that. Then if I go to another project, the shell would update as well.

6:42 AM  
Blogger Manuel said...

deuce868's comment about iPython; Seconded!

11:33 AM  
Blogger Justin Marrington said...

You sir, are a gentleman and a scholar. I just installed and tested PyDev for a uni project, and was thinking 'hey, this is absolutely fantastic, but I wish I didn't have to have IDLE running as well for on-the-fly experimentation'

4:20 PM  
Blogger Bernd said...

Failed to read servers response: Connection refused>>> import sys
Failed to read servers response: Connection refused>>> print '%s %s' % (sys.executable or sys.platform, sys.version)
Failed to read servers response: Connection refused>>>

after that the console works but nothing was imported. A couple of newlines at the beginning of the initial import in the preferences seem to help, but the jython console doesn't work at all:

Failed to read servers response: Connection refused>>> import sys
Failed to read servers response: Connection refused>>> print '%s %s' % (sys.executable or sys.platform, sys.version)
Failed to read servers response: Connection refused>>>
Console already exited with value: 255 while waiting for an answer.
>>> print "foo"
Console already exited with value: 255 while waiting for an answer.
>>>

2:08 PM  
Blogger Fabio Zadrozny said...

This seems like you have something blocking communication with the shell... do you have some firewall enabled?

2:15 PM  
Blogger Stacia said...

Can someone tell me how to install this test version? I would love to try it out.

4:24 PM  
Blogger Fabio Zadrozny said...

It has just been released: http://pydev.blogspot.com/2008/04/pydev-1315-released-new-interactive.html

Cheers,

Fabio

5:36 PM  
Blogger Bernd said...

"This seems like you have something blocking communication with the shell... do you have some firewall enabled?"

No, I have no firewall. I suspect some kind of race condition (it behaves like random and it has something to do with time), sometimes it works with only 2 empty lines at the beginning, sometimes not and today it worked one out of two times without an empty line at the beginning. After the prompt is there the console (CPython) works perfectly, but the Jython console won't work at all.

I have Kubuntu 7.10, Eclipse 3.3.2, PyDev 1.3.15, PyDev-Extensions deactivated because of another indeterministic problem, Hardware is an old ThinkPad-T40 (Pentium-M 1500MHz, 500MB RAM).

7:00 AM  
Blogger Fabio Zadrozny said...

Can you please report that as a bug in sf?

7:03 AM  
Anonymous Anonymous said...

cannot get interactive console during debug, e.g, to check functions and variables, etc. The usual stuff a debugger has.

Yaakov

3:19 PM  
Blogger Bruce said...

I have the following error too:
>>> import sys; print '%s %s' % (sys.executable or sys.platform, sys.version)
Failed to read servers response: Connection refused>>>

I'm using a remote python debugger with my target. Is there any dependency on whether the target env is remote or local?

My host is ubunto 8.04 with eclipse 3.4 and pydev 1.3.18

Is there some diagnostic or tracing that I can turn on to help debug this?

8:38 AM  
Blogger Fabio Zadrozny said...

That specific bug should be already fixed in the latest version in the cvs.

Cheers,

Fabio

8:53 AM  
Blogger Gökhan SEVER said...

Is there any plans for IPython integration?

1:11 PM  
Blogger Fabio Zadrozny said...

There are no plans for the iPython integration... Is there some specific feature of iPython that you're missing from the interactive console?

6:55 AM  
Blogger Soren said...

The Pydev console is great and in my opinion a must-have for development so many thanks for the good work put into this. I can't make it work in debug mode however - any plans to add this in?

10:58 PM  
Blogger Fabio Zadrozny said...

There are currently no plans to add that support to the debugger. Note that pydev extensions has a simple console already (you can type statements to be evaluated, but it has no code-completion: http://fabioz.com/pydev/manual_adv_debug_console.html )

3:08 PM  
Blogger Soren said...

ok thanks, that seems to do the job. Will try it out.
Soren

9:11 PM  

Post a Comment

<< Home