pw_rpc: Remove generated Python packet proto
This removes the generated packet proto code that was checked in and
replaces it with the proto package generated by the build.
Change-Id: I640f7e55cbd759af1672702597f15fe19fd968d5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/26702
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
diff --git a/pw_rpc/py/BUILD.gn b/pw_rpc/py/BUILD.gn
index e80ccbf..1a2d1e9 100644
--- a/pw_rpc/py/BUILD.gn
+++ b/pw_rpc/py/BUILD.gn
@@ -27,7 +27,6 @@
"pw_rpc/codegen_raw.py",
"pw_rpc/descriptors.py",
"pw_rpc/ids.py",
- "pw_rpc/packet_pb2.py",
"pw_rpc/packets.py",
"pw_rpc/plugin.py",
"pw_rpc/plugin_nanopb.py",
@@ -41,8 +40,11 @@
"packets_test.py",
]
python_deps = [
+ "$dir_pw_build/py",
+ "$dir_pw_protobuf/py",
"$dir_pw_protobuf_compiler/py",
"$dir_pw_status/py",
+ "..:protos.python",
]
python_test_deps = [ "$dir_pw_build/py" ]
pylintrc = "$dir_pigweed/.pylintrc"
diff --git a/pw_rpc/py/callback_client_test.py b/pw_rpc/py/callback_client_test.py
index 2b49545..e9a675a 100755
--- a/pw_rpc/py/callback_client_test.py
+++ b/pw_rpc/py/callback_client_test.py
@@ -19,9 +19,10 @@
from typing import List, Tuple
from pw_protobuf_compiler import python_protos
+from pw_rpc_protos import packet_pb2
from pw_status import Status
-from pw_rpc import callback_client, client, packet_pb2, packets
+from pw_rpc import callback_client, client, packets
TEST_PROTO_1 = """\
syntax = "proto3";
diff --git a/pw_rpc/py/client_test.py b/pw_rpc/py/client_test.py
index 097e0e9..181bd0e 100755
--- a/pw_rpc/py/client_test.py
+++ b/pw_rpc/py/client_test.py
@@ -16,11 +16,11 @@
import unittest
+from pw_rpc_protos.packet_pb2 import RpcPacket
from pw_protobuf_compiler import python_protos
from pw_status import Status
from pw_rpc import callback_client, client, packets
-from pw_rpc.packet_pb2 import RpcPacket
import pw_rpc.ids
TEST_PROTO_1 = """\
diff --git a/pw_rpc/py/packets_test.py b/pw_rpc/py/packets_test.py
index a58c194..acdd40a 100755
--- a/pw_rpc/py/packets_test.py
+++ b/pw_rpc/py/packets_test.py
@@ -17,9 +17,9 @@
import unittest
from pw_status import Status
+from pw_rpc_protos.packet_pb2 import RpcPacket
from pw_rpc import packets
-from pw_rpc.packet_pb2 import RpcPacket
_TEST_REQUEST = RpcPacket(type=packets.PacketType.REQUEST,
channel_id=1,
diff --git a/pw_rpc/py/pw_rpc/client.py b/pw_rpc/py/pw_rpc/client.py
index 3661214..c5ca88d 100644
--- a/pw_rpc/py/pw_rpc/client.py
+++ b/pw_rpc/py/pw_rpc/client.py
@@ -19,10 +19,10 @@
from typing import Collection, Dict, Iterable, Iterator, List, NamedTuple
from typing import Optional
+from pw_rpc_protos.packet_pb2 import RpcPacket
from pw_status import Status
from pw_rpc import descriptors, packets
-from pw_rpc.packet_pb2 import RpcPacket
from pw_rpc.packets import PacketType
from pw_rpc.descriptors import Channel, Service, Method
diff --git a/pw_rpc/py/pw_rpc/packet_pb2.py b/pw_rpc/py/pw_rpc/packet_pb2.py
deleted file mode 100644
index a86d53c..0000000
--- a/pw_rpc/py/pw_rpc/packet_pb2.py
+++ /dev/null
@@ -1,168 +0,0 @@
-# [Pigweed] This file is a checked-in version of a generated protobuf module.
-# TODO(pwbug/239) Implement the pw_protobuf_package GN template and Python
-# proto generation, then delete this file.
-
-# pylint: skip-file
-
-# type: ignore
-
-# yapf: disable
-
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: pw_rpc/pw_rpc_protos/packet.proto
-
-import sys
-_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
-from google.protobuf.internal import enum_type_wrapper
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name='pw_rpc/pw_rpc_protos/packet.proto',
- package='pw.rpc.internal',
- syntax='proto3',
- serialized_options=None,
- serialized_pb=_b('\n!pw_rpc/pw_rpc_protos/packet.proto\x12\x0fpw.rpc.internal\"\x92\x01\n\tRpcPacket\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.pw.rpc.internal.PacketType\x12\x12\n\nchannel_id\x18\x02 \x01(\r\x12\x12\n\nservice_id\x18\x03 \x01(\x07\x12\x11\n\tmethod_id\x18\x04 \x01(\x07\x12\x0f\n\x07payload\x18\x05 \x01(\x0c\x12\x0e\n\x06status\x18\x06 \x01(\r*\x93\x01\n\nPacketType\x12\x0b\n\x07REQUEST\x10\x00\x12\x15\n\x11\x43LIENT_STREAM_END\x10\x02\x12\x10\n\x0c\x43LIENT_ERROR\x10\x04\x12\x18\n\x14\x43\x41NCEL_SERVER_STREAM\x10\x06\x12\x0c\n\x08RESPONSE\x10\x01\x12\x15\n\x11SERVER_STREAM_END\x10\x03\x12\x10\n\x0cSERVER_ERROR\x10\x05\x62\x06proto3')
-)
-
-_PACKETTYPE = _descriptor.EnumDescriptor(
- name='PacketType',
- full_name='pw.rpc.internal.PacketType',
- filename=None,
- file=DESCRIPTOR,
- values=[
- _descriptor.EnumValueDescriptor(
- name='REQUEST', index=0, number=0,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='CLIENT_STREAM_END', index=1, number=2,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='CLIENT_ERROR', index=2, number=4,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='CANCEL_SERVER_STREAM', index=3, number=6,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='RESPONSE', index=4, number=1,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='SERVER_STREAM_END', index=5, number=3,
- serialized_options=None,
- type=None),
- _descriptor.EnumValueDescriptor(
- name='SERVER_ERROR', index=6, number=5,
- serialized_options=None,
- type=None),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=204,
- serialized_end=351,
-)
-_sym_db.RegisterEnumDescriptor(_PACKETTYPE)
-
-PacketType = enum_type_wrapper.EnumTypeWrapper(_PACKETTYPE)
-REQUEST = 0
-CLIENT_STREAM_END = 2
-CLIENT_ERROR = 4
-CANCEL_SERVER_STREAM = 6
-RESPONSE = 1
-SERVER_STREAM_END = 3
-SERVER_ERROR = 5
-
-
-
-_RPCPACKET = _descriptor.Descriptor(
- name='RpcPacket',
- full_name='pw.rpc.internal.RpcPacket',
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- fields=[
- _descriptor.FieldDescriptor(
- name='type', full_name='pw.rpc.internal.RpcPacket.type', index=0,
- number=1, type=14, cpp_type=8, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- _descriptor.FieldDescriptor(
- name='channel_id', full_name='pw.rpc.internal.RpcPacket.channel_id', index=1,
- number=2, type=13, cpp_type=3, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- _descriptor.FieldDescriptor(
- name='service_id', full_name='pw.rpc.internal.RpcPacket.service_id', index=2,
- number=3, type=7, cpp_type=3, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- _descriptor.FieldDescriptor(
- name='method_id', full_name='pw.rpc.internal.RpcPacket.method_id', index=3,
- number=4, type=7, cpp_type=3, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- _descriptor.FieldDescriptor(
- name='payload', full_name='pw.rpc.internal.RpcPacket.payload', index=4,
- number=5, type=12, cpp_type=9, label=1,
- has_default_value=False, default_value=_b(""),
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- _descriptor.FieldDescriptor(
- name='status', full_name='pw.rpc.internal.RpcPacket.status', index=5,
- number=6, type=13, cpp_type=3, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None,
- serialized_options=None, file=DESCRIPTOR),
- ],
- extensions=[
- ],
- nested_types=[],
- enum_types=[
- ],
- serialized_options=None,
- is_extendable=False,
- syntax='proto3',
- extension_ranges=[],
- oneofs=[
- ],
- serialized_start=55,
- serialized_end=201,
-)
-
-_RPCPACKET.fields_by_name['type'].enum_type = _PACKETTYPE
-DESCRIPTOR.message_types_by_name['RpcPacket'] = _RPCPACKET
-DESCRIPTOR.enum_types_by_name['PacketType'] = _PACKETTYPE
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-RpcPacket = _reflection.GeneratedProtocolMessageType('RpcPacket', (_message.Message,), {
- 'DESCRIPTOR' : _RPCPACKET,
- '__module__' : 'pw_rpc.pw_rpc_protos.packet_pb2'
- # @@protoc_insertion_point(class_scope:pw.rpc.internal.RpcPacket)
- })
-_sym_db.RegisterMessage(RpcPacket)
-
-
-# @@protoc_insertion_point(module_scope)
diff --git a/pw_rpc/py/pw_rpc/packet_pb2.pyi b/pw_rpc/py/pw_rpc/packet_pb2.pyi
deleted file mode 100644
index e13b07d..0000000
--- a/pw_rpc/py/pw_rpc/packet_pb2.pyi
+++ /dev/null
@@ -1,76 +0,0 @@
-# @generated by generate_proto_mypy_stubs.py. Do not edit!
-import sys
-from google.protobuf.descriptor import (
- Descriptor as google___protobuf___descriptor___Descriptor,
- EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
- FileDescriptor as google___protobuf___descriptor___FileDescriptor,
-)
-
-from google.protobuf.internal.enum_type_wrapper import ( # type: ignore
- _EnumTypeWrapper as google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper,
-)
-
-from google.protobuf.message import (
- Message as google___protobuf___message___Message,
-)
-
-from typing import (
- NewType as typing___NewType,
- Optional as typing___Optional,
- cast as typing___cast,
-)
-
-from typing_extensions import (
- Literal as typing_extensions___Literal,
-)
-
-
-builtin___bool = bool
-builtin___bytes = bytes
-builtin___float = float
-builtin___int = int
-
-
-DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...
-
-PacketTypeValue = typing___NewType('PacketTypeValue', builtin___int)
-type___PacketTypeValue = PacketTypeValue
-PacketType: _PacketType
-class _PacketType(google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper[PacketTypeValue]):
- DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ...
- REQUEST = typing___cast(PacketTypeValue, 0)
- CLIENT_STREAM_END = typing___cast(PacketTypeValue, 2)
- CLIENT_ERROR = typing___cast(PacketTypeValue, 4)
- CANCEL_SERVER_STREAM = typing___cast(PacketTypeValue, 6)
- RESPONSE = typing___cast(PacketTypeValue, 1)
- SERVER_STREAM_END = typing___cast(PacketTypeValue, 3)
- SERVER_ERROR = typing___cast(PacketTypeValue, 5)
-REQUEST = typing___cast(PacketTypeValue, 0)
-CLIENT_STREAM_END = typing___cast(PacketTypeValue, 2)
-CLIENT_ERROR = typing___cast(PacketTypeValue, 4)
-CANCEL_SERVER_STREAM = typing___cast(PacketTypeValue, 6)
-RESPONSE = typing___cast(PacketTypeValue, 1)
-SERVER_STREAM_END = typing___cast(PacketTypeValue, 3)
-SERVER_ERROR = typing___cast(PacketTypeValue, 5)
-type___PacketType = PacketType
-
-class RpcPacket(google___protobuf___message___Message):
- DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
- type: type___PacketTypeValue = ...
- channel_id: builtin___int = ...
- service_id: builtin___int = ...
- method_id: builtin___int = ...
- payload: builtin___bytes = ...
- status: builtin___int = ...
-
- def __init__(self,
- *,
- type : typing___Optional[type___PacketTypeValue] = None,
- channel_id : typing___Optional[builtin___int] = None,
- service_id : typing___Optional[builtin___int] = None,
- method_id : typing___Optional[builtin___int] = None,
- payload : typing___Optional[builtin___bytes] = None,
- status : typing___Optional[builtin___int] = None,
- ) -> None: ...
- def ClearField(self, field_name: typing_extensions___Literal[u"channel_id",b"channel_id",u"method_id",b"method_id",u"payload",b"payload",u"service_id",b"service_id",u"status",b"status",u"type",b"type"]) -> None: ...
-type___RpcPacket = RpcPacket
diff --git a/pw_rpc/py/pw_rpc/packets.py b/pw_rpc/py/pw_rpc/packets.py
index dca5a10..6c53570 100644
--- a/pw_rpc/py/pw_rpc/packets.py
+++ b/pw_rpc/py/pw_rpc/packets.py
@@ -14,8 +14,8 @@
"""Functions for working with pw_rpc packets."""
from google.protobuf import message
+from pw_rpc_protos import packet_pb2
from pw_status import Status
-from pw_rpc import packet_pb2
DecodeError = message.DecodeError
Message = message.Message