Skip to content

Commit 5c47eae

Browse files
committed
deploy: 1e51d8c
1 parent a05aa02 commit 5c47eae

File tree

9 files changed

+41
-22
lines changed

9 files changed

+41
-22
lines changed

getting-started/pythontutorial/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
application’s source code lives – the current directory is used if you
128128
don’t provide a value), the destination directory (where you want the
129129
generated code to go; often the same as <code>$SRC_DIR</code>), and the path to your
130-
<code>.proto</code>. In this case, you&mldr;:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>protoc -I<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>$SRC_DIR</span> --python_out<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>$DST_DIR</span> <span style=color:#000>$SRC_DIR</span>/addressbook.proto
130+
<code>.proto</code>. In this case, you&mldr;:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>protoc --proto_path<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>$SRC_DIR</span> --python_out<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>$DST_DIR</span> <span style=color:#000>$SRC_DIR</span>/addressbook.proto
131131
</span></span></code></pre></div><p>Because you want Python classes, you use the <code>--python_out</code> option &ndash;
132132
similar options are provided for other supported languages.</p><p>Protoc is also able to generate python stubs (<code>.pyi</code>) with <code>--pyi_out</code>.</p></li></ol><p>This generates <code>addressbook_pb2.py</code> (or <code>addressbook_pb2.pyi</code>) in your specified
133133
destination directory.</p><h2 id=protobuf-api>The Protocol Buffer API</h2><p>Unlike when you generate Java and C++ protocol buffer code, the Python protocol

programming-guides/enum/index.html

Lines changed: 18 additions & 3 deletions
Large diffs are not rendered by default.

programming-guides/proto-limits/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
specs.</p><h2 id=enum>Number of Values in an Enum</h2><p>The lowest limit is ~1700 values, in Java (fix available
1414
go/java-large-enum-support). Other languages have different limits.</p><h2 id=total>Total Size of the Message</h2><p>Any proto in serialized form must be &lt;2GiB, as that is the maximum size
1515
supported by all implementations. It&rsquo;s recommended to bound request and response
16-
sizes.</p><h2 id=depth>Depth Limit for Proto Unmarshaling</h2><ul><li>Java: 100</li><li>C++: 100</li><li>Go:
16+
sizes.</p><h2 id=depth>Depth Limit for Proto Unmarshaling</h2><ul><li>Java:
17+
100</li><li>C++:
18+
100</li><li>Go:
1719
10000
1820
(there is a plan to reduce this to 100)</li></ul><p>If you try to unmarshal a message that is nested deeper than the depth limit,
1921
the unmarshaling will fail.</p></div></main></div></div><footer class="bg-dark py-5 row d-print-none"><div class="container-fluid mx-sm-5"><div class=row><div class="col-6 col-sm-4 text-xs-center order-sm-2"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Stack Overflow" aria-label="Stack Overflow"><a class=text-white target=_blank rel=noopener href=https://stackoverflow.com/questions/tagged/protocol-buffers aria-label="Stack Overflow"><i class="fab fa-stack-overflow"></i></a></li></ul><script type=text/javascript id=cookiebanner src=https://cdn.jsdelivr.net/gh/dobarkod/[email protected]/dist/cookiebanner.min.js data-height=50px data-message="Protobuf.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic." data-bg=#ffb data-fg=#000 data-position=bottom data-padding="10px 16px" data-close-text="OK, got it" data-font-size=18px data-moreinfo=https://policies.google.com/technologies/cookies></script></div><div class="col-6 col-sm-4 text-right text-xs-center order-sm-3"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=GitHub aria-label=GitHub><a class=text-white target=_blank rel=noopener href=https://github.com/protocolbuffers/protobuf aria-label=GitHub><i class="fab fa-github"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Developer mailing list" aria-label="Developer mailing list"><a class=text-white target=_blank rel=noopener href=https://groups.google.com/g/protobuf aria-label="Developer mailing list"><i class="fa fa-envelope"></i></a></li></ul><script type=text/javascript id=cookiebanner src=https://cdn.jsdelivr.net/gh/dobarkod/[email protected]/dist/cookiebanner.min.js data-height=50px data-message="Protobuf.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic." data-bg=#ffb data-fg=#000 data-position=bottom data-padding="10px 16px" data-close-text="OK, got it" data-font-size=18px data-moreinfo=https://policies.google.com/technologies/cookies></script></div><div class="col-12 col-sm-4 text-center py-2 order-sm-2"><small class=text-white>&copy; 2024 Google LLC All Rights Reserved</small>

programming-guides/proto2/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@
240240
special <code>EnumDescriptor</code> class for Python that&rsquo;s used to create a set of
241241
symbolic constants with integer values in the runtime-generated class.</p><div class="alert alert-warning" role=alert><h4 class=alert-heading>Important</h4>The
242242
generated code may be subject to language-specific limitations on the number of
243-
enumerators (low thousands for one language). Review the limitations for the
244-
languages you plan to use.</div><div class="alert alert-warning" role=alert><h4 class=alert-heading>Important</h4>For
243+
enumerators (low thousands for one language). Review the
244+
limitations for the languages you plan to use.</div><div class="alert alert-warning" role=alert><h4 class=alert-heading>Important</h4>For
245245
information on how enums should work contrasted with how they currently work in
246246
different languages, see
247247
<a href=/programming-guides/enum>Enum Behavior</a>.</div><p>Removing enum values is a breaking change for persisted protos. Instead of

