Find a file
russell@unturf.com b716f1487e
tests/test_node_otp26: portal-match TLS config + long node names + container stdout capture
Iterates on the docker-based repro infrastructure while diagnosing the
portal@unsandbox.com 'peer closed after 0/4 bytes' failure:

  - _write_ssl_config_portal_match() emits an ssl_dist.config with the
    exact options portal runs: permissive verify_fun (accepts bad_cert),
    versions [tlsv1.3, tlsv1.2], secure_renegotiate, server_name_indication
    disabled. Same shape as /opt/unsandbox/certs/inet_tls.conf.

  - Elixir docker peer now boots with --name (long FQDN, like prod)
    instead of --sname (short). Production portal is portal@unsandbox.com
    so the dist driver's routing path is different from short-name peers.

  - Elixir GenTarget now logs init + handle_call + handle_info. Fixture
    redirects container stdout to a file; test prints it on
    pass-or-fail so we can see whether the peer received our gen_call.

  - elixir image bumped to 1.16-otp-25 (portal runs OTP 25.3.2.5 / erts
    13.2.2.5, NOT OTP 26 — discovered via the portal release's bundled
    erts version).

Despite matching every dimension I can find (OTP version, TLS dist
config, Elixir GenServer wrapping, long node names), the test still
passes locally — so the production failure is something specific to
the live portal beam state, not a general protocol or version issue.
2026-06-17 09:32:17 -04:00
docs ci: classic auth via group-scoped TWINE_USERNAME/TWINE_PASSWORD, v0.1.4 2026-06-16 15:01:23 -04:00
erldistpy 0.1.7: declare DFLAG_MANDATORY_25_DIGEST + decode dist-header replies 2026-06-17 08:51:09 -04:00
tests tests/test_node_otp26: portal-match TLS config + long node names + container stdout capture 2026-06-17 09:32:17 -04:00
.gitignore phase 6: TLS dist via inet_tls_dist 2026-06-16 12:06:07 -04:00
.gitlab-ci.yml ci: modern twine, classic auth via group vars, v0.1.6 2026-06-16 15:18:54 -04:00
LICENSE phase 0 + 1: repo bones and ETF codec 2026-06-16 10:39:01 -04:00
Makefile packaging: ship to PyPI via tag + GitLab CI (mirrors ago's pattern) 2026-06-16 13:45:08 -04:00
pyproject.toml 0.1.7: declare DFLAG_MANDATORY_25_DIGEST + decode dist-header replies 2026-06-17 08:51:09 -04:00
README.md packaging: ship to PyPI via tag + GitLab CI (mirrors ago's pattern) 2026-06-16 13:45:08 -04:00

erldistpy

Native Python client for our Erlang distribution protocol. Talk Erlang/Elixir nodes from CPython without HTTP shim layers.

Built to swap into Python web apps as a drop-in for HTTP wallet-bridge clients (see unfeed's WalletTransport and make_post_sell's crypto watcher) so they can call Elixir gen_server processes over native Erlang dist instead of JSON-RPC or HTTPS. Same call semantics, lower latency, fewer moving parts.

Install

pip install erldistpy

Quick start

from erldistpy import Node, Atom

with Node(
    our_name="myapp@host",
    peer_name="wallet",                # short EPMD name
    peer_host="wallet.example.com",
    cookie="SHARED_COOKIE",            # read from a file path, never inline
) as node:
    reply = node.call(
        "Elixir.Wallet.Service",
        (Atom("monero"), Atom("get_height"), []),
        timeout=5.0,
    )
    # reply is whatever the gen_server returned — atoms / binaries /
    # tuples / maps / lists / pids / refs decode to Python natives.

For TLS dist (Erlang inet_tls_dist):

from erldistpy import Node, make_dist_tls_context

ctx = make_dist_tls_context(
    cert="/etc/myapp/client.pem",
    key="/etc/myapp/client.key",
    ca="/etc/myapp/ca.pem",
)
node = Node(our_name=..., peer_name=..., cookie=..., tls_context=ctx)

Scope

  • ETF (External Term Format) codec — encode/decode Erlang terms
  • EPMD client — node name → port lookup
  • v6 distribution handshake — MD5 cookie auth, version negotiation
  • gen_call to registered processes on a remote node
  • TLS dist support (Erlang inet_tls_dist)

Out of scope: full Erlang node impersonation, link/monitor lifecycles, distributed Mnesia. We are a client, not a peer node.

Why not Pyrlang?

Pyrlang implements a full asyncio Erlang node. Heavy, asyncio-first, complex. erldistpy is a small synchronous client that fits behind the same Protocol surface as httpx. Different shape, different audience.

Development

make bootstrap   # create venv, install editable + dev deps
make test        # run pytest (122 tests)
make lint        # ruff check
make build       # build sdist + wheel into dist/
make dist-check  # twine check dist/*

See docs/ROADMAP.md for the phase-by-phase build log.

License

Unlicense (public domain).