pycapnp
A cython wrapping of the C++ Cap'n Proto library
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 pycapnpuv
uv add pycapnppoetry
poetry add pycapnpInstalling 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
Tags
More Communications packages
Pyasn1 encodes and decodes ASN.1 data…
permissive · top 100 on PyPI
pyasn1-modulesProvides a collection of ASN.1 data structures…
permissive · top 100 on PyPI
kombuKombu is a messaging library that provides a…
permissive · top 1,000 on PyPI
humanfriendlyFormats and parses numbers, file sizes,…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
phonenumbersParse, validate, format, and analyze…
permissive · top 1,000 on PyPI
zhinst-commszhinst-comms provides protocol stack bindings…
permissive · top 15,000 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
ManimPangoManimPango is a C binding for Pango using…
permissive · top 15,000 on PyPI
betterprotoGenerates idiomatic Python code from Protobuf 3…
permissive · top 5,000 on PyPI
PyBindGenPyBindGen generates clean C or C++ code that…
copyleft · top 15,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
scikit-build-coreA build backend that uses CMake to compile…
permissive · top 5,000 on PyPI
smg-grpc-protoProvides pre-compiled Python gRPC stubs for…
permissive · top 5,000 on PyPI
nanopbNanopb is a code generator and runtime library…
permissive · top 15,000 on PyPI
clangProvides Python bindings to libclang, allowing…
permissive · top 5,000 on PyPI