Skip to main content

Leverages the existing Term package to implement a simple Erlang port driver that communicates over standard input and output.

Project description

ERPY

This library wraps around the Python version of the Term library to provide a simple mechanism for communicating between an Erlang process and a Python process.

Installation

As always, use pip, preferably within a virtual environment.

pip install erpy

Usage

Encoding and Decoding Erlang Terms

Use the term library. Their documentation is here, and the python version of their library is bundled with this library. If you want to get the Rust one working with PyPi, I'm sure that they would apprecate it :).

Basic Communication over STDIO

Sending Messages From Python

from erpy import stdio_port_connection

inbox, port = stdio_port_connection()
for i in range(100):
    port.send(i)

Receiving Messages In Python

from erpy import stdio_port_connection
from term import Atom

inbox, port = stdio_port_connection()

for msg in inbox:
    if msg == Atom("close"):
        break
    
    with open("output.txt", "a") as f:
        print(f"got {msg}", file=f)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

erpy-0.1.1.tar.gz (23.6 kB view hashes)

Uploaded Source

Built Distribution

erpy-0.1.1-py3-none-any.whl (21.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page