Skip to main content

pyaeron

CPython 3.12–3.15 bindings for the Aeron C client. Implemented against the Python C API (no pybind11).

Offer contract

result = publication.offer(payload)
if result:                          # True — message was appended
    ...
elif result is pyaeron.BACK_PRESSURED:
    idle.idle()
elif result is pyaeron.NOT_CONNECTED:
    ...
# ADMIN_ACTION is also a falsy OfferCode (retry)
# PublicationClosed / MaxPositionExceeded are raised

bool(BACK_PRESSURED), bool(NOT_CONNECTED), and bool(ADMIN_ACTION) are always False. Successful offers return Python True (the new stream position is on publication.last_position).

Zero copy

payload path
bytes pointer into ob_sval
bytearray pointer into the bytearray (PyByteArray_AS_STRING)
C-contiguous memoryview pointer into the view (PyMemoryView_GET_BUFFER)
ASCII str pointer into compact ASCII data (PyUnicode_DATA)
non-ASCII str UTF-8 conversion (PyUnicode_AsUTF8AndSize, cached on the object)
other bytes-like (array.array, …) PEP 3118 PyObject_GetBuffer

GIL

Idle strategies, await_connected, add_publication / add_subscription driver waits, and driver/client start-stop drop the GIL. offer and poll keep it: they are non-blocking shared-memory operations, and poll invokes a Python fragment handler.

Examples

Runnable scripts in examples/:

python examples/01_ipc_producer_consumer.py   # 1 producer, 1 consumer (IPC)
python examples/02_ipc_multicast.py           # 1 producer, 2 consumers (IPC fan-out)
python examples/03_ipc_rpc.py                 # caller waits for a correlated response
python examples/04_offer_status.py            # True vs falsy OfferCode enums
python examples/05_polling.py                 # poll duty cycle, fragment_limit, assemble
python examples/06_channels.py                # Aeron URI construction and channel params
python examples/07_streams.py                 # same channel, two independent stream IDs
python examples/08_exclusive_publication.py   # 01 with add_exclusive_publication
python examples/09_buffer_protocol.py         # offer() buffer-protocol payloads
python examples/10_lifecycle.py               # full session: connect through close
python examples/11_images.py                  # two Images; poll one session
import pyaeron

with pyaeron.Aeron(embedded=True) as aeron:
    sub = aeron.add_subscription(pyaeron.IPC_CHANNEL, 10)
    pub = aeron.add_publication(pyaeron.IPC_CHANNEL, 10)
    pub.await_connected()

    result = pub.offer(b"hello")
    if result is True:
        def on_fragment(buf, header):
            print(bytes(buf), header.session_id)
        sub.poll(on_fragment)

embedded=True launches an in-process C media driver in a unique temp directory. Point dir= at an existing driver if you already run aeronmd.

IPC_CHANNEL is Aeron's URI "aeron:ipc" — shared-memory IPC on one machine, not a pyaeron invention.

Build

Requires CMake ≥ 3.30, a C11 compiler, and CPython 3.12–3.15.

git submodule update --init --recursive
pip install -e ".[test]"
pytest

Aeron itself is vendored as third_party/aeron (https://github.com/aeron-io/aeron.git).

Benchmarks

One-in-flight RPC (ping/pong) latency for C vs Python and IPC vs localhost UDP:

python benchmarks/run.py --quick
python benchmarks/run.py --net 10g,100g --quick   # rain → butterfly, 10GbE and ConnectX-5 100GbE

See benchmarks/README.md.

Download files

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

Source Distribution

pyaeron-0.1.0.tar.gz (481.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyaeron-0.1.0-cp315-cp315-manylinux_2_28_x86_64.whl (359.7 kB view details)

Uploaded CPython 3.15manylinux: glibc 2.28+ x86-64

pyaeron-0.1.0-cp315-cp315-macosx_11_0_arm64.whl (290.6 kB view details)

Uploaded CPython 3.15macOS 11.0+ ARM64

pyaeron-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl (359.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

pyaeron-0.1.0-cp314-cp314-macosx_11_0_arm64.whl (290.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pyaeron-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (359.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pyaeron-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (290.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyaeron-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (359.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyaeron-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (290.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file pyaeron-0.1.0.tar.gz.

File metadata

  • Download URL: pyaeron-0.1.0.tar.gz
  • Upload date:
  • Size: 481.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pyaeron-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65fad0d4ca6926a24620c712fdebe8db8589a4d42a8dc52f15910a868c318af0
MD5 f97f47fad8b8ffa19b80271fd102a63b
BLAKE2b-256 5cb9874a5825dfb33a6ff3dc8705ff6661f4bece2308ab1491ad8dcf3fdff8af

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp315-cp315-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp315-cp315-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b67461da75974397f17cd99900af5344b7409792c5a2b7db29b0a2314b7e6ae
MD5 d3a8e6b02707506cbd97edee46fc1f2c
BLAKE2b-256 dd9ade650ffddd407197e9668295ee6a1d6a3915b9a785f3518bf143da727cc2

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp315-cp315-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp315-cp315-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 308f212ef805d6c6ff8ed2d42ce83e6d3e062b48cc635637aaed799a01cdabbe
MD5 8136af34c55b13e0ef0e8ef36110ce73
BLAKE2b-256 3eef707c9d534f954f3e51758b38f6fc4f3f5ebd0cebaf36f50728e0877b1f8e

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f839e7c68100ee20b769b73df63a6aaad340b30d62ce43b0614a1636d8cbd22e
MD5 064712f9c60c7603e9a75ce9a945315f
BLAKE2b-256 0a66030a9cdbd5b4c4022b3b5ea50dde76ff9050da6b0812bdf5cc2f45882d68

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f62bdd241d78d000bd436e2b9e4047936c5c9c96cc5232200b653265e4db0bce
MD5 7d6d5285812a1aac8a4cf799283e54bb
BLAKE2b-256 ee0383fa3167ff6b3a892aedb8b17911845fc7d2d1673c212238783ebd289e37

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0f7a24b75eb74cef556f47b52a863da72bd061beb03f1bd60d4411c431bab0b
MD5 ee9326f0053b7ebcab026da845d9a9c0
BLAKE2b-256 2e9bdbf9b97f7c7242aed656ebff62f9325c0b76cc8a10cd0d6042efbc521f38

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f43c3a1a7d236d07e9040fcc321f7c3eeed8dcd2fe94687d78bb4cb37ccca72f
MD5 c92b9c03098fa47fdee7c73a5623a0d1
BLAKE2b-256 19dcb008706f8a402c824fb92e34632672766634701cec95a77f6d10b9788b2e

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6889d44b2aa2b5e8b653c29123717855cf114edf037490b0679ab7a156d7ec77
MD5 50ab42fdf03d91dd99afa8890ac0f0a9
BLAKE2b-256 0abd859cc49ab560234e679a39b1cf27cdafcfbbb066ad9d5e8770d0130b09bd

See more details on using hashes here.

File details

Details for the file pyaeron-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyaeron-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05b1c05b3f5b0a940c2107587b3c118dc59474ce505cc28b5b42aa829663de0d
MD5 b174991ce896e00982a464ede3089771
BLAKE2b-256 d66a788a8252f22418170937b35fbe9ccaec575cc31a56f6aad4493e9e1ebc32

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

9 files

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