CodeSampleX

サンプル

protobuf 7.35.1: Build dynamic proto3 message classes without protoc while preserving field presence and 64-bit values through binary and JSON round trips

検証済みサンプル — pypi protobuf 7.35.1: Build dynamic proto3 message classes without protoc while preserving field presence and 64-bit values through binary and…

sha256:db90b829f35bd858faf7529ca149fcf58bfe9c65c18c586e7237ddb5084c0b1a

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 python 3.12 linux alpine · musl x64 python 3.12 python 3.12 pip

検証実行環境

環境 コントラクト ステージ 実行日
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-16
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

ケース

HOW
ゴール
Build dynamic proto3 message classes without protoc while preserving field presence and 64-bit values through binary and JSON round trips
パッケージ
シンボル
  • google.protobuf.descriptor_pb2.FileDescriptorProto
  • google.protobuf.descriptor_pool.DescriptorPool.Add
  • google.protobuf.descriptor_pool.DescriptorPool.FindFileByName
  • google.protobuf.descriptor_pool.DescriptorPool.FindMessageTypeByName
  • google.protobuf.message_factory.GetMessageClass
  • google.protobuf.message.Message.HasField
  • google.protobuf.message.Message.SerializeToString
  • google.protobuf.message.Message.ParseFromString
  • google.protobuf.json_format.MessageToDict
  • google.protobuf.json_format.ParseDict
環境
python 3.12
作成日
2026-08-17T02:15:34Z

コントラクト

  1. DescriptorPool.Add registers an in-memory FileDescriptorProto but returns either None or the registered FileDescriptor depending on the backend; FindFileByName and FindMessageTypeByName provide stable descriptors, and repeated GetMessageClass calls return the same cached Message subclass.
  2. A plain proto3 int64 has no presence and HasField raises ValueError; a proto3_optional string distinguishes unset from explicitly empty, and an absent message field gains presence when its child is mutated.
  3. Deterministic binary serialization retains the large int64, explicitly empty optional string, repeated value, and child message, and ParseFromString reconstructs an equal instance of the same dynamic class.
  4. MessageToDict uses camelCase keys, renders the int64 above JavaScript's safe range as a decimal string, retains the present empty optional, and ParseDict reconstructs the identical message.
  5. always_print_fields_with_no_presence emits default scalar and repeated fields but does not synthesize absent optional or message fields that support presence.

ファイル

  • NOTES.md
  • csx.json
  • requirements.lock
  • requirements.txt
  • test/contract.py

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed