Thursday, October 27, 2011

PyDev & Cython

The current PyDev nightly build has integrated Cython support :)

Instructions to get the nightly are available at: http://pydev.org/download.html

This is something I wanted to do quite some time already but hadn't found a good way to support Cython (mostly because the grammar support seems to be undocumented and all manually done).

So, I gave up for now on a full blown Cython parser and settled on parsing what needs to shown in the outline: classes, functions and Cython specifics: cdefs and ctypedefs -- without actually trying to do anything fancy with it (mostly showing things in the outline). It's still missing the actual scoping of things, so, items will appear flat in the outline -- but that should be fixed soon.

So, this means that code-analysis will gather much less things (right now I think it'll only gather mixed indentation analysis and duplication of function/classes).

As for the code-completion, it should be working for things that are context insensitive (i.e.: builtins, templates and global tokens for the auto-import). Some more testing needs to be done for the context-sensitive code-completion (not sure how much more can be done without a full blown parser behind it).

Aside from those shortcomings, most editor features should be working (anyone interested, please test it and let me know if there's something missing -- although I've used Cython on a few occasions, I'm hardly an expert in the area, so, feedback is much appreciated -- this should appear in a final release in a short time).

Note that to use the Cython editor, just open any .pyx file with the regular PyDev editor and things should work properly (it uses the regular PyDev editor, just customizing the parsing process).

4 comments:

Anonymous said...

Many thanks, I was looking for this for long time. My usual work flow was to use Emacs for editing cython code, but hopefully now I can do it all inside PyDev.

Cheers

MrFooz said...

Is there a way to make it work for .pxd files too? Adding it to the python content type list didn't seem to help.

MrFooz said...

Is there a way to make it work for .pxd files too? Adding it to the python content type list didn't seem to help.

Fabio Zadrozny said...

Please create a feature request for that. See: http://pydev.org/about.html for details.