File tree Expand file tree Collapse file tree 8 files changed +163
-202
lines changed Expand file tree Collapse file tree 8 files changed +163
-202
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,16 @@ def _render_template(
244
244
if not opts .metadata and template_name .endswith ("gapic_metadata.json.j2" ):
245
245
return answer
246
246
247
+ # Disables generation of an unversioned Python package for this client
248
+ # library. This means that the module names will need to be versioned in
249
+ # import statements. For example `import google.cloud.library_v2` instead
250
+ # of `import google.cloud.library`.
251
+ if template_name .startswith ("%namespace/%name/" ) and \
252
+ api_schema .all_library_settings [
253
+ api_schema .naming .proto_package
254
+ ].python_settings .experimental_features .unversioned_package_disabled :
255
+ return answer
256
+
247
257
# Quick check: Rendering per service and per proto would be a
248
258
# combinatorial explosion and is almost certainly not what anyone
249
259
# ever wants. Error colorfully on it.
Original file line number Diff line number Diff line change 1
1
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121): Remove the following variable (and the condition later in this file) for async rest transport once support for it is GA. #}
2
2
{% set rest_async_io_enabled = api .all_library_settings [api .naming .proto_package ].python_settings .experimental_features .rest_async_io_enabled %}
3
+ {% set unversioned_package_disabled = api .all_library_settings [api .naming .proto_package ].python_settings .experimental_features .unversioned_package_disabled %}
3
4
{% extends '_base.py.j2' %}
4
5
{% from '_pypi_packages.j2' import pypi_packages %}
5
6
{% block content %}
@@ -15,8 +16,8 @@ package_root = os.path.abspath(os.path.dirname(__file__))
15
16
name = '{{ api.naming.warehouse_package_name }}'
16
17
17
18
{% set warehouse_description = api .naming .warehouse_package_name .replace ('-' ,' ' )|title %}
18
- {% set package_path = api .naming .module_namespace |join ('/' ) + "/" + api .naming .module_name %}
19
19
20
+ {% set package_path = api .naming .module_namespace |join ('/' ) + "/" + (api .naming .versioned_module_name if unversioned_package_disabled else api .naming .module_name ) %}
20
21
description = "{{ warehouse_description }} API client library"
21
22
22
23
version = None
Original file line number Diff line number Diff line change @@ -115,4 +115,12 @@ authentication:
115
115
- selector : ' google.longrunning.Operations.*'
116
116
oauth :
117
117
canonical_scopes : |-
118
- https://www.googleapis.com/auth/cloud-platform
118
+ https://www.googleapis.com/auth/cloud-platform
119
+
120
+
121
+ publishing :
122
+ library_settings :
123
+ - version : ' google.cloud.eventarc.v1'
124
+ python_settings :
125
+ experimental_features :
126
+ unversioned_package_disabled : true
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 28
28
29
29
version = None
30
30
31
- with open (os .path .join (package_root , 'google/cloud/eventarc /gapic_version.py' )) as fp :
31
+ with open (os .path .join (package_root , 'google/cloud/eventarc_v1 /gapic_version.py' )) as fp :
32
32
version_candidates = re .findall (r"(?<=\")\d+.\d+.\d+(?=\")" , fp .read ())
33
33
assert (len (version_candidates ) == 1 )
34
34
version = version_candidates [0 ]
You can’t perform that action at this time.
0 commit comments