Is there a way to create Eclipse plugins with Python? - python

As far as I understand Eclipse doesn't provide user with python bindings by default. Nor any projects of such kind was I able to find with google.
Are there any third-party plugins for that? Any tutorial? May be with Jython?..

As far as I know, you need to use Java. Eclipse is written in Java, and even the vanilla application is made up of several Java components glued together by the core plugin loader. Jython might work if:
you can cross-compile Python to Java bytecode (indeed you can, thanks to sayth for pointing that out), and
you can access the Eclipse APIs inside Jython.
So, here's more or less what your plugin's architecture might look like. If you can get at the Eclipse APIs, then you can write most of it in Jython, and then make a Java wrapper for it with the Embedding Jython instructions.
If you can't get the Eclipse functionality into your Jython, then you can still write some of your code in python, and then have the Eclipse API access happening on your Java layer. This will be annoying in proportion to how evenly split your code is between python and Java. I've worked on a project before where we embedded python into C++ (or it might have been the other way around...), and it's a major headache if you don't plan it out right.

Related

Which IronPython editor I can use to develop scripts for Tibco Spotfire controls

Can we use any IRONPython editor to develop scripts for Tibco Spotfire controls.
Can we use IDLE editor to develop IRONPython scripts for Tibco Spotfire? If yes then how to integrate the tibco module with IDLE editor, Can anyone help on this??
You should be able to use any development tool (ide) which supports ironpython. One of the best in my point of view is PTVS (Python Tools for Visual Studio), just search for it. But when you want some thing very lightweight with only some syntax hilighting, i prefer using Visual Studio Code or Atom. But PTVS has a lot of nice features. One of the most important ones are those for debugging, because they prevent you from using some console printing or some thing similar as debugging tool. Just take a look at it.
EDIT
As far as i can see, it should work just fines with PTVS. Taking a look at this, is't just some API as any other api: API-Doc
Spotfre has its own IDE for developing scripts but it is very poor one when analysing its functionalities. I dont think you can use any IDE to debug the scripts but you can at least use the one suggested by BendEg to make creation of the code more 'pleasant'.
Spotfire uses IronPython, which is a .NET implementation of python. In other words, is .NET driven by python. To test simple python functions, you can use CodeSkulptor, a cloud based python interpreter. For IronPython, you can use this java based online version but again, this is to test simple scripts

Why are Ruby and Python more suited for programming outside an IDE than Groovy?

