EasySHM
High-Performance Shared Memory IPC for Python.
EasySHM is a low-latency communication library that allows Python processes to share data directly through RAM.
Features
- Zero-Socket IPC: No open ports, no network overhead.
- Kernel-Level Signaling: Uses a futex (Linux), POSIX semaphores (macOS) or Win32 Events (Windows) to wake every waiting process at once.
- Auto-Grow: Dynamic memory segment resizing without stopping the system.
- NumPy Zero-Copy: Share large arrays at RAM speeds (Giga-octets per second).
- Thread-Safe & Process-Safe: Built-in locking mechanism.
Installation
pip install py-easyshm
Quick Start
from easyshm import EasySHM
import ctypes
# Create or join a shared segment
shm = EasySHM("my_data", size=1024)
# 1. Use it as a NumPy array (Zero-Copy)
arr = shm.as_view("numpy", shape=(10,), dtype='float32')
arr[0] = 42.0
# 2. Use it as a C-Structure (Zero-Copy)
class Point(ctypes.Structure):
_fields_ = [("x", ctypes.c_int), ("y", ctypes.c_int)]
p = shm.as_view("struct", type=Point)
p.x = 100
# 3. Use it as a PyTorch Tensor
import torch
t = shm.as_view("torch", shape=(10,))
Architecture
EasySHM is platform-agnostic:
- Windows: Uses
CreateFileMappingand session-scoped Named Events (Local\). - Linux/Unix: Uses POSIX
mmapand Semaphores in/dev/shm.
Advanced Views
EasySHM now supports an extensible View Registry. You can map any typed structure directly over shared bytes without copies.
as_view("numpy", shape, dtype)as_view("struct", type=MyCtypesStruct)as_view("torch", shape, dtype)
Performance
Measured with python benchmarks/latency.py (two processes, thousands of round trips; Linux/WSL2, Python 3.12):
| Measure | EasySHM | TCP localhost |
|---|---|---|
| Wake-up latency, one-way (median / p99) | 35 µs / 130 µs | 17 µs / 80 µs |
| 1 MB round trip (median) | ~170–190 µs | ~110–160 µs |
| Idle CPU with an open segment | 0 % | 0 % |
Latency is dominated by Python itself, so a localhost socket is still faster for tiny messages. EasySHM is useful when several processes share the same (large) state without resending it, with no port to open. Run the benchmark on your own machine for real numbers.
Part of the EasySync ecosystem. Created by GalTechDev.
Metadata
Release files for py-easyshm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_easyshm-0.1.0.tar.gz | 33.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_easyshm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.7 kB
Release files / py_easyshm-0.1.0.tar.gz
| Download URL | py_easyshm-0.1.0.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9058246140c23ce97ff87b4b33734c2aa683a7457623ca3dd088c8857ef86fe1
|
|
BLAKE2b-256 checksum How to use checksums |
12124bb3ad67ec7da1f732fb23150ccd52d8949398a14770a2b9a14041e1b586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 29, 2026.
Transparency logRelease files / py_easyshm-0.1.0-py3-none-any.whl
| Download URL | py_easyshm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c5221ab9ed44fbb894694fad81a810ed9253267cd2755c48dfe3748e60fe701
|
|
BLAKE2b-256 checksum How to use checksums |
99630bfbc9d85cbc5547f8f6bf9e8a22a61cf913ac7798f4ba8009405df578b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 29, 2026.
Transparency log