Skip to main content

Pyrlang

Pyrlang is Python implemented on the BEAM, primarily in Erlang/OTP.

The project goal is not to build a CPython package, a python -m runner, or a Python library that mimics Erlang. Pyrlang source is parsed, loaded, evaluated, interpreted, or compiled by BEAM-resident runtime code.

Current repository contents:

  • SPEC.md: language and runtime semantics.
  • WEB.md: Pyrunicorn WSGI target architecture.
  • src/: BEAM-native Erlang runtime modules.
  • test/: EUnit tests for the current runtime slice.
  • bin/: BEAM-native escript entrypoints for pyrlang and pyrunicorn.
  • examples/: runnable Pyrlang source demos.
  • include/: shared Erlang definitions.
  • Makefile: plain erlc/erl build and test entrypoint.

Implemented foundation:

  • Actor-local heaps and mutable container/object references.
  • Message export/import with copied mutable values and cyclic object graphs. Native stdlib objects that close over actor-local state or BEAM resources are marked unsendable and surface as Pyrlang TypeError through source-level send().
  • BEAM actor primitives: spawn, send, receive, selective receive, call/reply, source-level links, monitors, demonitoring, linked spawn, exit trapping, registration, source-level receive timeouts, and explicit atom-safe Erlang calls through erlang.apply.
  • Parser/evaluator subset for expressions, assignments, functions, classes, methods, attributes, subscripts, decorators, if/elif/else, while, for, try/except/finally, with, yield, lambdas, boolean operators, membership, identity comparisons, simple slices, keyword/default arguments, *args/**kwargs, call expansion, range, and list/dict/set comprehensions.
  • Literal support for None, booleans, integers, floats, strings, bytes, tuples, lists, dicts, and sets.
  • Object model foundation: classes, instances, descriptors, bound methods, and C3 MRO, including super(), property, staticmethod, classmethod, and callable instances plus arithmetic/comparison special-method dispatch. Class suites execute supported Pyrlang statements including nested classes, imports, conditionals, loops, exception handlers, and context managers.
  • Basic metaclass creation and inherited metaclass selection through class C(metaclass=...) and type(name, bases, attrs).
  • Dynamic object helpers: getattr, setattr, hasattr, isinstance, issubclass, and type(obj) for Pyrlang instances.
  • BEAM-backed open() for basic file read/write/close and context-manager use, with live file handles marked as actor-local unsendable resources.
  • Actor-local module/package loading/imports from .py and __init__.py source files, with .pyr accepted as a legacy project-local extension, plus BEAM-native erlang, os, re, hashlib, hmac, secrets, contextvars, weakref, threading, importlib, datetime, decimal, logging, pathlib, http.cookies, urllib.parse, and email.utils modules, plus a minimal actor-backed sqlite3 DB-API surface.
  • Pyrlang exception values with catch/raise flow, StopIteration, catchable attribute/subscript/operator errors, and bare raise re-raising the active exception inside exception handlers.
  • Generator objects, the user-visible __iter__/__next__ protocol, and source-level mutable list/dict operations, including iter, list, tuple, dict, and set constructors.
  • Source-level erlang concurrency surface: process handles, GenServer, OTP-shaped supervisors, distribution helpers, and an erlang.mnesia proxy module.
  • Actor-backed SQLite access through an Erlang port to sqlite3, with connection-scoped transactions, DB-API connection/cursor objects marked as actor-local resources, and connection actor crashes mapped to DB-API operational errors.
  • Pyrunicorn WSGI environ/worker/http/server foundation that loads Pyrlang module:callable apps inside worker actors, provides basic WSGI stream objects with sized and line reads, supports iterable response bodies and the start_response write callable including exc_info replacement before headers are sent, threads configured and socket-derived WSGI environ values such as SERVER_PORT and REMOTE_ADDR into Pyrlang-source apps, isolates worker module globals, returns 400 responses for malformed requests and 500 responses for app and worker failures, reads Content-Length bodies across TCP packets, serves over a real TCP socket with a round-robin worker pool, restarts crashed workers, and boots a small Pyrlang-source Django-shaped WSGI shim with a minimal middleware chain.
  • BEAM-native bin/pyrlang and bin/pyrunicorn escript wrappers. pyrunicorn accepts --bind, --workers, --django-settings-module, and --path.
  • pyrlang -m module ... executes a module or package __main__.py through the Pyrlang runtime and exposes arguments through the BEAM-native sys.argv.

Run the current verification suite:

make test

Concurrency contract examples:

import erlang as erl

parent = erl.self()

def greeter():
    msg = erl.receive()
    erl.send(parent, ("hello", msg))

pid = erl.spawn(greeter)
erl.send(pid, "Grant")
assert erl.receive() == ("hello", "Grant")

Links are for shared fate:

import erlang as erl

erl.trap_exit(True)

def child():
    raise RuntimeError("boom")

pid = erl.spawn_link(child)
exit_msg = erl.receive(timeout=1000)
erl.trap_exit(False)

Monitors observe failure without linking fate:

import erlang as erl

def child():
    return None

pid = erl.spawn(child)
ref = erl.monitor(pid)
down_msg = erl.receive(timeout=1000)

Supervisors restart source-level children according to child specs:

import erlang as erl

class Worker(erl.GenServer):
    def init(self):
        self.seen = 0
        return self

    def handle_call(self, request, from_):
        self.seen += 1
        return erl.reply(self.seen)

child = erl.child("worker", start=Worker.start_link, restart="permanent")
sup = erl.supervise(children=[child], strategy="one_for_one")
children = erl.which_children(sup)

The examples/mnesia_sse_bus.py demo combines GenServer, supervision, Mnesia table events, and Pyrunicorn WSGI into a small durable SSE message bus.

The erlang module is a Pyrlang builtin/proxy module for BEAM runtime concepts. It is imported with ordinary Python syntax, but it is not a CPython package and it must not hide BEAM actors behind threads, futures, asyncio tasks, or durable queue semantics. Actor messages are exported by the sender and imported by the receiver. Mutable values are copied across actor boundaries; object identity, mutation, module globals, and actor-local resources remain local to the owning actor. Timeouts mean no matching message was observed before the deadline, not that the remote process failed or did not act.

Build and refresh executable entrypoint bits:

make entrypoints

This repository implements the current scoped contracts in SPEC.md and WEB.md: Python-syntax Pyrlang source running on BEAM-resident runtime code, actor-backed runtime behavior, and Pyrlang-source WSGI on BEAM-native Pyrunicorn. Larger Python and Django compatibility areas remain outside the current scope until the specifications are expanded.

Metadata

Release files for pyrlang 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyrlang 0.2.0
File Actions
pyrlang-0.2.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pyrlang-0.2.0-py3-none-win_amd64.whl
pyrlang-0.2.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for pyrlang-0.2.0-py3-none-musllinux_1_2_x86_64.whl
pyrlang-0.2.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for pyrlang-0.2.0-py3-none-musllinux_1_2_aarch64.whl
pyrlang-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for pyrlang-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pyrlang-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details for pyrlang-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
pyrlang-0.2.0-py3-none-macosx_14_0_x86_64.whl Python 3 none macOS 14.0+ x86-64 Details for pyrlang-0.2.0-py3-none-macosx_14_0_x86_64.whl
pyrlang-0.2.0-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for pyrlang-0.2.0-py3-none-macosx_14_0_arm64.whl

Total release size: 208.5 MB

Release files / pyrlang-0.2.0-py3-none-win_amd64.whl

Download URL pyrlang-0.2.0-py3-none-win_amd64.whl
Size 47.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
c7cabc436c833fd3eb65ebff71f03982d8ca05ce8cbdc48a89fcabc685f50107
BLAKE2b-256 checksum
How to use checksums
6492105ff4250fb6b9c9da69bfb3889ae7ecf3b027ee2e117c18aa72d465db21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-musllinux_1_2_x86_64.whl

Download URL pyrlang-0.2.0-py3-none-musllinux_1_2_x86_64.whl
Size 34.8 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5f9f572e7bf2d26fc6fc937aa3333f7bd4baff67969aaf7ae6348d6f335df9d1
BLAKE2b-256 checksum
How to use checksums
d9df676b2a68f49add8e6163b9e948b2bfc5f4427843058ce53d705f408f0392
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-musllinux_1_2_aarch64.whl

Download URL pyrlang-0.2.0-py3-none-musllinux_1_2_aarch64.whl
Size 33.5 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c343a4d1835adfd94a0a6516569031ddf8250aeec19b5353beb478c0db7d7ba8
BLAKE2b-256 checksum
How to use checksums
318ffd1520a8da5b316330e5055a47b9cc60e8c4066d750c43ab1cd141a5ad49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyrlang-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 33.5 MB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b7d6091828ead06e9a48f1fc1e3c8d42bf0e8fe01901870c4a2b525d923d9ad8
BLAKE2b-256 checksum
How to use checksums
4caf1d6be84ea06129686aa831a0171fb9334b9404ab6a0d02957ef3856c23d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL pyrlang-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 32.2 MB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
be13acbd63a576d03f8e61de4eb5c10614167424490230502c2dfd59c8c4787a
BLAKE2b-256 checksum
How to use checksums
7b3139673f353073f328f1be41db7a7d967b47aad4105b417203b541adfc3249
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-macosx_14_0_x86_64.whl

Download URL pyrlang-0.2.0-py3-none-macosx_14_0_x86_64.whl
Size 13.6 MB
Tags Python 3 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
fe7b2d06329691ee2bc8b22abd1c130e2521729926bf65f860780c1a6a9b8100
BLAKE2b-256 checksum
How to use checksums
32305d1d0ada0b179695a935352de62a3d0b73f4a561c5204dada2338392584e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / pyrlang-0.2.0-py3-none-macosx_14_0_arm64.whl

Download URL pyrlang-0.2.0-py3-none-macosx_14_0_arm64.whl
Size 13.8 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
eaabcecf595f0bc406b44ecb3275feed6c84039fcc55df3fa5d351c0090770be
BLAKE2b-256 checksum
How to use checksums
53b970bb44e6e44a7a2babd384e77ab9fee768265bc09c75e2ad1ff9de214020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Security for pyrlang 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for pyrlang-0.2.0-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page