Question

I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.

An obvious way to do this is via something like XML-RPC or maybe CORBA but I would be interested in any other approaches.

What have other people done to get code from Python and Ruby communicating with one another, either locally on the same system or remotely accross a network?

Thanks in advance.

Was it helpful?

Solution

Well, you could try named pipes or something similar but I really think that XML-RPC would be the most headache-free way.

OTHER TIPS

Please be advised that I don't speak from personal experience here, but I imagine JRuby and Jython (The ruby and python implementations in the JVM) would be able to to easily talk to each other, as well as Java code. You may want to look into that.

This isn't what your after, but worth a read: embed Python interpreter in Ruby: this code's pretty old

http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/index.html

OR: why, rewriting bytecodes

http://github.com/why/unholy/tree/master

Using JRuby/Jython for Ruby/Python interoperability? has more information. Of note: JRuby and Jython don't have object compatibility, but IronPython and IronRuby do.

Expose your Ruby classes as web services using Sinatra, Rails, or, plain old Rack.

Expose your Python classes as web services using web.py, flask, Django, or App Engine.

Use HTTParty for Ruby to build an API into your Python classes.

Use a Python REST library to build an API into your Ruby classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top