betterproto2-compiler 0.3.2__py3-none-any.whl → 0.5.0__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.
- betterproto2_compiler/compile/importing.py +5 -25
- betterproto2_compiler/known_types/__init__.py +98 -2
- betterproto2_compiler/known_types/duration.py +45 -0
- betterproto2_compiler/known_types/google_values.py +231 -0
- betterproto2_compiler/known_types/timestamp.py +39 -0
- betterproto2_compiler/lib/google/protobuf/__init__.py +418 -603
- betterproto2_compiler/lib/google/protobuf/compiler/__init__.py +25 -14
- betterproto2_compiler/plugin/models.py +55 -23
- betterproto2_compiler/plugin/parser.py +22 -1
- betterproto2_compiler/settings.py +67 -0
- betterproto2_compiler/templates/header.py.j2 +4 -3
- betterproto2_compiler/templates/service_stub.py.j2 +32 -0
- betterproto2_compiler/templates/service_stub_async.py.j2 +86 -0
- betterproto2_compiler/templates/service_stub_sync.py.j2 +72 -0
- betterproto2_compiler/templates/template.py.j2 +9 -93
- {betterproto2_compiler-0.3.2.dist-info → betterproto2_compiler-0.5.0.dist-info}/METADATA +3 -3
- betterproto2_compiler-0.5.0.dist-info/RECORD +35 -0
- {betterproto2_compiler-0.3.2.dist-info → betterproto2_compiler-0.5.0.dist-info}/WHEEL +1 -1
- betterproto2_compiler-0.3.2.dist-info/RECORD +0 -31
- {betterproto2_compiler-0.3.2.dist-info → betterproto2_compiler-0.5.0.dist-info}/LICENSE.md +0 -0
- {betterproto2_compiler-0.3.2.dist-info → betterproto2_compiler-0.5.0.dist-info}/entry_points.txt +0 -0
@@ -85,109 +85,24 @@ default_message_pool.register_message("{{ output_file.package }}", "{{ message.p
|
|
85
85
|
|
86
86
|
|
87
87
|
{% endfor %}
|
88
|
-
{% for _, service in output_file.services|dictsort(by="key") %}
|
89
|
-
class {{ service.py_name }}Stub(betterproto2.ServiceStub):
|
90
|
-
{% if service.comment %}
|
91
|
-
"""
|
92
|
-
{{ service.comment | indent(4) }}
|
93
|
-
"""
|
94
|
-
{% elif not service.methods %}
|
95
|
-
pass
|
96
|
-
{% endif %}
|
97
|
-
|
98
|
-
{% for method in service.methods %}
|
99
|
-
async def {{ method.py_name }}(self
|
100
|
-
{%- if not method.client_streaming -%}
|
101
|
-
, message:
|
102
|
-
{%- if method.is_input_msg_empty -%}
|
103
|
-
"{{ method.py_input_message_type }} | None" = None
|
104
|
-
{%- else -%}
|
105
|
-
"{{ method.py_input_message_type }}"
|
106
|
-
{%- endif -%}
|
107
|
-
{%- else -%}
|
108
|
-
{# Client streaming: need a request iterator instead #}
|
109
|
-
, messages: "AsyncIterable[{{ method.py_input_message_type }}] | Iterable[{{ method.py_input_message_type }}]"
|
110
|
-
{%- endif -%}
|
111
|
-
,
|
112
|
-
*
|
113
|
-
, timeout: "float | None" = None
|
114
|
-
, deadline: "Deadline | None" = None
|
115
|
-
, metadata: "MetadataLike | None" = None
|
116
|
-
) -> "{% if method.server_streaming %}AsyncIterator[{{ method.py_output_message_type }}]{% else %}{{ method.py_output_message_type }}{% endif %}":
|
117
|
-
{% if method.comment %}
|
118
|
-
"""
|
119
|
-
{{ method.comment | indent(8) }}
|
120
|
-
"""
|
121
|
-
{% endif %}
|
122
88
|
|
123
|
-
|
124
|
-
warnings.warn("{{ service.py_name }}.{{ method.py_name }} is deprecated", DeprecationWarning)
|
125
|
-
{% endif %}
|
126
|
-
|
127
|
-
{% if method.server_streaming %}
|
128
|
-
{% if method.client_streaming %}
|
129
|
-
async for response in self._stream_stream(
|
130
|
-
"{{ method.route }}",
|
131
|
-
messages,
|
132
|
-
{{ method.py_input_message_type }},
|
133
|
-
{{ method.py_output_message_type }},
|
134
|
-
timeout=timeout,
|
135
|
-
deadline=deadline,
|
136
|
-
metadata=metadata,
|
137
|
-
):
|
138
|
-
yield response
|
139
|
-
{% else %}{# i.e. not client streaming #}
|
140
|
-
{% if method.is_input_msg_empty %}
|
141
|
-
if message is None:
|
142
|
-
message = {{ method.py_input_message_type }}()
|
143
|
-
|
144
|
-
{% endif %}
|
145
|
-
async for response in self._unary_stream(
|
146
|
-
"{{ method.route }}",
|
147
|
-
message,
|
148
|
-
{{ method.py_output_message_type }},
|
149
|
-
timeout=timeout,
|
150
|
-
deadline=deadline,
|
151
|
-
metadata=metadata,
|
152
|
-
):
|
153
|
-
yield response
|
89
|
+
{% for _, service in output_file.services|dictsort(by="key") %}
|
154
90
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
return await self._stream_unary(
|
159
|
-
"{{ method.route }}",
|
160
|
-
messages,
|
161
|
-
{{ method.py_input_message_type }},
|
162
|
-
{{ method.py_output_message_type }},
|
163
|
-
timeout=timeout,
|
164
|
-
deadline=deadline,
|
165
|
-
metadata=metadata,
|
166
|
-
)
|
167
|
-
{% else %}{# i.e. not client streaming #}
|
168
|
-
{% if method.is_input_msg_empty %}
|
169
|
-
if message is None:
|
170
|
-
message = {{ method.py_input_message_type }}()
|
91
|
+
{% if output_file.settings.client_generation.is_sync_generated %}
|
92
|
+
{% include "service_stub_sync.py.j2" %}
|
93
|
+
{% endif %}
|
171
94
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
message,
|
176
|
-
{{ method.py_output_message_type }},
|
177
|
-
timeout=timeout,
|
178
|
-
deadline=deadline,
|
179
|
-
metadata=metadata,
|
180
|
-
)
|
181
|
-
{% endif %}{# client streaming #}
|
182
|
-
{% endif %}
|
95
|
+
{% if output_file.settings.client_generation.is_async_generated %}
|
96
|
+
{% include "service_stub_async.py.j2" %}
|
97
|
+
{% endif %}
|
183
98
|
|
184
|
-
{% endfor %}
|
185
99
|
{% endfor %}
|
186
100
|
|
187
101
|
{% for i in output_file.imports_end %}
|
188
102
|
{{ i }}
|
189
103
|
{% endfor %}
|
190
104
|
|
105
|
+
{% if output_file.settings.server_generation == "async" %}
|
191
106
|
{% for _, service in output_file.services|dictsort(by="key") %}
|
192
107
|
class {{ service.py_name }}Base(ServiceBase):
|
193
108
|
{% if service.comment %}
|
@@ -256,3 +171,4 @@ class {{ service.py_name }}Base(ServiceBase):
|
|
256
171
|
}
|
257
172
|
|
258
173
|
{% endfor %}
|
174
|
+
{% endif %}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: betterproto2_compiler
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: Compiler for betterproto2
|
5
5
|
License: MIT
|
6
6
|
Keywords: protobuf,gRPC,compiler
|
@@ -13,10 +13,10 @@ Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
16
|
-
Requires-Dist: betterproto2 (>=0.
|
17
|
-
Requires-Dist: grpclib (>=0.4.1,<0.5.0)
|
16
|
+
Requires-Dist: betterproto2[grpclib] (>=0.5.0,<0.6.0)
|
18
17
|
Requires-Dist: jinja2 (>=3.0.3)
|
19
18
|
Requires-Dist: ruff (>=0.9.3,<0.10.0)
|
19
|
+
Requires-Dist: strenum (>=0.4.15,<0.5.0) ; python_version == "3.10"
|
20
20
|
Requires-Dist: typing-extensions (>=4.7.1,<5.0.0)
|
21
21
|
Project-URL: Documentation, https://betterproto.github.io/python-betterproto2-compiler/
|
22
22
|
Project-URL: Repository, https://github.com/betterproto/python-betterproto2-compiler
|
@@ -0,0 +1,35 @@
|
|
1
|
+
betterproto2_compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
betterproto2_compiler/casing.py,sha256=HSXLXAOqZzEnu-tC1SZjpW0LIjzdPqUNJEwy1BHzfgg,3056
|
3
|
+
betterproto2_compiler/compile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
betterproto2_compiler/compile/importing.py,sha256=cJZ1BqjSHaDwXlfseH7f73pMnBZTiqLyOQfQfyganVM,6256
|
5
|
+
betterproto2_compiler/compile/naming.py,sha256=zf0VOmNojzyv33upOGelGxjZTEDE8JULEEED5_3inHg,562
|
6
|
+
betterproto2_compiler/known_types/__init__.py,sha256=nrWckuv4hGhL8-tW7V5TD5qXs1Sa5vC7zMusGnz7jsE,3485
|
7
|
+
betterproto2_compiler/known_types/any.py,sha256=eRMenvvrn-1Wiss3YxhqRsjZ4XqiqPb1YQuinoA8wI4,1899
|
8
|
+
betterproto2_compiler/known_types/duration.py,sha256=M-qsFeiHsw5Z_AoSata1ZUjfkhooP9WhrmecNfuP16k,2312
|
9
|
+
betterproto2_compiler/known_types/google_values.py,sha256=7JoPXVs6cVg_ihIWlWIDElSSuW0BymRnPHerz1bFuH4,6688
|
10
|
+
betterproto2_compiler/known_types/timestamp.py,sha256=y1sNWG2Q0FWv6nIte1UTifFVCsryp7T8foXZqp4qhQQ,3409
|
11
|
+
betterproto2_compiler/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
betterproto2_compiler/lib/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
+
betterproto2_compiler/lib/google/protobuf/__init__.py,sha256=yC7k_A1XA9-CPzhIaJfWJSIBpqyaLx7IVVuvXrqD-iQ,102114
|
14
|
+
betterproto2_compiler/lib/google/protobuf/compiler/__init__.py,sha256=IriT5naeEkcxA-R2EpzOGBMLVGgVO6CXqvrR8HVaR28,9600
|
15
|
+
betterproto2_compiler/lib/message_pool.py,sha256=4-cRhhiM6bmfpUJZ8qxc8LEyqHBHpLCcotjbyZxl7JM,71
|
16
|
+
betterproto2_compiler/plugin/__init__.py,sha256=L3pW0b4CvkM5x53x_sYt1kYiSFPO0_vaeH6EQPq9FAM,43
|
17
|
+
betterproto2_compiler/plugin/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
|
18
|
+
betterproto2_compiler/plugin/compiler.py,sha256=3sPbCtdzjAGftVvoGe5dvxE8uTzJ78hABA-_f-1rEUo,2471
|
19
|
+
betterproto2_compiler/plugin/main.py,sha256=gI2fSWc9U-fn6MOlkLg7iResr2YsXbdOge6SzNWxBAo,1302
|
20
|
+
betterproto2_compiler/plugin/models.py,sha256=rzCKsdoV-0QCwmRN82x2QZ6029W9EAAJCFbLGMkVoz8,22215
|
21
|
+
betterproto2_compiler/plugin/module_validation.py,sha256=JnP8dSN83eJJVDP_UPJsHzq7E7Md3lah0PnKXDbFW5Q,4808
|
22
|
+
betterproto2_compiler/plugin/parser.py,sha256=XJd7n78E6Gnv04L1faGyTCOV3v0sv1eD5-AenNhPDMQ,10197
|
23
|
+
betterproto2_compiler/plugin/plugin.bat,sha256=lfLT1WguAXqyerLLsRL6BfHA0RqUE6QG79v-1BYVSpI,48
|
24
|
+
betterproto2_compiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
+
betterproto2_compiler/settings.py,sha256=ggLU8qYTTACwdNN94cSznQchu-fJSJxZz041FXRwq7Y,1976
|
26
|
+
betterproto2_compiler/templates/header.py.j2,sha256=nTUJ-BioeTTCrEr2ZbxPPUl6iBqHOxXr_NAVOGa8jYg,1622
|
27
|
+
betterproto2_compiler/templates/service_stub.py.j2,sha256=r0AefgNbDCh-iDgFNV7aNx8fNe5kQY-8TNew-T_tUXc,929
|
28
|
+
betterproto2_compiler/templates/service_stub_async.py.j2,sha256=JNOAa8FPhzYS5D0zi0DPESVEwAjkdFsVQZ008Qi4JmE,2968
|
29
|
+
betterproto2_compiler/templates/service_stub_sync.py.j2,sha256=V7HJIQJEgivX8VEBt7Ju6cXG5FeeCY9QyYMy1kicElM,2642
|
30
|
+
betterproto2_compiler/templates/template.py.j2,sha256=kP1TMTK7BCv6sEFTGXPZs_jg39lC_IdvKTFWPHm8BgU,5415
|
31
|
+
betterproto2_compiler-0.5.0.dist-info/LICENSE.md,sha256=Pgl2pReU-2yw2miGeQ55UFlyzqAZ_EpYVyZ2nWjwRv4,1121
|
32
|
+
betterproto2_compiler-0.5.0.dist-info/METADATA,sha256=pUx-gnKmPCkyg1z4v46hqAZjBcmoxpJ7CCWokrobQ_8,1225
|
33
|
+
betterproto2_compiler-0.5.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
34
|
+
betterproto2_compiler-0.5.0.dist-info/entry_points.txt,sha256=re3Qg8lLljbVobeeKH2f1FVQZ114wfZkGv3zCZTD8Ok,84
|
35
|
+
betterproto2_compiler-0.5.0.dist-info/RECORD,,
|
@@ -1,31 +0,0 @@
|
|
1
|
-
betterproto2_compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
betterproto2_compiler/casing.py,sha256=HSXLXAOqZzEnu-tC1SZjpW0LIjzdPqUNJEwy1BHzfgg,3056
|
3
|
-
betterproto2_compiler/compile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
betterproto2_compiler/compile/importing.py,sha256=2DF9zpYhjX_H3PCyUHCXhho1J2QdGAtXitlNneZZfFs,7129
|
5
|
-
betterproto2_compiler/compile/naming.py,sha256=zf0VOmNojzyv33upOGelGxjZTEDE8JULEEED5_3inHg,562
|
6
|
-
betterproto2_compiler/known_types/__init__.py,sha256=Exqo-3ubDuik0TZDTw5ZPqf-dVb2uPJTZxMG7X58E6U,780
|
7
|
-
betterproto2_compiler/known_types/any.py,sha256=eRMenvvrn-1Wiss3YxhqRsjZ4XqiqPb1YQuinoA8wI4,1899
|
8
|
-
betterproto2_compiler/known_types/duration.py,sha256=jy9GPnQTT9qhi12pQDG_ptdFAdm2gYkq3NH75zUTDOU,895
|
9
|
-
betterproto2_compiler/known_types/timestamp.py,sha256=dUfJmdrVg1NW-zkquAc8kxMH6nqdxQ2x_MKeP4N5ksY,2153
|
10
|
-
betterproto2_compiler/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
betterproto2_compiler/lib/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
betterproto2_compiler/lib/google/protobuf/__init__.py,sha256=gjVdLGtwPhNVept742QqpSdf042sKltfZubb-4YYwoc,107931
|
13
|
-
betterproto2_compiler/lib/google/protobuf/compiler/__init__.py,sha256=LfQnk85-q2R_mc1CmvqkobqHASqDCnG9xOFd0S-O3p4,8906
|
14
|
-
betterproto2_compiler/lib/message_pool.py,sha256=4-cRhhiM6bmfpUJZ8qxc8LEyqHBHpLCcotjbyZxl7JM,71
|
15
|
-
betterproto2_compiler/plugin/__init__.py,sha256=L3pW0b4CvkM5x53x_sYt1kYiSFPO0_vaeH6EQPq9FAM,43
|
16
|
-
betterproto2_compiler/plugin/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
|
17
|
-
betterproto2_compiler/plugin/compiler.py,sha256=3sPbCtdzjAGftVvoGe5dvxE8uTzJ78hABA-_f-1rEUo,2471
|
18
|
-
betterproto2_compiler/plugin/main.py,sha256=gI2fSWc9U-fn6MOlkLg7iResr2YsXbdOge6SzNWxBAo,1302
|
19
|
-
betterproto2_compiler/plugin/models.py,sha256=MIzmnekCuZrzixGthAw9B6p3hXAtk6YYjDLUVIsIs4o,21085
|
20
|
-
betterproto2_compiler/plugin/module_validation.py,sha256=JnP8dSN83eJJVDP_UPJsHzq7E7Md3lah0PnKXDbFW5Q,4808
|
21
|
-
betterproto2_compiler/plugin/parser.py,sha256=MIA5-pAIJsng59wk3KYEKBARNCsQEQeetnVZk_MhL0I,9349
|
22
|
-
betterproto2_compiler/plugin/plugin.bat,sha256=lfLT1WguAXqyerLLsRL6BfHA0RqUE6QG79v-1BYVSpI,48
|
23
|
-
betterproto2_compiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
-
betterproto2_compiler/settings.py,sha256=FQwco5j9ViBXtDYoFqog7SlXhX2YcbgEnFP77znYiwc,94
|
25
|
-
betterproto2_compiler/templates/header.py.j2,sha256=HrISX0IKmUsVpIlGIT6XlD9e3LgWWPN7jYRpws5_-CY,1609
|
26
|
-
betterproto2_compiler/templates/template.py.j2,sha256=Wlif_PRN49Hmeh0e8RyYFvrNTcusugysP_sAgBaDA4A,8420
|
27
|
-
betterproto2_compiler-0.3.2.dist-info/LICENSE.md,sha256=Pgl2pReU-2yw2miGeQ55UFlyzqAZ_EpYVyZ2nWjwRv4,1121
|
28
|
-
betterproto2_compiler-0.3.2.dist-info/METADATA,sha256=r9_e3O4E0DMcyEEgHkDZARdc6fr3W9qU5eHfEsADovg,1188
|
29
|
-
betterproto2_compiler-0.3.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
30
|
-
betterproto2_compiler-0.3.2.dist-info/entry_points.txt,sha256=re3Qg8lLljbVobeeKH2f1FVQZ114wfZkGv3zCZTD8Ok,84
|
31
|
-
betterproto2_compiler-0.3.2.dist-info/RECORD,,
|
File without changes
|
{betterproto2_compiler-0.3.2.dist-info → betterproto2_compiler-0.5.0.dist-info}/entry_points.txt
RENAMED
File without changes
|