Skip to content

Commit

Permalink
feat: add support for google.area120.tables.__version__ (#204)
Browse files Browse the repository at this point in the history
* chore: update to gapic-generator-python 1.5.0

feat: add support for `google.cloud.<api>.__version__`
PiperOrigin-RevId: 484665853

Source-Link: googleapis/googleapis@8eb249a

Source-Link: googleapis/googleapis-gen@c8aa327
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update version in gapic_version.py

* add .release-please-manifest.json with correct version

* add owlbot.py to exclude generated gapic_version.py

* add release-please-config.json

* use autogenerated setup.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2022
1 parent dbbad42 commit e2ff8f8
Show file tree
Hide file tree
Showing 39 changed files with 492 additions and 1,902 deletions.
1 change: 1 addition & 0 deletions packages/google-area120-tables/.github/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
releaseType: python
manifest: true
handleGHRelease: true
3 changes: 3 additions & 0 deletions packages/google-area120-tables/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.8.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.area120.tables import gapic_version as package_version

__version__ = package_version.__version__


from google.area120.tables_v1alpha1.services.tables_service.async_client import (
TablesServiceAsyncClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.8.2" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.area120.tables import gapic_version as package_version

__version__ = package_version.__version__


from .services.tables_service import TablesServiceAsyncClient, TablesServiceClient
from .types.tables import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast

from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
Expand Down Expand Up @@ -375,7 +375,7 @@ def __init__(
*,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, TablesServiceTransport, None] = None,
client_options: Optional[client_options_lib.ClientOptions] = None,
client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the tables service client.
Expand All @@ -392,7 +392,7 @@ def __init__(
NOTE: "rest" transport functionality is currently in a
beta state (preview). We welcome your feedback via an
issue in this library's source repository.
client_options (google.api_core.client_options.ClientOptions): Custom options for the
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
Expand Down Expand Up @@ -422,6 +422,7 @@ def __init__(
client_options = client_options_lib.from_dict(client_options)
if client_options is None:
client_options = client_options_lib.ClientOptions()
client_options = cast(client_options_lib.ClientOptions, client_options)

api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
client_options
Expand Down
56 changes: 56 additions & 0 deletions packages/google-area120-tables/owlbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
from pathlib import Path
import shutil

import synthtool as s
import synthtool.gcp as gcp
from synthtool.languages import python

# ----------------------------------------------------------------------------
# Copy the generated client from the owl-bot staging directory
# ----------------------------------------------------------------------------

clean_up_generated_samples = True

# Load the default version defined in .repo-metadata.json.
default_version = json.load(open(".repo-metadata.json", "rt")).get(
"default_version"
)

for library in s.get_staging_dirs(default_version):
if clean_up_generated_samples:
shutil.rmtree("samples/generated_samples", ignore_errors=True)
clean_up_generated_samples = False
s.move([library], excludes=["**/gapic_version.py"])
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------

templated_files = gcp.CommonTemplates().py_library(
cov_level=100,
microgenerator=True,
versions=gcp.common.detect_versions(path="./google", default_first=True),
)
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"])

python.py_samples(skip_readmes=True)

# run format session for all directories which have a noxfile
for noxfile in Path(".").glob("**/noxfile.py"):
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)
23 changes: 23 additions & 0 deletions packages/google-area120-tables/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "python",
"extra-files": [
"google/area120/tables/gapic_version.py",
{
"type": "json",
"path": "samples/generated_samples/snippet_metadata_tables_v1alpha1.json",
"jsonpath": "$.clientLibrary.version"
}
]
}
},
"release-type": "python",
"plugins": [
{
"type": "sentence-case"
}
],
"initial-version": "0.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# python3 -m pip install google-area120-tables


# [START area120tables_v1alpha1_generated_TablesService_BatchCreateRows_sync_39533718]
# [START area120tables_v1alpha1_generated_TablesService_BatchCreateRows_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
Expand Down Expand Up @@ -53,4 +53,4 @@ def sample_batch_create_rows():
# Handle the response
print(response)

# [END area120tables_v1alpha1_generated_TablesService_BatchCreateRows_sync_39533718]
# [END area120tables_v1alpha1_generated_TablesService_BatchCreateRows_sync]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# python3 -m pip install google-area120-tables


# [START area120tables_v1alpha1_generated_TablesService_BatchDeleteRows_sync_7474ee2a]
# [START area120tables_v1alpha1_generated_TablesService_BatchDeleteRows_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
Expand All @@ -48,4 +48,4 @@ def sample_batch_delete_rows():
client.batch_delete_rows(request=request)


# [END area120tables_v1alpha1_generated_TablesService_BatchDeleteRows_sync_7474ee2a]
# [END area120tables_v1alpha1_generated_TablesService_BatchDeleteRows_sync]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# python3 -m pip install google-area120-tables


# [START area120tables_v1alpha1_generated_TablesService_BatchUpdateRows_sync_87153c6b]
# [START area120tables_v1alpha1_generated_TablesService_BatchUpdateRows_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
Expand All @@ -49,4 +49,4 @@ def sample_batch_update_rows():
# Handle the response
print(response)

# [END area120tables_v1alpha1_generated_TablesService_BatchUpdateRows_sync_87153c6b]
# [END area120tables_v1alpha1_generated_TablesService_BatchUpdateRows_sync]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# python3 -m pip install google-area120-tables


# [START area120tables_v1alpha1_generated_TablesService_CreateRow_sync_77db3520]
# [START area120tables_v1alpha1_generated_TablesService_CreateRow_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
Expand All @@ -49,4 +49,4 @@ def sample_create_row():
# Handle the response
print(response)

# [END area120tables_v1alpha1_generated_TablesService_CreateRow_sync_77db3520]
# [END area120tables_v1alpha1_generated_TablesService_CreateRow_sync]
Loading

0 comments on commit e2ff8f8

Please sign in to comment.