This is mainly in reference to this answer in "Python vs Groovy vs Ruby?"
What makes Python and Ruby easier to develop outside an IDE?
The link also mentions debugging in the console. What is meant by that exactly?
Python and Ruby are easier to develop outside of an IDE than most of the JVM languages in general because they require less "overhead." I will speak primarily about Python, because that's my primary language.
In general, a Python installation has a single source for libraries (unless you're using virtualenv), and the whole project lives on the filesystem. There is no need to worry about .jar or .class files -- everything is compiled at runtime, and the .py files are your distributables.
Furthermore, Python is more concise than Java, and Groovy inherits a lot of Java's syntax (although it abstracts some things away). IDEs help to deal with boilerplate, making it less work for the programmer -- but languages without so much boilerplate don't require that help.
I disagree with the assertion that groovy is harder to develop with outside of an IDE. I've done serious python and groovy development, and a little bit of ruby, mostly without an IDE.
While there isn't a pdb style debugger, there's a console: groovysh is a non-GUI console, command line app, and groovyConsole is a GUI with simple syntax highlighting and editing. The rails and TDD philosophies emphasize development with tests rather than debuggers, and I find I rarely, if ever, feel the need to use a full-on debugger if I've got good test coverage. Whether this matters to you really depends on your own style of development.
Groovy simplifies the whole jar/classpath mess. While you can still set the classpath if you want, it's much easier to let groovy manage it entirely. Groovy automatically includes jars in $GROOVY_HOME/lib and ~/.groovy/lib in the classpath. Installing a library is simply copying it there. Better than that, with #Grab, you can declare your dependencies right at the top of your script, and groovy will automatically download the version you specify, and recursively get all of its dependencies and set up the proper classpath and classloaders; it can even manage two libraries that depend different versions of the same jar. Grails also has declarative dependencies.
The groovy language itself is just as concise and flexible as either ruby or python. While you can write it like full-blown Java, groovy can be written to look very similar to ruby.
One valid complaint against groovy vs python and ruby is that the startup time of the JVM is still noticeably worse.
Also for example Ruby on Rails includes some things that would otherwise be handled by IDEs like generators and console.

Using netbeans as IDE for Python

I am about to embark on learning Python (largely for the purposes of using it as scripting glue between my applications).
I use Netbeans (6.8) on Linux for both my C++ and PHP development work. Ideally, I would like to use the same IDE for Python - and there is a Python plugin for Netbeans (admittedly, its still in Beta).
Does anyone have any experience using Python with Netbeans?
Shall I use Netbeans (for the reasons stated above - i.e. already familiar environment), or is there a [GOOD] reason why I should use a different IDE?
Although I've not been using it for long, I was in the same situation as yourself and just decided to bite the bullet. I haven't had any issues with it so far and found he most important thing to be that you are using an environment that you are both familiar and comfortable with. Any quirks you find along the way are probably more than made up for by the shallow learning curve given by not having to get used to an entirely new IDE.
That said however, if you are only just picking the language up I can't recommend the "official" command interface, IDLE, enough as it just let's you get into the guts of the language giving instant feedback etc.
Additionally, the following SO question has a comprehensive list of Python IDE's if you find that the Python plugin for Netbeans just doesn't work for you.

Would it be possible to integrate Python or Perl with Ruby?

Would it be possible to integrate Python (and/or Perl) and Ruby? I've looked at http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/ and http://code.google.com/p/ruby-perl/ , but they both seem rather outdated.
Has someone generated a Ruby interface for Python's C API?
Edit: Python can be integrated with many other languages according to http://wiki.python.org/moin/IntegratingPythonWithOtherLanguages . However, that list doesn't include Ruby.
My school (Georgia Tech), along with Bryn Mawr and Microsoft Research, are doing a project right now called Pyjama. Basically, it uses the Microsoft DLR to allow you to freely mix Python and Ruby. I haven't tried it, but it sounds pretty cool.
Here's an example from the website. You enter the class in "Python mode". Then it gets compiled, and you run the command in "Ruby mode".
class PythonClass:
def hello(self, value):
print "Python says hello to", value
pc = python_class().new
pc.hello "Ruby"
Which produces "Python says hello to Ruby".
Integrating dynamic languages is one of the goals of the Parrot project. It's a virtual machine that dynamic language compilers target. Once compiled to the same virtual machine, you should be able to used the "object" form in any of the languages no matter the object's source.
The issue at the moment, however, is stabilizing the virtual machine and finishing off the mostly done compilers. However, that's been the state for a long time. :)
You can write extensions for Ruby in C.
So, if Python has a C API, you can write a C extension for Ruby which uses this API.
I know nothing about the Python API or how large of a piece you want to integrate with, but if it is not too big, this could (possibly) give you a way to run Python code from Ruby.
For a research project I wanted to use the fabulous matplotlib that's available for Python. I also found that library that you referred to. However, it doesn't look like something popular and well tested. So I decided to write the script that generated graphs using pure Python and called it from Ruby via popen. That worked very well for me.
It might by possible, but not very practical. It would be significantly easier to port whatever modules you need from one to the other than it would be to embed one of the interpreters within the other.
If you absolutely have to use both languages in a project, your best option would probably the combination of Jython and Jruby, or IronPython and IronRuby. I'm not sure if you could get them to talk to each other, but at the very least you could host them on the same virtual machine.
Another strategy, as used by Facebook, is to expose APIs via Thrift. You define lightweight service APIs and the RPCs are inter-process.

Are there problems developing Django on Jython?

The background
I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative frameworks.
The only decision I'm having trouble with, is whether we use Python or Jython to develop our application. Now I'm pretty familiar with Java and could possibly benefit from the libraries within the JDK. I know minimal Python, but am using this project as an opportunity to learn a new language - so the majority of work will be written in Python.
The attractiveness of Jython is of course the JVM. The number of python/django enabled web-hosts is extremely minimal - whereas I'm assuming I could drop a jython/django application on a huge variety of hosts. This isn't a massive design decision, but still one I think needs to be decided. I'd really prefer jython over python for the jvm accessibility alone.
Questions
Does Jython have many limitations compared to regular python? Will running django on jython cause problems? How quick is the Jython team to release updates alongside Python? Will Django work as advertised on Jython (with very minimal pre-configuration)?
Decision
Thanks for the helpful comments. What I think I'm going to do is develop in Jython for the JVM support - but to try to only use Python code/libraries. Portability isn't a major concern so if I need a library in the JDK (not readily available in python), I'll use it. As long as Django is fully supported, I'm happy.
Django does work on Jython, although you'll need to use the development release of Jython, since technically Jython 2.5 is still in beta. However, Django 1.0 and up should work unmodified.
So as to whether you should use the regular Python implementation or Jython, I'd say it's a matter of whether you prefer having all the Java libraries available or all of the Python libraries. At this point you can expect almost everything in the Python standard library to work with Jython, but there are still plenty of third-party packages which will not work, especially C extension modules. I'd personally recommend going with regular Python, but if you've got a ton of JVM experience and want to stick with what you know, then I can respect that.
As for finding Python hosting, this page might be helpful.
I'd say that if you like Django, you'll also like Python. Don't make the (far too common) mistake of mixing past language's experience while you learn a new one. Only after mastering Python, you'll have the experience to judge if a hybrid language is better than either one.
It's true that very few cheap hostings offer Django preinstalled; but it's quite probable that that will change, given that it's the most similar environment to Google's app engine. (and most GAE projects can be made to run on Django)
I have recently started working on an open source desktop project in my spare time. So this may not apply. I came to the same the question. I decided that I should write as much of the code as possible in python (and Django) and target all the platforms CPython, Jython, and IronPython.
Then, I decided that I would write plugins that would interface with libraries on different implementations (for example, different GUI libraries).
Why? I decided early on that longevity of my code may depend on targeting not only CPython but also virtual machines. For today's purposes CPython is the way to go because of speed, but who knows about tomorrow. If you code is flexible enough, you may not have to decide on targeting one.
The downside to this approach is that you will have more code to create and maintain.
Django is supposed to be jython-compatible sinc version 1.0.
This tutorial is a bit outdated, but from there you can see there are no special issues.

Categories

Resources