Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #977

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

Date 2013-06-11 15:10 +0200
From Dmitry Vasilev <dima@hlabs.org>
Subject [ANN] ErlPort (library to connect Erlang to Python) 1.0.0alpha released
Newsgroups comp.lang.python.announce
Message-ID <mailman.3260.1371195537.3114.python-announce-list@python.org> (permalink)

Show all headers | View raw


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 
1.0.0.

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 = []
     procs.append(self())
     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().
{ok,<0.34.0>}
2> python:call(P, roll, roll, [5]).
Hello from 7747
Hello from 7749
Hello from 7751
Hello from 7753
Hello from 7755
[<0.34.0>,<0.37.0>,<0.40.0>,<0.43.0>,<0.46.0>]

-- 
Dmitry Vasiliev <dima at hlabs.org>
http://hlabs.org
http://twitter.com/hdima

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

[ANN] ErlPort (library to connect Erlang to Python) 1.0.0alpha released Dmitry Vasilev <dima@hlabs.org> - 2013-06-11 15:10 +0200

csiph-web