Skip to main content

Embedded Pion

The Pion engine inside your Python process, behind redis-py. No server.

import pionlite as pion                # the pionlite wheel, attached to each GitHub release
r = pion.Redis(dir="./data")           # a redis.Redis: pipelines, Lock, pub/sub, scripts
ar = pion.asyncio.Redis(dir="./data")  # a redis.asyncio.Redis
r = pion.from_url("pion:///abs/path/to/data")
pool = pion.asyncio.ConnectionPool.from_url("pion:///abs/path/to/data")  # for redis.asyncio.Redis(connection_pool=pool)
  • Every write goes to the server's write-ahead log in dir as the command runs; an acknowledged write survives kill -9.
  • One engine and one data directory per process. A second process opening the directory is refused (dir/pion.lock): to share data between processes, run pion-server on it.
  • KV only (no vector search). Built and tested on macOS arm64, Linux x86-64 and Linux arm64 by .github/workflows/embedded.yml (pull requests that touch the library, and manual runs). Each release built from a v* tag carries the three wheels (pionlite-<version>-cp311-abi3-*.whl, one per platform, for CPython 3.11 and later). The Linux wheels are manylinux_2_35 (glibc 2.35 or later, Ubuntu 22.04 for one), built on Ubuntu 22.04; macOS needs 14 or later.
  • The engine's log lines (WAL replay and snapshot load at open, Snapshot: saved on SAVE, warnings) go to dir/pion.log, never to the host's stdout. logfile PATH in the engine's config moves them.

Known gaps

  • One engine per process; memory://-style isolated instances per URL are not possible.
  • pion-server takes pion.lock only with --dir. A server started without it, in the directory an app has open, is not stopped.

Engine options

pion.Redis(dir=..., appendonly=..., wal_size_mb=..., maxmemory=..., maxmemory_policy=...). The C ABI's config (pion_embed_open, one key value per line) also takes wal-max-segments, wal-full-policy, blob-threshold, no-blob-tier, requirepass, enable-debug-command, maxmemory-samples, lua-time-limit, lua-memory-limit and logfile, with the values pion-server's flags of the same names take (maxmemory and lua-memory-limit in Redis units). A bad value fails the open with the reason.

Waiting for output

pion_embed_wake_fd(h, conn) returns a descriptor that is readable while the connection has output the caller has not collected: a parked command's reply (BLPOP, XREADGROUP BLOCK, WAIT), a pub/sub message another connection published. The sync adapter waits on it with select, the asyncio adapter with loop.add_reader, so neither polls. A push answers a blocked client on another connection before the pushing call returns, as the server's loop does; a timeout is answered by the engine's periodic tick.

Build and test

MACOSX_DEPLOYMENT_TARGET=14.0 pixi run build-embed   # -> libpion.dylib (~6 min)
PYTHONPATH=embedded/python python3 embedded/tests/test_smoke.py
bash embedded/build_wheel.sh python3      # -> embedded/dist/*-cp311-abi3-macosx_14_0_arm64.whl
python3 embedded/tests/test_graduation.py ./pion-server   # app <-> pion-server --dir, one at a time
# the server's test tier, through the library: a stand-in for pion-server
# serves each test from libpion behind a loopback proxy. Tests that need a
# flag the library has no equivalent for (--kvcache, --cluster, -w N, ...)
# are reported as skipped, with the flag named.
python3 tests/run_all.py --server-tests-only --binary embedded/tests/pion-server-embedded
# or one suite by hand:
PYTHONPATH=embedded/python python3 -m pionlite.proxy --dir /tmp/d --port 16700 &
python3 tests/test_raw.py --port 16700 && python3 tests/test_parity.py --port 16700

The library looks for libpion.dylib next to the package (_lib/), at the repo root, or at $PION_EMBED_LIB.

How it works

src/lib/pion_embed.mojo sets the engine up as the --io-threads executor (#84) with no I/O threads, and plays the I/O thread itself: a request goes into the connection's input buffer, _dispatch_io_batch runs it, and the reply is taken from the connection's output queue. Pub/sub deliveries and parked commands (BLPOP, XREADGROUP BLOCK, WAIT) use the same queue. Calls run on the caller's thread under one engine mutex, through the stable-ABI extension _pion (one cp311-abi3 wheel for CPython >= 3.11; it releases the GIL; PION_EMBED_CTYPES=1 falls back to ctypes); a daemon thread ticks the engine (Engine._tick_loop).

Metadata

Release files for pionlite 1.1.6

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 pionlite 1.1.6
File Interpreter ABI Platform Actions
pionlite-1.1.6-cp311-abi3-manylinux_2_35_x86_64.whl CPython 3.11 abi3 Linux glibc 2.35+ x86-64 Details for pionlite-1.1.6-cp311-abi3-manylinux_2_35_x86_64.whl
pionlite-1.1.6-cp311-abi3-manylinux_2_35_aarch64.whl CPython 3.11 abi3 Linux glibc 2.35+ ARM64 Details for pionlite-1.1.6-cp311-abi3-manylinux_2_35_aarch64.whl
pionlite-1.1.6-cp311-abi3-macosx_14_0_arm64.whl CPython 3.11 abi3 macOS 14.0+ ARM64 Details for pionlite-1.1.6-cp311-abi3-macosx_14_0_arm64.whl

Total release size: 9.0 MB

Release files / pionlite-1.1.6-cp311-abi3-manylinux_2_35_x86_64.whl

Download URL pionlite-1.1.6-cp311-abi3-manylinux_2_35_x86_64.whl
Size 3.2 MB
Tags CPython 3.11 Linux glibc 2.35+ x86-64 abi3
SHA-256 checksum
How to use checksums
5a4754e98e6eb442849368f1ace49247fb239af0d239a4d9824e1df82775054d
BLAKE2b-256 checksum
How to use checksums
97cd47cc411d5f996dc1c81864bdf71827b552e061a173963f52781ca23111bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 30, 2026.

Transparency log

Release files / pionlite-1.1.6-cp311-abi3-manylinux_2_35_aarch64.whl

Download URL pionlite-1.1.6-cp311-abi3-manylinux_2_35_aarch64.whl
Size 3.0 MB
Tags CPython 3.11 Linux glibc 2.35+ ARM64 abi3
SHA-256 checksum
How to use checksums
c3d77a14c920a842decc8a65132d59ca351325420835d2f35b50597c7cb875f6
BLAKE2b-256 checksum
How to use checksums
abe11f46586ca22947e97e1afeab1624072e1c8fc5057c145327d2a0ef76fc3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 30, 2026.

Transparency log

Release files / pionlite-1.1.6-cp311-abi3-macosx_14_0_arm64.whl

Download URL pionlite-1.1.6-cp311-abi3-macosx_14_0_arm64.whl
Size 2.8 MB
Tags CPython 3.11 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
ab3c55eb1a4a432cc5006b77508c837675ef1666bddba36b023886d1ca789b52
BLAKE2b-256 checksum
How to use checksums
e770253ebfa6301e986d79db947ebbd2ccaa3b36daa951a259a735b851cfdf83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 30, 2026.

Transparency log

Security for pionlite 1.1.6

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 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for pionlite-1.1.6-cp311-abi3-manylinux_2_35_x86_64.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 Nov 30, 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.

Release history Release notifications | RSS feed

This release

1.1.6 This release

3 release files Full provenance

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