Skip to main content

Python wrapper around protowire-cpp — PXF text, SBE binary, and envelope codecs.

Project description

protowire-python

License: MIT PyPI Python CI

Python port of protowire — a protobuf-backed wire-format toolkit. CPython 3.10+, MIT, nanobind FFI over protowire-cpp. Verified for byte-equivalence against the canonical Go reference and seven other sibling ports.

The native extension uses nanobind with scikit-build-core as the build backend. The FFI boundary is intentionally narrow: Python sends a serialized FileDescriptorSet plus a fully-qualified message name; binary proto bytes flow back. google.protobuf.Message objects never cross the language boundary.

Install

pip install protowire-python

The PyPI distribution is named protowire-python (the bare protowire name was taken). The import name stays protowire:

from protowire import pxf, sbe, envelope

Wheels are published for CPython 3.10–3.13 on Linux × {x86_64, aarch64}, macOS × {x86_64, arm64}, and Windows × x86_64. On other platforms pip will fall back to a source build (requires CMake ≥ 3.20 and a C++20 compiler).

API

from protowire import pxf, sbe, envelope

# PXF — schema implicit in the message type.
text = pxf.marshal(my_msg)
pxf.unmarshal(text, my_msg)
result = pxf.unmarshal_full(text, my_msg)
result.is_set("nested.value"), result.is_null("flag")

# SBE — codec built from one or more FileDescriptors with sbe annotations.
codec = sbe.Codec.from_message(OrderType)
data = codec.marshal(order)
codec.unmarshal(data, order_out)
view = codec.view(data); view.uint("order_id")

# Envelope — wire-compatible with the Go envelope package.
e = envelope.OK(200, b"payload")
e = envelope.Err(400, "VALIDATION", "bad input").error.with_field(
    "name", "REQUIRED", "missing"
)

Build from source

git clone https://github.com/trendvidia/protowire-cpp.git ../protowire-cpp

python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[test]'

pytest

The build looks for protowire-cpp at ../protowire-cpp by default. Override with PROTOWIRE_CPP_DIR=/abs/path pip install -e . or pip install -e . --config-settings=cmake.define.PROTOWIRE_CPP_DIR=/abs/path.

Required: CMake ≥ 3.20, a C++20 compiler, protobuf headers + libs.

  • Linux: apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev
  • macOS: brew install protobuf
  • Windows: vcpkg install protobuf and pass the toolchain file via CMAKE_TOOLCHAIN_FILE

Command-line tool

The protowire CLI is shared across every port and lives in the spec repo at github.com/trendvidia/protowire/cmd/protowire. Install:

go install github.com/trendvidia/protowire/cmd/protowire@latest

Python users use this library for in-process encode/decode and the shared CLI for command-line operations. There is no separate Python CLI binary.

Wire compatibility

Verified manually against the Go module:

  • Go pxf.Marshal → file → Python pxf.unmarshal round-trips a representative AllTypes message.
  • Python pxf.marshal → file → Go pxf.Unmarshal round-trips equally.

Because the wire codec is the C++ one, this port inherits all of protowire-cpp's cross-port equivalence guarantees.

Limitations & open gaps

  • No pure-Python fallback. A C++ toolchain (clang or gcc, plus CMake) is required at install time on platforms where we don't ship a wheel. Pure-google.protobuf-Python encode/decode without C++ is not available — opening that up is a meaningful refactor and would need a separate decoder path.
  • The FFI is narrow on purpose. google.protobuf.Message objects never cross the boundary — Python sends a FileDescriptorSet + fully-qualified message name and bytes flow back. This keeps the C++ side type-stable but means Python callers serialize their messages once before each call. A MessageView-style zero-copy path would be welcome.
  • No standalone Python CLI. The shared CLI lives in trendvidia/protowire/cmd/protowire; Python callers either invoke that binary or use the in-process API.
  • Free-threaded Python (PEP 703 / 3.13t) is untested. nanobind supports it but the build hasn't been validated against --disable-gil interpreters.

Repository layout

protowire-python/
├── LICENSE                                  # MIT
├── README.md
├── CHANGELOG.md
├── CONTRIBUTING.md, SECURITY.md,
│   GOVERNANCE.md, CODE_OF_CONDUCT.md
├── pyproject.toml                           # scikit-build-core + nanobind
├── CMakeLists.txt                           # links protowire-cpp
├── src/_protowire/module.cc                 # FFI entry point (nanobind)
├── src/protowire/                           # pure-Python public API
├── tests/                                   # pytest suites
├── testdata/                                # .proto fixtures
├── scripts/                                 # cross-port test harnesses
└── .github/                                 # CI: build matrix + cibuildwheel + CodeQL

Project details


Download files

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

Source Distribution

protowire_python-0.75.0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distributions

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

protowire_python-0.75.0-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

protowire_python-0.75.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

protowire_python-0.75.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

protowire_python-0.75.0-cp313-cp313-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

protowire_python-0.75.0-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

protowire_python-0.75.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

protowire_python-0.75.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

protowire_python-0.75.0-cp312-cp312-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

protowire_python-0.75.0-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

protowire_python-0.75.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

protowire_python-0.75.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

protowire_python-0.75.0-cp311-cp311-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

protowire_python-0.75.0-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

protowire_python-0.75.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

protowire_python-0.75.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

protowire_python-0.75.0-cp310-cp310-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file protowire_python-0.75.0.tar.gz.

