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-1.0.0.tar.gz (51.1 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-1.0.0-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

protowire_python-1.0.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-1.0.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-1.0.0-cp313-cp313-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

protowire_python-1.0.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-1.0.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-1.0.0-cp312-cp312-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

protowire_python-1.0.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-1.0.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-1.0.0-cp311-cp311-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

protowire_python-1.0.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-1.0.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-1.0.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-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for protowire_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bd428ab5c39e33a44bda562939c6b898251ee7c739890e9fefb2bc1a02e7985d
MD5 800456e554650ca5ff934d7dec49c752
BLAKE2b-256 5e9dabe2962f72ce6fb9c683e3298443659a936ded1789549fd472ede8fd822e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cef093e87d3498b6ddab8d4505cc20a88d023b86f0bda612529e32535e804a25
MD5 c67f6b84711128a8c0f4711cb644ce10
BLAKE2b-256 d28821fc1401d6cbd7b1c1aeb938e5c9b9b23a46596d66d39f4660e8b511476f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77077f62a49df45ed5a184b96e64a995f7cdd86aafec8f4ed39f486e5e8bd430
MD5 f195e6bab0bd54a309893dce32b57d30
BLAKE2b-256 7b9d072f172ec9ffd9f280d64eb40ad88269dd085fddce7db55671acc66a3c90

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 94b0770b155bea7538961479ae5e498ee7fe2eeace3ba6350e8aed6b4ecde22c
MD5 1844fe059c98930beb69112fee0f7221
BLAKE2b-256 b03de422d8b30255fe8d5c1dd4b353e0b7a26fbd2946b39834a1ad19700843a2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8ae1454e400923254fee7b4f9089cfd7fd33a3dae2094b499b003bb85cf69c3d
MD5 6852901df75d03d13d747e015c7316e0
BLAKE2b-256 55b95b76e8f583ab69e7ab23f8a5ffb29aa214cd8a6be7e405f5f446dabe5b9b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7932eb23b03e16fc480563be16cc6f267b44d581ac4f98e09f7d8cdb6464adbf
MD5 d4a7183c2e46880d6425db6344159fdc
BLAKE2b-256 213c3edb8474674de423bcad3278cc1acf2fac62bacba31e63a00cc5cea66aaf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 119913ed835047f5d9d3adf87849a4a480fc4a60859cac051742db9dcc5f6189
MD5 2c697467976853f482b26ecce1d92dae
BLAKE2b-256 5a835ced065d2c8338e3683cf2a99ac47e080e7b07922baf185d6f8280a12621

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9c7e203f534d9bbcaf298c3e72581020fee35857f7e98a0c2d95785db04572fc
MD5 afcbb35ecc7d972a07d43d141d6c6471
BLAKE2b-256 0d10b0e17973a36c9febac152e75d3cac58668f536787723d361bfa0fc0c8f3a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 42162aeb9b9d8ae78f79b803ebe850a752fe099161ae3b480778802c285a1ed6
MD5 5e770ece9de4d8be14316ef8bf86c828
BLAKE2b-256 93288e2b8df63316b05df5f436a3f1b99479a5a6b0cc660718a0c2b9c2beb0c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b2d5568ff65ceabb30864918f29c6c52610df77546910b7dbbc6c5da7cdd1737
MD5 b23d913daf612f7a29b5b17db2cdd38e
BLAKE2b-256 542358303de6399688aabcb4ced6764894caf1404e8c26be24e4e4436317bdf3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3421f0e3d0d4f57c64ba1f297863068e89b8ecdc2781d928603a7cbcff90ac53
MD5 8f7c4e6d12ca545e2b0ce14a88c53543
BLAKE2b-256 a7aec8fc5b34ee5adee7c675308858daa383e6b3685d360b2f03b30c6d7af52d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b573908df1512a9e29d57d0bc01e1ad8de03b7d5823fbf696e2cf5d0d8e73787
MD5 e690029ff9b64e62df442cecb637f67a
BLAKE2b-256 b9670ceb70b628d8a7506db1cdb98d97c050d30addb9542a377606b358535181

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a23911b2769781a3a12c3d02138218273ea69ab2b9273697c84efe4e69e23d5a
MD5 990f84e75e1518d2b1da2b6fed19213f
BLAKE2b-256 2bbe803915dc1ca6c873c65491b2ff8a28991ada2b62a69bd12d981a43e426f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e05e17a8475b5201f158d0566dd27a698b2409835d956c05d5db9e5d74cf0850
MD5 fa6b1f63b44c2d47624d5d137ca93260
BLAKE2b-256 7bbbe2e121791ba31fc727bdd7211d9cd93db616070d1eced150b77b28b4ac3a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e8ee847263009d92da1286cb8cb0877193c84f8f1ebc0c499c80b17a997e5dc
MD5 c3d520e4c515e7cb653fac416516b8ca
BLAKE2b-256 59230a3807529516a12e46a882666bec436e1c52d864ec8924a152ec54d793bf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 aea496133a0da858e328f1e31eae0f0e18f6136199245bb880c142b5d3206424
MD5 e963cd2a7a9fefc367f0cee02c862501
BLAKE2b-256 6ddbd5022cf632318a4850ac8af6d20a511874c2000a2a6000409f3636dc4803

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for protowire_python-1.0.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 cd1a04f9564f8ee36a04cafe14c18e5e5bda085e4fa940538e66141118b4fc17
MD5 02949aa267c4fd9dee1bdb359d60df37
BLAKE2b-256 8a6d59f5ec5dd3e4f4fffdaaca7a15b6a2c3f17cf855c5f67cd77a0afbc4e44a

See more details on using hashes here.

Provenance

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