programming-guides/proto3/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@
255255
special <code>EnumDescriptor</code> class for Python that&rsquo;s used to create a set of
256256
symbolic constants with integer values in the runtime-generated class.</p><div class="alert alert-warning" role=alert><h4 class=alert-heading>Important</h4>The
257257
generated code may be subject to language-specific limitations on the number of
258-
enumerators (low thousands for one language). Review the limitations for the
259-
languages you plan to use.</div><p>During deserialization, unrecognized enum values will be preserved in the
258+
enumerators (low thousands for one language). Review the
259+
limitations for the languages you plan to use.</div><p>During deserialization, unrecognized enum values will be preserved in the
260260
message, though how this is represented when the message is deserialized is
261261
language-dependent. In languages that support open enum types with values
262262
outside the range of specified symbols, such as C++ and Go, the unknown enum

reference/java/index.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ implements the &lt;code>Message.Builder&lt;/code> interface. It extends the
147147
&lt;code>GeneratedMessage.Builder&lt;/code> class, but, again, this should be considered an
148148
implementation detail. Like &lt;code>Foo&lt;/code>, &lt;code>Foo.Builder&lt;/code> may rely on generic method
149149
implementations in &lt;code>GeneratedMessage.Builder&lt;/code> or, when the &lt;code>optimize_for&lt;/code> option
150-
is used, generated custom code that is much faster.&lt;/p>
150+
is used, generated custom code that is much faster. You can get a &lt;code>Foo.Builder&lt;/code>
151+
by calling the static method &lt;code>Foo.newBuilder()&lt;/code>.&lt;/p>
151152
&lt;p>&lt;code>Foo.Builder&lt;/code> does not define any static methods. Its interface is exactly as
152153
defined by the &lt;code>Message.Builder&lt;/code> interface, with the exception that return types
153154
are more specific: methods of &lt;code>Foo.Builder&lt;/code> that modify the builder return type

reference/java/java-generated/index.html

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

reference/ruby/index.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ to an enum field, even if it was not defined in the enum.&lt;/p>
261261
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">end&lt;/span>
262262
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>An enum module also defines the following utility methods:&lt;/p>
263263
&lt;ul>
264-
&lt;li>&lt;code>Enum#lookup(number)&lt;/code>: Looks up the given number and returns its name, or
265-
&lt;code>nil&lt;/code> if none was found. If more than one name has this number, returns the
266-
first that was defined.&lt;/li>
267-
&lt;li>&lt;code>Enum#resolve(symbol)&lt;/code>: Returns the number for this enum name, or &lt;code>nil&lt;/code> if
268-
none was found.&lt;/li>
269-
&lt;li>&lt;code>Enum#descriptor&lt;/code>: Returns the descriptor for this enum.&lt;/li>
264+
&lt;li>&lt;code>Foo::SomeEnum.lookup(number)&lt;/code>: Looks up the given number and returns its
265+
name, or &lt;code>nil&lt;/code> if none was found. If more than one name has this number,
266+
returns the first that was defined.&lt;/li>
267+
&lt;li>&lt;code>Foo::SomeEnum.resolve(symbol)&lt;/code>: Returns the number for this enum name, or
268+
&lt;code>nil&lt;/code> if none was found.&lt;/li>
269+
&lt;li>&lt;code>Foo::SomeEnum.descriptor&lt;/code>: Returns the descriptor for this enum.&lt;/li>
270270
&lt;/ul>
271271
&lt;h2 id="oneof">Oneof&lt;/h2>
272272
&lt;p>Given a message with a oneof:&lt;/p>

reference/ruby/ruby-generated/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@
193193
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>else</span>
194194
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic># ...</span>
195195
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>end</span>
196-
</span></span></code></pre></div><p>An enum module also defines the following utility methods:</p><ul><li><code>Enum#lookup(number)</code>: Looks up the given number and returns its name, or
197-
<code>nil</code> if none was found. If more than one name has this number, returns the
198-
first that was defined.</li><li><code>Enum#resolve(symbol)</code>: Returns the number for this enum name, or <code>nil</code> if
199-
none was found.</li><li><code>Enum#descriptor</code>: Returns the descriptor for this enum.</li></ul><h2 id=oneof>Oneof</h2><p>Given a message with a oneof:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-proto data-lang=proto><span style=display:flex><span><span style=color:#204a87;font-weight:700>message</span> <span style=color:#000>Foo</span> <span style=color:#000;font-weight:700>{</span><span style=color:#a40000>
196+
</span></span></code></pre></div><p>An enum module also defines the following utility methods:</p><ul><li><code>Foo::SomeEnum.lookup(number)</code>: Looks up the given number and returns its
197+
name, or <code>nil</code> if none was found. If more than one name has this number,
198+
returns the first that was defined.</li><li><code>Foo::SomeEnum.resolve(symbol)</code>: Returns the number for this enum name, or
199+
<code>nil</code> if none was found.</li><li><code>Foo::SomeEnum.descriptor</code>: Returns the descriptor for this enum.</li></ul><h2 id=oneof>Oneof</h2><p>Given a message with a oneof:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-proto data-lang=proto><span style=display:flex><span><span style=color:#204a87;font-weight:700>message</span> <span style=color:#000>Foo</span> <span style=color:#000;font-weight:700>{</span><span style=color:#a40000>
200200
</span></span></span><span style=display:flex><span><span style=color:#a40000></span> <span style=color:#204a87;font-weight:700>oneof</span> <span style=color:#000>test_oneof</span> <span style=color:#000;font-weight:700>{</span><span style=color:#a40000>
201201
</span></span></span><span style=display:flex><span><span style=color:#a40000></span> <span style=color:#204a87;font-weight:700>string</span> <span style=color:#000>name</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>;</span><span style=color:#a40000>
202202
</span></span></span><span style=display:flex><span><span style=color:#a40000></span> <span style=color:#204a87;font-weight:700>int32</span> <span style=color:#000>serial_number</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>;</span><span style=color:#a40000>

0 commit comments

Comments
 (0)