EmbeddedProto 4.0.0.dev19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. EmbeddedProto/EmbeddedProto.py +63 -0
  2. EmbeddedProto/Field.py +578 -0
  3. EmbeddedProto/Oneof.py +78 -0
  4. EmbeddedProto/ProtoFile.py +188 -0
  5. EmbeddedProto/TypeDefinitions.py +255 -0
  6. EmbeddedProto/__init__.py +0 -0
  7. EmbeddedProto/__main__.py +35 -0
  8. EmbeddedProto/embedded_proto_options_pb2.py +37 -0
  9. EmbeddedProto/main.py +199 -0
  10. EmbeddedProto/templates/FieldBasic_Deserialize.h.jinja2 +33 -0
  11. EmbeddedProto/templates/FieldBasic_GetSet.h.jinja2 +92 -0
  12. EmbeddedProto/templates/FieldBasic_Serialize.h.jinja2 +37 -0
  13. EmbeddedProto/templates/FieldBytes_GetSet.h.jinja2 +86 -0
  14. EmbeddedProto/templates/FieldEnum_Deserialize.h.jinja2 +33 -0
  15. EmbeddedProto/templates/FieldEnum_GetSet.h.jinja2 +86 -0
  16. EmbeddedProto/templates/FieldEnum_Serialize.h.jinja2 +37 -0
  17. EmbeddedProto/templates/FieldErrorRecursive_GetSet.h.jinja2 +36 -0
  18. EmbeddedProto/templates/FieldMsg_Deserialize.h.jinja2 +33 -0
  19. EmbeddedProto/templates/FieldMsg_GetSet.h.jinja2 +100 -0
  20. EmbeddedProto/templates/FieldMsg_Serialize.h.jinja2 +37 -0
  21. EmbeddedProto/templates/FieldRepeated_GetSet.h.jinja2 +95 -0
  22. EmbeddedProto/templates/FieldRepeated_Serialize.h.jinja2 +33 -0
  23. EmbeddedProto/templates/FieldStringBytes_Serialize.h.jinja2 +37 -0
  24. EmbeddedProto/templates/FieldString_GetSet.h.jinja2 +86 -0
  25. EmbeddedProto/templates/Header.h.jinja2 +75 -0
  26. EmbeddedProto/templates/TypeDefEnum.h.jinja2 +35 -0
  27. EmbeddedProto/templates/TypeDefMsg.h.jinja2 +473 -0
  28. EmbeddedProto/templates/TypeOneof.h.jinja2 +180 -0
  29. EmbeddedProto/version.json +3 -0
  30. EmbeddedProto-4.0.0.dev19.dist-info/METADATA +210 -0
  31. EmbeddedProto-4.0.0.dev19.dist-info/RECORD +34 -0
  32. EmbeddedProto-4.0.0.dev19.dist-info/WHEEL +5 -0
  33. EmbeddedProto-4.0.0.dev19.dist-info/entry_points.txt +3 -0
  34. EmbeddedProto-4.0.0.dev19.dist-info/top_level.txt +1 -0
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.1
2
+ Name: EmbeddedProto
3
+ Version: 4.0.0.dev19
4
+ Summary: EmbeddedProto generator
5
+ Author-email: "Embedded AMS B.V." <info@EmbeddedAMS.nl>
6
+ License: GPL-3.0 for Open Source projects, a Property license for Commercial companies.
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: Jinja2 <4,>=3
10
+ Requires-Dist: MarkupSafe <3,>=2.0
11
+ Requires-Dist: six <2,>=1.16.0
12
+ Requires-Dist: toposort <2,>=1.7
13
+ Requires-Dist: protobuf ==5.27.2
14
+ Requires-Dist: grpcio-tools ==1.66.0
15
+
16
+
17
+ ![alt text](https://embeddedproto.com/wp-content/uploads/2022/04/Embedded_Proto.png "Embedded Proto Logo")
18
+
19
+
20
+ Embedded Proto is a product of Embedded AMS B.V. For more information about Embedded Proto please visit [EmbeddedProto.com](https://EmbeddedProto.com).
21
+
22
+ Copyrights 2020-2024 Embedded AMS B.V., [www.EmbeddedAMS.nl](https://www.EmbeddedAMS.nl), [info@EmbeddedAMS.nl](mailto:info@EmbeddedAMS.nl)
23
+
24
+
25
+ # Introduction
26
+
27
+ Embedded Proto is a C++ implementation of [Google Protocol Buffers](https://developers.google.com/protocol-buffers/) dedicated to microcontrollers. The implementation focuses on a small footprint and low memory usage. No dynamic memory allocation is used to make the code predictable. Unit tests and static code analysis are used to improve the reliability of the code.
28
+
29
+ Natively, protocol buffers are not suitable for microcontrollers. The C++ generated is written for server and desktop processors. This is where Embedded offers a solution. Embedded Proto is a plugin for *protoc* generating C++ code suitable for microcontrollers. In this way, Embedded Proto provides an easy-to-use interface to exchange data between embedded devices and the outside world. Specify the data format between your IoT device and other devices, servers, apps, or desktop applications in a standardized way!
30
+
31
+ This document details the following:
32
+ * What is new
33
+ * License
34
+ * Installation
35
+ * Usage
36
+ * Supported Features
37
+ * Examples
38
+ * Development
39
+
40
+
41
+ # What is new
42
+
43
+ To stay up to date, signup for our [User Update](https://EmbeddedProto.com/signup).
44
+
45
+ ## 3.5.3
46
+ * Fixed build problems in release 3.5.3.
47
+
48
+ ## 3.5.2
49
+ * Updated to Protobuf version 27.1.
50
+
51
+ ## 3.5.1
52
+ * Updated to Protobuf version 26.1.
53
+
54
+ ## 3.5.0
55
+ * Bub fix related to optional string or bytes fields. They where not check to be set or not.
56
+ * Small interface change in RepeatedField class to use correct array index type. Tjos is a possible breaking change when you derived from the RepeatedField.
57
+ * Support for spaces in folder names on Windows.
58
+ * Started reworking the company internal toolchain.
59
+
60
+ ## 3.4.0
61
+ * In the background the installation switched to using Python SetupTools (thanks to the contributors). In the future we would like to use Pip for the installation.
62
+ * Problems with non-matching versions have been addressed. You now get a warning which allows you to continue even if the version does not match exactly.
63
+ * Added some useful command line options to the setup script.
64
+
65
+ ## 3.3.0
66
+ * Added a to_string function for debugging (see [documentation](https://embeddedproto.com/documentation/to-string/)).
67
+ * Added getter functions which will return an error for index out of bounds cases.
68
+ * Bug fix the toposorting algo for nested message definitions.
69
+
70
+ ## 3.2.0
71
+ The most notable improvements in this version are:
72
+ * Updated to protobuf v21.5. The python module made by Google for this version is not backwards compatible. Please update your protoc installation!
73
+ * Wrote a python setup script instead of separate scripts for Linux and Windows.
74
+ * Added simple implementations of the ReadBufferInterface and WriteBufferInterface: ReadBufferFixedSize and WriteBufferFixedSize.
75
+
76
+ ## 3.1.0
77
+ The most notable improvements in this version are:
78
+ * Reworked code to extend the support back to C++11.
79
+ * Worked on optimizing running the code coverage in Sonarqube.
80
+
81
+ ## 3.0.0
82
+ The most notable improvements in this version are:
83
+ * The length of repeated, string and bytes fields can now be set from the .proto file. You can find information on how to do this in the online [documentation](https://embeddedproto.com/documentation/using-a-message/repeated-fields/).
84
+ * The ram size of messages has been reduced. This was done by using less polymorphism in the low-level field classes. This required upgrading to C++17 and up.
85
+ * In a .proto file, it is now possible to use a message or enum before it is defined. The plugin will make a dependency tree of the messages and enums defined and sort them before generating the source code. Recursive inclusion is not supported.
86
+ * Some of the message functions changed. The functions were already marked as deprecated in the latest 2.X.X release.
87
+
88
+
89
+ # License
90
+
91
+ Embedded Proto uses a dual licensing model. One for open source projects and one for commercial usage.
92
+
93
+ ## Open Source
94
+ You can use Embedded Proto for free in open source projects or for testing. However, on demand support is not available only if you have a commercial license. For open source projects, you can download the source code from Github. The code is licensed under the GNU General Public License V3.0, which you can use for all your non-commercial projects.
95
+
96
+ ## Commercial License
97
+ Are you developing a commercial product? If so, you need to buy a commercial license from Embedded Proto. There is a suitable license for each type of business, from startup to enterprise. Depending on the license, it may give you access to the following:
98
+ * An unlimited number of mcu’s
99
+ * Professional support
100
+ * Code quality report
101
+
102
+ You can request more information about a commercial license on our [website](https://embeddedproto.com/pricing).
103
+
104
+
105
+ # Installation
106
+
107
+ What is required to be able to generate source files based on .proto files:
108
+ 1. Python 3.8 and up
109
+ 2. Pip
110
+ 3. Protobuf v21.5 and up (tested with v26.1)
111
+ 4. Git
112
+
113
+ After installing the requirements, continue by cloning the Embedded Proto repo. We advised using Embedded Proto as a submodule in your project. This way, you can track the version of Embedded Proto with the version of your project.
114
+ ```bash
115
+ cd your_project_dir
116
+ git submodule add https://github.com/Embedded-AMS/EmbeddedProto.git
117
+ git commit -m "Added the latest version of Embedded Proto as a submodule."
118
+ ```
119
+ Next, enter the Embedded Proto folder and run the setup script. The script will create a self-contained python environment. In this environment, various python packages will be installed, which are required by Embedded Proto.
120
+ ```bash
121
+ cd EmbeddedProto
122
+ python setup.py
123
+ ```
124
+ Did you install protoc in a custom folder, or is the include folder of protobuf not in your path? In these cases, you may get an error from the setup script. You have to provide the location of the include with the --include parameter:
125
+ ```bash
126
+ python setup.py --include ~/protobuf/protoc-21.5/include
127
+ ```
128
+ In this example, you have installed a specific version of protoc, and you named its installation folder `~/protobuf/protoc-21.5`.
129
+
130
+ You can check out latest the command line parameters of the setup script using the help parameter:
131
+ ```bash
132
+ python setup.py --help
133
+ ```
134
+
135
+ More installation documentation can be found on the [documentation website](https://embeddedproto.com/documentation/installation/).
136
+
137
+
138
+ # Usage
139
+
140
+ You write your proto files defining the message structure when working on your project. Next, you would like to use them in your source code. Generating the code based on your message definitions is required. Please do this by using our plugin for the protoc compiler protoc-gen-eams.py. Generate the code using the following command:
141
+
142
+ On Linux:
143
+ ```bash
144
+ protoc --plugin=protoc-gen-eams -I./LOCATION/PROTO/FILES --eams_out=./generated_src PROTO_MESSAGE_FILE.proto
145
+ ```
146
+ On Windows:
147
+ ```bash
148
+ protoc --plugin=protoc-gen-eams=protoc-gen-eams.bat -I.\LOCATION\PROTO\FILES --eams_out=.\generated_src PROTO_MESSAGE_FILE.proto
149
+ ```
150
+
151
+ Protoc is instructed to use our plugin with the option --plugin. The standard option -I includes the folder where your \*.proto files are located. The option --eams_out specifies where to store the generated source code. Finally, the protofile to be parsed is specified.
152
+
153
+ As our plugin is a Python script and the protoc plugin should be an executable, a small terminal script is included. This terminal script is called protoc-gen-eams and is used to execute python with the Embedded Proto python script as a parameter. The main takeaway is that this script should be accessible when running your protoc command.
154
+
155
+ After running protoc without errors, the generated source code is located in the folder specified by -eams_out. You have to include two folders in your toolchain:
156
+ * The folder you specified with -eams_out, and
157
+ * The source code of Embedded Proto is located in EmbeddedProto/src.
158
+ * When building do not for get to pass `-lstdc++` to the linker. This to prevent errors like: `undefined reference to`.
159
+
160
+
161
+ # Examples
162
+
163
+ Our website hosts an array of [examples](https://embeddedproto.com/examples/) detailing possible use cases and tutorials on toolchain integrations. This includes:
164
+ * [A Command and Control structure](https://EmbeddedProto.com/a-simple-uart-example-with-embedded-proto/),
165
+ * [Ethernet Communication](https://EmbeddedProto.com/mbed-example-with-embedded-proto/),
166
+ * and [Makefile integration](https://EmbeddedProto.com/how-to-set-up-a-project-with-embeddedproto-using-makefiles).
167
+
168
+
169
+ # Supported Features
170
+
171
+ Below two tables indicate the level of support for various variable types and features.
172
+
173
+ | Variable Type | Support |
174
+ | --- | --- |
175
+ double | Full
176
+ float | Full
177
+ int32 | Full
178
+ int64 | Full
179
+ uint32 | Full
180
+ uint64 | Full
181
+ sint32 | Full
182
+ sint64 | Full
183
+ fixed32 | Full
184
+ fixed64 | Full
185
+ sfixed32 | Full
186
+ sfixed64 | Full
187
+ bool | Full
188
+ string | Length fixed via template or custom option
189
+ bytes | Length fixed via template or custom option
190
+
191
+ | Feature | Support |
192
+ | --- | --- |
193
+ Enum | Full
194
+ Messages as variables | Full
195
+ Defining messages in messages | Minimal
196
+ oneof | Full
197
+ singular | Full
198
+ repeated | Length fixed via template or custom option
199
+ optional | Full
200
+
201
+ All features mentioned above are of version proto3. At this moment, proto2 is not supported. Taken from the Protobuf website:
202
+ > Prefer proto3 while proto2 will continue to be supported, we encourage new codes to use proto3 instead, which is easier to use and supports more languages.
203
+ For this reason, it is unlikely that Embedded Proto will support proto2 in the future.
204
+
205
+
206
+ # Development
207
+
208
+ If you consider helping with the development of Embedded Proto please consider reading [this](https://embeddedproto.com/documentation/installation/#for-embedded-proto-developers). It details how you can build the unit tests included in this repo.
209
+
210
+
@@ -0,0 +1,34 @@
1
+ EmbeddedProto/EmbeddedProto.py,sha256=37hsNC1TXw2A0bUtRubQYwp1_mv0BlSgCnq_EtUepew,1907
2
+ EmbeddedProto/Field.py,sha256=D39cNOLWhhrPSNBhobzo3jBLS0IfFCvwJhmRU79yTVQ,24919
3
+ EmbeddedProto/Oneof.py,sha256=2Dmj2wo_ntYtNQkOZN2uL9AUTzLsJ-TFuktOuB6ACt0,2655
4
+ EmbeddedProto/ProtoFile.py,sha256=HcW_h6V6v3mZ50Gg08nh7mEu-lgqUsRlz_XJTN8a84w,7570
5
+ EmbeddedProto/TypeDefinitions.py,sha256=TH_D0do6MmYZBWKpZziAHAfPiAAdnd0JavAhNjtvuKI,10171
6
+ EmbeddedProto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ EmbeddedProto/__main__.py,sha256=MX5v7_1LQCIAGIT0Q0zKmynSXYdAFsc7kkegM-K5X78,1017
8
+ EmbeddedProto/embedded_proto_options_pb2.py,sha256=m1I_aBIPWvzE9rbxtuXHs4ilP1pcfYqX26qH4WkhLmU,1552
9
+ EmbeddedProto/main.py,sha256=-U5AGmFMq0IOIO1-5SpuZ2JYoabNLumPgPL8JnfhgwM,8296
10
+ EmbeddedProto/version.json,sha256=hjycBAehgyvQJPZeUu0jPL7jjQpn4nleYB2KKGRq66M,24
11
+ EmbeddedProto/templates/FieldBasic_Deserialize.h.jinja2,sha256=fd8kebuDYx09Hm27Zq85Izf78jIYZHK1j1E96DXChuA,1173
12
+ EmbeddedProto/templates/FieldBasic_GetSet.h.jinja2,sha256=PmYjXEn869mzB7h8q00pZSIBJQA_mUjS6drfGmnZJwE,3994
13
+ EmbeddedProto/templates/FieldBasic_Serialize.h.jinja2,sha256=XafMfUn1hF9giqPWbAOlBU0ouCmXTMxXqoC7aJCnqZk,1426
14
+ EmbeddedProto/templates/FieldBytes_GetSet.h.jinja2,sha256=lpndYxzXvdEwof749DRll3xrPzya_W-vbTbssxW9Eps,3501
15
+ EmbeddedProto/templates/FieldEnum_Deserialize.h.jinja2,sha256=fd8kebuDYx09Hm27Zq85Izf78jIYZHK1j1E96DXChuA,1173
16
+ EmbeddedProto/templates/FieldEnum_GetSet.h.jinja2,sha256=5GGiagx07_HPFPmdGszTLFBHIWWAHfda38sIw3-qdJI,3618
17
+ EmbeddedProto/templates/FieldEnum_Serialize.h.jinja2,sha256=xHml24wBrCaJLbj9g31VwrA0EhbzdOZOyQ8dzs0LBWE,1425
18
+ EmbeddedProto/templates/FieldErrorRecursive_GetSet.h.jinja2,sha256=gHpLxuH3P_tuhUKOPXgIQrj2NvYO8nTYPSw01JwY6qE,1505
19
+ EmbeddedProto/templates/FieldMsg_Deserialize.h.jinja2,sha256=fd8kebuDYx09Hm27Zq85Izf78jIYZHK1j1E96DXChuA,1173
20
+ EmbeddedProto/templates/FieldMsg_GetSet.h.jinja2,sha256=uiqnV9Qddl2fo1OEDAx2Q7hubDXH8tYRFdGR-X3rzVA,4177
21
+ EmbeddedProto/templates/FieldMsg_Serialize.h.jinja2,sha256=hB7sTC2v-wK0v4u45Hne7baZ3ouyOAkpl3Y74Auc59w,1349
22
+ EmbeddedProto/templates/FieldRepeated_GetSet.h.jinja2,sha256=rMeNTnSbNrlzFNBHDyFlfixlUy1T25_EBKtSDWtdnaU,4148
23
+ EmbeddedProto/templates/FieldRepeated_Serialize.h.jinja2,sha256=Zwf7KeSAGy0IPMZcwFO0DNzPT-cho78po34w_AfryEo,1186
24
+ EmbeddedProto/templates/FieldStringBytes_Serialize.h.jinja2,sha256=RBJvsBMjZ-Hl5jfEUug-H7pDD5D1boTy4_pVgykmcOc,1350
25
+ EmbeddedProto/templates/FieldString_GetSet.h.jinja2,sha256=1y2cK_TZe3bdlMw4MWIhpfwfaKFuAqgigaIgdP_MHJg,3498
26
+ EmbeddedProto/templates/Header.h.jinja2,sha256=5IF3OvIbkIXVb98Ou_2tsvA2eXXe5xnQWf0yE_M1Zfk,2161
27
+ EmbeddedProto/templates/TypeDefEnum.h.jinja2,sha256=aHegylEzO3XZVk7Uo3uMed3RJuok47nNCnJauAylROY,1073
28
+ EmbeddedProto/templates/TypeDefMsg.h.jinja2,sha256=wJREUUBovzHa2n9Q0wsxevyJI81Mz4qMfpiB_uh-dBE,16171
29
+ EmbeddedProto/templates/TypeOneof.h.jinja2,sha256=o5g47-QNmUPHdAaj5Tx9213YYEYjoJoNnYjs9YTckZ4,5634
30
+ EmbeddedProto-4.0.0.dev19.dist-info/METADATA,sha256=hYv6XGVu6OKnjr-EMZ-B7BjbDsfOO0o9iP8HDA9cxNg,10576
31
+ EmbeddedProto-4.0.0.dev19.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
32
+ EmbeddedProto-4.0.0.dev19.dist-info/entry_points.txt,sha256=c2cfpgUY2tsYkCzdZa9MBEGLTLMuvdQrmeN1QSFT5Do,122
33
+ EmbeddedProto-4.0.0.dev19.dist-info/top_level.txt,sha256=HcDH36f9DdgjQ3nTH-g-f2MbzKRaE9HhxwqDoU77BSs,14
34
+ EmbeddedProto-4.0.0.dev19.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (74.1.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ embeddedproto = EmbeddedProto.EmbeddedProto:run_protoc
3
+ protoc-gen-eams = EmbeddedProto.main:main_plugin
@@ -0,0 +1 @@
1
+ EmbeddedProto