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.70.0.tar.gz (38.3 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.70.0-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

protowire_python-0.70.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

protowire_python-0.70.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.2 MB view details)

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

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

Uploaded CPython 3.13macOS 15.0+ ARM64

protowire_python-0.70.0-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

protowire_python-0.70.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

protowire_python-0.70.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.2 MB view details)

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

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

Uploaded CPython 3.12macOS 15.0+ ARM64

protowire_python-0.70.0-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

protowire_python-0.70.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

protowire_python-0.70.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.2 MB view details)

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

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

Uploaded CPython 3.11macOS 15.0+ ARM64

protowire_python-0.70.0-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

protowire_python-0.70.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

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

protowire_python-0.70.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.2 MB view details)

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

protowire_python-0.70.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.70.0.tar.gz.

File metadata

  • Download URL: protowire_python-0.70.0.tar.gz
  • Upload date:
  • Size: 38.3 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.70.0.tar.gz
Algorithm Hash digest
SHA256 6e9504a4ee9f15e3214d0e0273e4072a034ba445e758cfa1b280fd442ae10392
MD5 44f6fad93baa6b4902d87a212e5d34ae
BLAKE2b-256 c493d8357fac0333b3e1b92c3c67e592694840c67d76524bbe1c86e7f24a63a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2aa8ff7abd061b087343bfb7224954911006c13c5f75913fd493893a4ae27cb6
MD5 10219314612c89df70644a4eba963834
BLAKE2b-256 09780da6181800312f310f1ddf6ad4aa9f6228a0da34af6ee5cf3977ee3b8c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 94b4d2e82394c54391eda33c53e47dc6b36cace180aa9936f1e8980d57a443b8
MD5 aa3a8c9cbcfb3ffef1dd2631d6469f1b
BLAKE2b-256 113e75737d6060f8e3c3578fc2cc2edb5acb7413a4ce41d7e30489c2b7399d4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ccd45f1deffc34d9a6c33f5c2e2cc4655da8e89c348c55fa7275c6579d03d9fa
MD5 99f4ed02219e0f5744c87e8ddf64dcac
BLAKE2b-256 9922d85fd867b2a3e66c69c129b8292bca31ae05d1d4e8516563792fd7a201a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1161283ff04b59528bd830d0f8a51eccea60168586dfccaa0ace9bddd5612032
MD5 a7159b8b57a6982cceacf322ee6462ba
BLAKE2b-256 40453d25cd3121d1ff58352c9bc5603defb6b5ebfe4e39e4f3248fc36b4b074b

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d77c78090f06a674d3e52ee370822334c101dce2262c38347dfda9def22af370
MD5 45bc71e294fccb4218f505ae69c10a5e
BLAKE2b-256 df900058ccbe353e43e154f7949241a8a4cb48a8734add49bb2497d2a1afa709

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d71f184cb0ac3a0d9a55e9c6decb5ef464e757d5cdf1c76bcb7bad8084d2775
MD5 7fa8db12e2c5ee119155937621c99c0c
BLAKE2b-256 d845d4f46f0e0d9ef916b8e74669fdce9fb094572b326530826d11690bf1727b

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 84d752c9514cf323dc53fe0aeb2225b7e754b27b964fbe80fe017f72a13f8189
MD5 8483e3d9d8abd76d5c1dbd4358b87704
BLAKE2b-256 6626d52b6983be579841404655c469d51f9cea7b481ac93616a0706dca052781

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a86aacaf6cf271ea10d7079242d1d5c33e381ff08747b8da4d08a8a139516dac
MD5 c7ca644f3c1e13e3d38649bda79f429c
BLAKE2b-256 a05b303c96dc8669e8f90da3bb19c271374e20ee7f87495d5b806f25d5d98445

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e1ee25ce45fdc3bc06b98fcf9f81511246530fbc9fff4101c597c11c8db6cbc5
MD5 feac9c4d1bd4fb310604fd322ab3f8e6
BLAKE2b-256 b04ba71b322c9b542972cbcc05d086c435c23a9066e0b5d62c4235face293ad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e7ad3f09944865fe37113c9b68b3daa9c451a2ca5ff7d97ed7471c34ab2a844
MD5 808da6dc7e8cc82c6e9bdbcdd6252823
BLAKE2b-256 4d570e229ce450c3bb3f7c5c0c08575c598095d9cebd97bacf6d3399fc23c952

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4eff026328c889f6ba9b7faa8680899f42f991e178484ff34386fec13d6abb61
MD5 164d1db8fa9d5959634dfe4ccc0c884c
BLAKE2b-256 fe93430c141ed6f79f39ade80425b2bdaadc8a59c04a669ff38f04313ffb9be0

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 deb26eca7e611a6bdc04a4abb278d1d73ce68a2460be22f5fff85b81f91c52b0
MD5 78ffe5d4a9ba2f1a926526e082d0df0a
BLAKE2b-256 015811ec365d5ef8087ccb66f7ac12b48a5e4273d70dfa012957409ba3791f49

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bdeb5f7481eb46749faa3eb1536c04a0b431ba23a8d4bf2cafb646f868edf6fa
MD5 0ce5ceea0d8770c51e96587d9c3f2a22
BLAKE2b-256 4454c7b7f5563ae4313611a6336bc474f563ba37ead90fe55497b352fde6283b

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edb06263475e7262ada711433082d93a7d68022aa0ebf0cb685e06da9f1673b5
MD5 ed48cceef3e073c17a685adaf6925686
BLAKE2b-256 cc3bd66ea7ca7c07e76a98bed7ffbb4266712461476118c56221e6b88ee5c9a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a375e73035152e6007ad9c6d103d7f6f0b6bfa73ce47717ee035db7bd18a21ea
MD5 d013bed6cf0dcafef2bffe9afc694165
BLAKE2b-256 6db384e6031e4c1a32222148312253045e1af1d2126b86f14dd0bd7bf8f328b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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.70.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for protowire_python-0.70.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7385b8430205620315c0a51d6422279d9d96e810a37c3b6549ed278079a73874
MD5 fafd33a7c2fb3dd216a10beb4e57944e
BLAKE2b-256 b1463740c87ff067bfda1f61ec58fd512620a6d1766af960ce1a9ebb7370aeda

See more details on using hashes here.

Provenance

The following attestation bundles were made for protowire_python-0.70.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