[ANN] ErlPort (library to connect Erlang to Python) 1.0.0alphareleased


Dmitry Vasilev

Hi all,

I've just released ErlPort version 1.0.0alpha. ErlPort is a library for
Erlang which helps connect Erlang to a number of other programming
languages (currently supported Python and Ruby). Apart from using
ErlPort as a tool to call Python/Ruby functions from Erlang it also can
be used as a middleware for Python/Ruby instances.

Check http://erlport.org for more details.

The new version of ErlPort is basically a complete redesign and rewrite
of the project. The main changes in this version are:

- Redesigned as Erlang application
- Added support for all recent (2.5 and higher) versions of Python
- Added support for all recent (1.8.6 and higher) versions of Ruby
- Added support for custom data types

Why ErlPort can be interesting for Python developers?

Apart from calling Python functions from Erlang or Erlang function from
Python, ErlPort also allows to use Erlang as a middleware for Python.
The following is a small inter-process recursion example (place it in
roll.py file). Actually this example will be even simpler with ErlPort

from os import getpid

from erlport.erlterms import Atom
from erlport.erlang import call, self

def roll(n, procs=None):
if procs is None:
procs = []
print "Hello from %s" % getpid()
if n > 1:
status, pid = call(Atom("python"), Atom("start"), [])
if status == "ok":
procs = call(Atom("python"), Atom("call"),
[pid, Atom("roll"), Atom("roll"), [n - 1, procs]])
return procs

And it can be used with Erlang shell and ErlPort like this:

1> {ok, P} = python:start().
2> python:call(P, roll, roll, [5]).
Hello from 7747
Hello from 7749
Hello from 7751
Hello from 7753
Hello from 7755


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question