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(
244244 if not opts .metadata and template_name .endswith ("gapic_metadata.json.j2" ):
245245 return answer
246246
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+
247257 # Quick check: Rendering per service and per proto would be a
248258 # combinatorial explosion and is almost certainly not what anyone
249259 # ever wants. Error colorfully on it.
Original file line number Diff line number Diff line change 11{# 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. #}
22{% 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 %}
34{% extends '_base.py.j2' %}
45{% from '_pypi_packages.j2' import pypi_packages %}
56{% block content %}
@@ -15,8 +16,8 @@ package_root = os.path.abspath(os.path.dirname(__file__))
1516name = '{{ api.naming.warehouse_package_name }}'
1617
1718{% set warehouse_description = api .naming .warehouse_package_name .replace ('-' ,' ' )|title %}
18- {% set package_path = api .naming .module_namespace |join ('/' ) + "/" + api .naming .module_name %}
1919
20+ {% set package_path = api .naming .module_namespace |join ('/' ) + "/" + (api .naming .versioned_module_name if unversioned_package_disabled else api .naming .module_name ) %}
2021description = "{{ warehouse_description }} API client library"
2122
2223version = None
Original file line number Diff line number Diff line change @@ -115,4 +115,12 @@ authentication:
115115 - selector : ' google.longrunning.Operations.*'
116116 oauth :
117117 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 2828
2929version = None
3030
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 :
3232 version_candidates = re .findall (r"(?<=\")\d+.\d+.\d+(?=\")" , fp .read ())
3333 assert (len (version_candidates ) == 1 )
3434 version = version_candidates [0 ]
You can’t perform that action at this time.
0 commit comments