Let me preface this rant by saying that I've been happily using JetBrains PyCharm for a few months, and it's certainly one of the best Python IDEs out there. The price is ridiculously low and if you're serious about Python, buying PyCharm is one of the best investments you can make. It can be used for free for 30 days, so you really should give it a shot.
This said, if you happen to work with Jython 2.2, you'll probably want to use something else. The claim that Jython is fully supported as a runtime, while literally true,
Let's say you work on Windows, and you have your Jython installed under C:\jython-2.2 (yes, it's damn old, but it's still the most widely-deployed release out there -- just ask IBM and Oracle).
You create a new project in PyCharm, then go to Settings -> Python interpreter, remove the preconfigured CPython runtime, then click on Add and point to your
Still, PyCharm should be smart enough to parse arbitrary .py files in specific directories, right? So let's click on Add... to point to
Now let's create a .py file, "from pprint import pprint", the module is recognised; "Run" the script, output is correct, life is good: Jython is indeed supported as a Python runtime.
Ok, let's do some file I/O, "import os"... uh, os is not recognised as a valid module. Same for sys. Apparently, they are somewhat special in Jython and are implemented directly into the main jar, so PyCharm can't see them for autocompletion or any other smart feature. I don't know what else is "special" in Jython 2.2, but I'd rather not have to find out.
Which brings us to the main shortcoming of PyCharm as a Jython IDE: it simply won't recognise or parse any Java jar. This is somewhat surprising, considering how the program is basically a spin-off of IntelliJ IDEA, a Java IDE, and is completely built on Java. In fact, it shares the codebase with the Python Plugin for IDEA. One would think PyCharm would be ideally suited to the task of handling the "Python on Java" mesh that is Jython, but alas that's not the case. A quick search on the IntelliJ forum brings up recent posts stating that full Jython support for autocompletion is simply not on the cards; Jython is supported as a runtime and nothing more. In fact, the Python plugin for IDEA
This state of things is a bit saddening. I don't know if this is a way for JetBrains to avoid cannibalizing its main cash-cow (IDEA), or simply a commercial oversight; the fact is that we have a product, ideally positioned to completely own a niche, which simply refuses to do so and actually delivers a second-rate experience. I hope JetBrains will re-evaluate their stance at some point, because it's a bit of a shame really.
I love your wrap-ups, but this is missing the part where you try PyDev for Jython development and fall in love with Eclipse again.
ReplyDeleteAre you stalking me on G+ ? I actually just posted something about that... I wouldn't say I "fell in love again", but certainly the Eclipse/PyDev combo seems to have the most complete feature matrix when it comes to Jython.
ReplyDeleteNo stalking - well, not on G+ anyway. It just occurred to me that you could have tried PyDev while reading your latest tweets about the unexpected lack of Jython support in PyCharm.
ReplyDeleteFor the record, I actually tried NetBeans before going back to Eclipse. From my G+ feed:
ReplyDelete"Netbeans supports Jython!".
Installed NB, New Project, no sign of Python or Jython. Looked under Plugins, no sign of Python or Jython. Back to Google, found experimental plugin repository, configured, Python plugin appears! Installed, restarted NB, New Project -> Python, set runtime to jython, import sys, sys-dot-ctrl-space -> No suggestion. Window -> Python console, error. Changed Jython version, different error.
Uninstalled NetBeans.
I appreciated NetBeans for GUI (i.e. Swing) programming - but that's because when I tried the standard tools available in Eclipse I couldn't get my head around some weird behaviour, e.g. adding an initially empty table to a panel shows nothing on the panel instead of some kind of predefined rectangular area representing the table - and I heard folks able to do Ruby programming on it, but as a general rule I try to stay as far away as I can, because I just don't like the way it works. To each his own, I guess.
ReplyDeleteI've replied to this on the PyCharm blog:
ReplyDeletehttp://blog.jetbrains.com/pycharm/2012/01/the-story-behind-jython-support-in-pycharm/
re the follow-up on the PyCharm blog, they may have the edge against PyDev on Jython version: if you read the PyDev blog, it seems that for various reasons (some better than others) the Eclipse plugin will stay with 2.2 for quite a while...
ReplyDeleteSome interesting update about Jython: http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
ReplyDelete