diff --git a/.github/release-please.yml b/.github/release-please.yml index 6def37a..e9a4f00 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..866e93f --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.4.3" +} diff --git a/docs/shell_v1/types.rst b/docs/shell_v1/types.rst index 5324b54..03ad0f5 100644 --- a/docs/shell_v1/types.rst +++ b/docs/shell_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Shell v1 API .. automodule:: google.cloud.shell_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/shell/__init__.py b/google/cloud/shell/__init__.py index bf56bf2..91bb4b5 100644 --- a/google/cloud/shell/__init__.py +++ b/google/cloud/shell/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.shell import gapic_version as package_version + +__version__ = package_version.__version__ + from google.cloud.shell_v1.services.cloud_shell_service.async_client import ( CloudShellServiceAsyncClient, diff --git a/google/cloud/shell/gapic_version.py b/google/cloud/shell/gapic_version.py new file mode 100644 index 0000000..178df4b --- /dev/null +++ b/google/cloud/shell/gapic_version.py @@ -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__ = "1.4.3" # {x-release-please-version} diff --git a/google/cloud/shell_v1/__init__.py b/google/cloud/shell_v1/__init__.py index 45ae75b..e7e6344 100644 --- a/google/cloud/shell_v1/__init__.py +++ b/google/cloud/shell_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.shell import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.cloud_shell_service import ( CloudShellServiceAsyncClient, diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index a7bd34d..4e75dfa 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -171,9 +181,9 @@ def transport(self) -> CloudShellServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, CloudShellServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the cloud shell service client. @@ -217,11 +227,11 @@ def __init__( async def get_environment( self, - request: Union[cloudshell.GetEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.GetEnvironmentRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloudshell.Environment: r"""Gets an environment. Returns NOT_FOUND if the environment does @@ -254,7 +264,7 @@ async def sample_get_environment(): print(response) Args: - request (Union[google.cloud.shell_v1.types.GetEnvironmentRequest, dict]): + request (Optional[Union[google.cloud.shell_v1.types.GetEnvironmentRequest, dict]]): The request object. Request message for [GetEnvironment][google.cloud.shell.v1.CloudShellService.GetEnvironment]. name (:class:`str`): @@ -337,10 +347,10 @@ async def sample_get_environment(): async def start_environment( self, - request: Union[cloudshell.StartEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Starts an existing environment, allowing clients to @@ -382,7 +392,7 @@ async def sample_start_environment(): print(response) Args: - request (Union[google.cloud.shell_v1.types.StartEnvironmentRequest, dict]): + request (Optional[Union[google.cloud.shell_v1.types.StartEnvironmentRequest, dict]]): The request object. Request message for [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -438,10 +448,10 @@ async def sample_start_environment(): async def authorize_environment( self, - request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Sends OAuth credentials to a running environment on @@ -480,7 +490,7 @@ async def sample_authorize_environment(): print(response) Args: - request (Union[google.cloud.shell_v1.types.AuthorizeEnvironmentRequest, dict]): + request (Optional[Union[google.cloud.shell_v1.types.AuthorizeEnvironmentRequest, dict]]): The request object. Request message for [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -535,10 +545,10 @@ async def sample_authorize_environment(): async def add_public_key( self, - request: Union[cloudshell.AddPublicKeyRequest, dict] = None, + request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Adds a public SSH key to an environment, allowing clients with @@ -576,7 +586,7 @@ async def sample_add_public_key(): print(response) Args: - request (Union[google.cloud.shell_v1.types.AddPublicKeyRequest, dict]): + request (Optional[Union[google.cloud.shell_v1.types.AddPublicKeyRequest, dict]]): The request object. Request message for [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -633,10 +643,10 @@ async def sample_add_public_key(): async def remove_public_key( self, - request: Union[cloudshell.RemovePublicKeyRequest, dict] = None, + request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Removes a public SSH key from an environment. Clients will no @@ -674,7 +684,7 @@ async def sample_remove_public_key(): print(response) Args: - request (Union[google.cloud.shell_v1.types.RemovePublicKeyRequest, dict]): + request (Optional[Union[google.cloud.shell_v1.types.RemovePublicKeyRequest, dict]]): The request object. Request message for [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey]. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 86032c1..134029e 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + 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 @@ -60,7 +71,7 @@ class CloudShellServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[CloudShellServiceTransport]: """Returns an appropriate transport class. @@ -338,8 +349,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CloudShellServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, CloudShellServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the cloud shell service client. @@ -353,7 +364,7 @@ def __init__( transport (Union[str, CloudShellServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - 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 @@ -383,6 +394,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 @@ -435,11 +447,11 @@ def __init__( def get_environment( self, - request: Union[cloudshell.GetEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.GetEnvironmentRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloudshell.Environment: r"""Gets an environment. Returns NOT_FOUND if the environment does @@ -545,10 +557,10 @@ def sample_get_environment(): def start_environment( self, - request: Union[cloudshell.StartEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Starts an existing environment, allowing clients to @@ -647,10 +659,10 @@ def sample_start_environment(): def authorize_environment( self, - request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None, + request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Sends OAuth credentials to a running environment on @@ -745,10 +757,10 @@ def sample_authorize_environment(): def add_public_key( self, - request: Union[cloudshell.AddPublicKeyRequest, dict] = None, + request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Adds a public SSH key to an environment, allowing clients with @@ -844,10 +856,10 @@ def sample_add_public_key(): def remove_public_key( self, - request: Union[cloudshell.RemovePublicKeyRequest, dict] = None, + request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Removes a public SSH key from an environment. Clients will no diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index 1a6e8c0..e544512 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py @@ -49,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py index 2b6b68e..9aa0b75 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py @@ -54,14 +54,14 @@ def __init__( self, *, host: str = "cloudshell.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -189,8 +189,8 @@ def __init__( def create_channel( cls, host: str = "cloudshell.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py index 9ad45c6..5635d33 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py @@ -56,7 +56,7 @@ class CloudShellServiceGrpcAsyncIOTransport(CloudShellServiceTransport): def create_channel( cls, host: str = "cloudshell.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -99,15 +99,15 @@ def __init__( self, *, host: str = "cloudshell.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/shell_v1/types/cloudshell.py b/google/cloud/shell_v1/types/cloudshell.py index e2bfa0a..f2f2a26 100644 --- a/google/cloud/shell_v1/types/cloudshell.py +++ b/google/cloud/shell_v1/types/cloudshell.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -81,7 +83,7 @@ class Environment(proto.Message): Output only. Port to which clients can connect to initiate SSH sessions with the environment. - public_keys (Sequence[str]): + public_keys (MutableSequence[str]): Output only. Public keys associated with the environment. Clients can connect to this environment via SSH only if they possess a @@ -99,40 +101,40 @@ class State(proto.Enum): RUNNING = 3 DELETING = 4 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - docker_image = proto.Field( + docker_image: str = proto.Field( proto.STRING, number=3, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=4, enum=State, ) - web_host = proto.Field( + web_host: str = proto.Field( proto.STRING, number=12, ) - ssh_username = proto.Field( + ssh_username: str = proto.Field( proto.STRING, number=5, ) - ssh_host = proto.Field( + ssh_host: str = proto.Field( proto.STRING, number=6, ) - ssh_port = proto.Field( + ssh_port: int = proto.Field( proto.INT32, number=7, ) - public_keys = proto.RepeatedField( + public_keys: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=8, ) @@ -149,7 +151,7 @@ class GetEnvironmentRequest(proto.Message): ``users/someone@example.com/environments/default``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -186,20 +188,20 @@ class StartEnvironmentRequest(proto.Message): in Cloud Shell without having to log in. This code can be updated later by calling AuthorizeEnvironment. - public_keys (Sequence[str]): + public_keys (MutableSequence[str]): Public keys that should be added to the environment before it is started. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - access_token = proto.Field( + access_token: str = proto.Field( proto.STRING, number=2, ) - public_keys = proto.RepeatedField( + public_keys: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -226,19 +228,19 @@ class AuthorizeEnvironmentRequest(proto.Message): received the request. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - access_token = proto.Field( + access_token: str = proto.Field( proto.STRING, number=2, ) - id_token = proto.Field( + id_token: str = proto.Field( proto.STRING, number=4, ) - expire_time = proto.Field( + expire_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, @@ -282,7 +284,7 @@ class State(proto.Enum): AWAITING_COMPUTE_RESOURCES = 4 FINISHED = 3 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, @@ -299,7 +301,7 @@ class StartEnvironmentResponse(proto.Message): Environment that was started. """ - environment = proto.Field( + environment: "Environment" = proto.Field( proto.MESSAGE, number=1, message="Environment", @@ -324,11 +326,11 @@ class AddPublicKeyRequest(proto.Message): encoded with Base64. """ - environment = proto.Field( + environment: str = proto.Field( proto.STRING, number=1, ) - key = proto.Field( + key: str = proto.Field( proto.STRING, number=2, ) @@ -343,7 +345,7 @@ class AddPublicKeyResponse(proto.Message): Key that was added to the environment. """ - key = proto.Field( + key: str = proto.Field( proto.STRING, number=1, ) @@ -369,11 +371,11 @@ class RemovePublicKeyRequest(proto.Message): environment. """ - environment = proto.Field( + environment: str = proto.Field( proto.STRING, number=1, ) - key = proto.Field( + key: str = proto.Field( proto.STRING, number=2, ) @@ -410,8 +412,9 @@ class CloudShellErrorCode(proto.Enum): CLOUD_SHELL_DISABLED = 2 TOS_VIOLATION = 4 QUOTA_EXCEEDED = 5 + ENVIRONMENT_UNAVAILABLE = 6 - code = proto.Field( + code: CloudShellErrorCode = proto.Field( proto.ENUM, number=1, enum=CloudShellErrorCode, diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 0000000..ce738f0 --- /dev/null +++ b/owlbot.py @@ -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) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..c9c4b12 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/shell/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/samples/generated_samples/snippet_metadata_shell_v1.json b/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_shell_v1.json rename to samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json index 7787762..3389a15 100644 --- a/samples/generated_samples/snippet_metadata_shell_v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-shell" + "name": "google-cloud-shell", + "version": "0.1.0" }, "snippets": [ { diff --git a/setup.py b/setup.py index 687a0ae..7d52ff9 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,46 @@ # -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC +# 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 # -# https://www.apache.org/licenses/LICENSE-2.0 +# 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 io import os -import setuptools +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-shell" -description = "Cloud Shell API client library" -version = "1.4.3" -release_status = "Development Status :: 5 - Production/Stable" -url = "https://github.com/googleapis/python-shell" + + +description = "Google Cloud Shell API client library" + +version = {} +with open(os.path.join(package_root, "google/cloud/shell/gapic_version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] +url = "https://github.com/googleapis/python-shell" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -46,7 +58,6 @@ if "google.cloud" in packages: namespaces.append("google.cloud") - setuptools.setup( name=name, version=version, @@ -54,8 +65,8 @@ long_description=readme, author="Google LLC", author_email="googleapis-packages@google.com", - url=url, license="Apache 2.0", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 5dcaa6f..6f3158c 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,10 +1,9 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index e69de29..ed7f9ae 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf