Wednesday, April 15, 2015

PyDev 4.0 released. Yay!

PyDev just reached version 4.0 --- after 11+ years that's not so much, is it? ;)

The major improvement in this release is that PyDev can now unpack compound types when doing code-completion (i.e.: list(str), dict(int:str), etc).

The screenshot below shows a completion unpacking types by analyzing the current scope:



The second example shows a completion unpacking types by analyzing a docstring (see: http://pydev.org/manual_adv_type_hints.html for more details on the formats supported).



This release also enables Unicode literals and Byte literals to have different colors, so, it's easy to spot what you're working with (and it should respect the semantics of Python 2 from __future__ import unicode_literals and Python 3).

Another nice feature for those that work more in the interactive side of Python is that PyDev now allows users to define a template to send a custom command to the interactive console.

PyDev already has an F2 binding which sends a line to the console, but let's say that you do something else a lot in the console (such as plot(variable)). With this feature you can bind something as Ctrl+F2 to send the selected text as plot(${text}) to the console (the screenshot below shows how that configuration would be achieved).



Also, the PyDev update site is now hosted on http://bintray.com -- note that the update site urls didn't change, so, this change should (hopefully) be imperceptible to end-users...

There are also other nice things (see http://pydev.org for more details).

To finish, a special thanks to all the PyDev supporters (it definitely wouldn't be possible without your help -- for those that want to help supporting it, please access the related links at http://pydev.org).




7 comments:

ëRiC said...

Hi! Thanks for posting something about the results of the type hinting. It seems to be a frustrating phantom issue. On the original docs page of pydev there is nothing about how things should look like or what you are supposed to get from what.

But also your examples don't really seem to clear things up. Aren't the popups at these 2 types the same? They show the members. Where is there something about the expected type? :(

Fabio Zadrozny said...

The thing from the screenshots is that you can see that PyDev is properly resolving the 'Robot' class (as it's showing its 'random_walk()' method) when a code-completion is asked for.

The main points in the type-inference are getting proper code-completion tips (Ctrl+Space) and go to definition (F3)

Fabio Zadrozny said...

As a note, the structure on how to add type hints is at:

http://pydev.org/manual_adv_type_hints.html

So, if you get a proper code-completion after adding the type-hints, things should be right :)

ëRiC said...

AAAaahhhh!! Now I get it! :D haha yea of course!! Damn. the member showing was so omnipresent, I already forgot what I have there! Nice!

Ok. Now I also know how to better explain what I was looking for: I wanted something to guide the user what types to put into arguments. So in the docstring markup you put info for the types to put into. When I then type:

funcname(argx=

I thought there would be something like 'put a string here' or a highlight when it detects that I put a float instead... for instance.

ëRiC said...

Fabio thanks again for pointing that out! :)

Fabio Zadrozny said...

Actually, if you have something as:

class.method(|) (cursor at |) it'll fill the parameters automatically if it can infer the method, but the type for the parameter isn't really shown (please create a feature request for that).

ëRiC said...

Yea that's what I got already! I created a huge pypredef file for a compiled python extension and got all the type nfo for the arguments as well and though I could make any use of that as well. But the arguments themselves DO show up of course :D
seems just that after class.method(argname=|) (cursor at |) anything that's in globals() and locals() is offered.