File metadata

  • Download URL: protowire_python-0.75.0.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for protowire_python-0.75.0.tar.gz
Algorithm Hash digest
SHA256 1ee2d739669339aadcb69eab6d070ac15f1ac250ef4c5df58866906565e2b865
MD5 ef339ed3a4a86e3887ca6729a99de39c
BLAKE2b-256 4e73df2bb37df0b8ef4e323ce32c60b13507b1c58957e5a877d491e255a97d39

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0.tar.gz:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ac10b210689f68018f4772cc63e31a79f63edea04f240a208d8100e25ae5be79
MD5 f3d26ee5097433da19f9f9f3a176fd1e
BLAKE2b-256 62a85c23b81d73bd3f769985981d019638863bc5d81a1791d5129c6391a24e4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25089f9eb4f1ba92facd851b02d41f31c1f496cfc942f03de198ca0172074e8e
MD5 03e17e6557ea9d14fd8e6ef8dbb341e7
BLAKE2b-256 78d8ce1bae93e5ffe962a091c63c1554d0562a2999128ad9f578eb0f65d19945

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 066ba298d8d2fe3c58feed25c55b30ba8c730995ac3405a1c72206c6da29ea50
MD5 0879d4dd53f0dabc51691c27399bd8c7
BLAKE2b-256 d2c41c1ad0a56bfefa2045f72a1095f209d4f3856e73cf7acd873dc1e131dc79

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f0aafdbcac75aac7537b90256cba269d8e8d82205d035fb3bf3d4547c5295c7a
MD5 6ad8889178655695733614a2ca21ebe8
BLAKE2b-256 6fec61a8328823de39d17c2be796a257656e60387417832e7dbc061498394c63

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0a0f26599b3de7f791cc824b08137e4f5a049603335bb5d8e4302f3c0a5a77f2
MD5 eae2305c762c31cb044280eccf0f4a64
BLAKE2b-256 fe6a9353fd8ef4217f5f9fa8670d3f9ba67efc22f7d8d519799162e65a431c32

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a95def13ae85ebae21bfe7d68a3799effa98a7d62784b93bc781826f477f23fa
MD5 0018941b5a9c2e12ea827a35f20941ac
BLAKE2b-256 a076efac05d1d84c122a05f716338031bea7fd104af1b650a7b97718f286cebd

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 285301ee42265b8db927d22a135572bd1fc70c8cd7c436a49175ff46c28419ad
MD5 de27587d87ac1957046258655628c23f
BLAKE2b-256 38a82014272f53f31f1edead6c7548f8b74143ff6206bc5d0702879c094c7d24

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 05f4dfe065c3b4635d9b0a91184b5306f0ed2bf501cf054dd02ef4912c28e2a8
MD5 5ba9a89e25a972cb1296e43ac860da42
BLAKE2b-256 172ec6da6c4a538e0560091f29c03d785c51f74fa3a9a5080add2c25cabd0ac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ed3c5e293c109073675b4a35fc0ecd9d95159ac3a0e60338be26b25502252934
MD5 e0be7d157bf92a057c64ea85233fa13c
BLAKE2b-256 4b4bb36a1fb5d29100baabef73583857fbf97d59f4b015f2a03bb276c72795fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38a4049bac7b23dc428dd9335fb1d7f1316028bb6fa686b5f02ab773ec7d6d9c
MD5 a8634c03ad8cfc58f6090c03ae7fbc48
BLAKE2b-256 1b86c8c70c8b07c7b971b52cdf704349a445911764e82dbd39b580581f054df3

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 805600f195a6a9402e148ed8220ffd0c43af6b0c46bdb0853608aecc455cb961
MD5 bfa35c0c238ab09fa6c4a7519ff7622b
BLAKE2b-256 d9f97aca5283fcb15ac248a8f68adf25853d770a88f77bf7274e018afb890a27

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 117c66ab51091ba43b64b9ac2fc7eeba9c9f276d77a3320cdb97201fe226bf9d
MD5 8a6c9a5a3d24d70877623551b18ebf8b
BLAKE2b-256 cd2509b67a43631e8569e36598996e6836ee70fa0f74a83e27471e63dc0af272

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6d854a493d1293e1ace0ce7103ffe82a1afb449938b2baead6f2dd5ec393977f
MD5 27395f2faf5697e5642bd3767889828b
BLAKE2b-256 2a4a688d5ac280fc0ec96e2f2cccc61aad53877cbc868ef3732a8d408cf274cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2d635d3aad67b29f922e2367e0d553137f27fe5ddb196fbf2688d1ee673176c3
MD5 e64701442eb5aee67e5ce5d7e123e5e8
BLAKE2b-256 056a0eb9aab2559af1caee1ef21be640367a6138ebf286adb62daac370533ad6

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 88dc0630b9da23dc8d9f8e8caceadbebcb3950263228f9f2a9d98bc7edf8ae7e
MD5 5ff09df588e4aefe92e801880580333e
BLAKE2b-256 bfe6b3cfaee5d88fd1dd7c5964e5422f5807825d6dc069c82b45c8e3d98161c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file protowire_python-0.75.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.75.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e621c9a7969ef36abcd7a8f4d47c6a126b931599d4bba3ca076d5472288dfb9e
MD5 c3e4176272af5efbbbb73afc2371794c
BLAKE2b-256 48efa757f92a0994c118f16bff2248991ef03e8177f4ba75ba7b6552e9d9d77c

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.75.0-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: publish.yml on trendvidia/protowire-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page