skillfed

pycapnp

A cython wrapping of the C++ Cap'n Proto library

pycapnp v2.2.4 1.7M downloads/30d#3,620 on PyPI533
Permissive license BSD-2-Clause Active released

What it is and what it does

pycapnp wraps the C++ Cap'n Proto library, bringing schema-driven serialization and RPC to Python. Cap'n Proto is a data interchange format designed for speed—messages defined in a schema serialize to compact binary format, avoiding deserialization overhead. The library supports both synchronous and asynchronous RPC via a promise-style API, useful for distributed systems where efficiency matters.

The package includes prebuilt wheels for Python 3.9 through 3.14 on Linux, macOS, and Windows, though source builds require compilation tooling. It depends only on jinja2 at runtime. The library is actively maintained with recent fixes for memory leaks and NULL pointer dereferences, stable since initial release in 2013.

Use it for:

  • Serialize structured data to compact binary format for efficient storage or network transmission.
  • Implement RPC servers and clients with async/await support for inter-process communication.
  • Define strongly-typed message schemas to enforce data contracts across service boundaries.
  • Build distributed systems where serialization overhead and latency are critical.
  • Exchange data with other Cap'n Proto implementations using shared schema definitions.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pycapnp is a Python binding for Cap'n Proto, a serialization and RPC framework enabling efficient schema-based message exchange and remote procedure calls.

Yes, if you need schema-driven serialization and RPC with Cap'n Proto and can meet C++14 compiler and build-tool requirements. Production-stable, actively maintained, no known vulnerabilities, prebuilt wheels for common platforms. Not recommended if you cannot install a C++ compiler or prefer pure-Python serialization.

Install

pycapnp on PyPI

pip

pip install pycapnp

uv

uv add pycapnp

poetry

poetry add pycapnp

Installing pycapnp

Before you install

Medium install friction: requires a C++14 compiler, cmake, and Python development headers. Prebuilt wheels available for Python 3.9–3.14 on Linux, macOS, and Windows, but source builds need compilation tooling. Actively maintained with recent release (42 days old) and no known vulnerabilities.

License in practice

BSD-2-Clause is permissive; you may use, modify, and distribute pycapnp freely in open-source and commercial projects, provided you retain the license notice and disclaimer.

Quickstart

pip install pycapnp

import capnp

# Schema-based message creation and serialization
message = capnp.new_message()
message.write(open('data.bin', 'w'))

Requires C++14-compatible compiler (gcc 6.1+, clang 6+, or Visual Studio 2017+), cmake, and Python development headers. On Linux, Python dev headers often in separate package. 32-bit Linux requires capnproto compiled with -fPIC.

Verify before relying

  • Whether bundled capnproto (1.4.0 as of v2.2.4) meets your requirements or system-installed version is preferred.
  • Performance characteristics and serialization overhead versus other Python serialization frameworks.
  • Practical PyPy compatibility beyond classifier listing.
  • Specific RPC latency and throughput characteristics for your use case.

Package facts

License BSD-2-Clause (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — jinja2
Maintenance actively maintained — 42 days since the last release
Last repo commit
First released
Downloads 1,719,080/month — #3,620 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pycapnp-2.2.4-cp310-cp310-macosx_10_9_x86_64.whl; pycapnp-2.2.4-cp310-cp310-macosx_11_0_arm64.whl; pycapnp-2.2.4-cp310-cp310-manylinux_2_28_aarch64.whl; pycapnp-2.2.4-cp310-cp310-manylinux_2_28_i686.whl; pycapnp-2.2.4-cp310-cp310-manylinux_2_28_ppc64le.whl; pycapnp-2.2.4-cp310-cp310-manylinux_2_28_s390x.whl; pycapnp-2.2.4-cp310-cp310-manylinux_2_28_x86_64.whl; pycapnp-2.2.4-cp310-cp310-musllinux_1_2_aarch64.whl; pycapnp-2.2.4-cp310-cp310-musllinux_1_2_i686.whl; pycapnp-2.2.4-cp310-cp310-musllinux_1_2_ppc64le.whl; pycapnp-2.2.4-cp310-cp310-musllinux_1_2_s390x.whl; pycapnp-2.2.4-cp310-cp310-musllinux_1_2_x86_64.whl; pycapnp-2.2.4-cp310-cp310-win32.whl; pycapnp-2.2.4-cp310-cp310-win_amd64.whl; pycapnp-2.2.4-cp311-cp311-macosx_10_9_x86_64.whl; pycapnp-2.2.4-cp311-cp311-macosx_11_0_arm64.whl; pycapnp-2.2.4-cp311-cp311-manylinux_2_28_aarch64.whl; pycapnp-2.2.4-cp311-cp311-manylinux_2_28_i686.whl; pycapnp-2.2.4-cp311-cp311-manylinux_2_28_ppc64le.whl; pycapnp-2.2.4-cp311-cp311-manylinux_2_28_s390x.whl

Keywords: capnp, capnproto, Cap'n Proto, pycapnp

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: Windows :: Windows 10Operating System :: POSIXProgramming Language :: C++Programming Language :: CythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Communications

Tags

cap'n proto pythonschema serializationrpc frameworkmessage serializationcapnproto bindingasync rpcdata interchange format
serializationrpcschema-driven

More Communications packages