From 779a806f1dcc1ced453d92e72677171c039a63e5 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Sat, 26 Mar 2022 02:53:30 -0600 Subject: [PATCH 1/3] chore: set up CI on v1 branch (#361) * chore: set up CI on v1 branch * chore: manual updates * chore: more fixes * chore: fix in release.sh * chore: fix versions, update noxfile * fix: use anonymous creds --- .github/workflows/docs.yml | 22 +++++++ .github/workflows/lint.yml | 25 ++++++++ .github/workflows/unittest.yml | 57 +++++++++++++++++++ .kokoro/release.sh | 6 +- .kokoro/release/common.cfg | 34 ++--------- noxfile.py | 17 ++++-- .../v1beta1/test_tables_client_v1beta1.py | 4 +- 7 files changed, 125 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..0ad1c7d2 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,22 @@ +on: + pull_request: + branches: + - v1 +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..bc3bfb53 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - v1 +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 00000000..e05d4660 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - v1 +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8'] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v3 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v3 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=91 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index ba265923..9c3fb7c1 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Start the releasetool reporter @@ -28,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-automl python3 setup.py sdist bdist_wheel -twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* +twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index a66e4d28..f105268c 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,42 +23,18 @@ env_vars: { value: "github/python-automl/.kokoro/release.sh" } -# Fetch the token needed for reporting release status to GitHub -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - # Fetch PyPI password before_action { fetch_keystore { keystore_resource { keystore_config_id: 73713 - keyname: "google_cloud_pypi_password" + keyname: "google-cloud-pypi-token-keystore-1" } } } -# Fetch magictoken to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "releasetool-magictoken" - } - } -} - -# Fetch api key to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "magic-github-proxy-api-key" - } - } +# Tokens needed to report release status back to GitHub +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } diff --git a/noxfile.py b/noxfile.py index 8e90abd8..dfccb58c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,8 +29,13 @@ if os.path.exists("samples"): BLACK_PATHS.append("samples") +DEFAULT_PYTHON_VERSION = "3.8" -@nox.session(python="3.7") +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + + +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. @@ -42,7 +47,7 @@ def lint(session): session.run("flake8", "google", "tests") -@nox.session(python="3.6") +@nox.session(python=DEFAULT_PYTHON_VERSION) def blacken(session): """Run black. @@ -56,7 +61,7 @@ def blacken(session): session.run("black", *BLACK_PATHS) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -119,7 +124,7 @@ def system(session): session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. @@ -132,12 +137,12 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" session.install("-e", ".[pandas,storage]") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx<3.0.0", "alabaster", "recommonmark", "Jinja2<3.1") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py b/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py index 3566846d..08e60133 100644 --- a/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py +++ b/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py @@ -1461,7 +1461,9 @@ def test_prediction_client_client_info(self): "google.cloud.automl_v1beta1.gapic.prediction_service_client.PredictionServiceClient" ) with patch_prediction_client as MockPredictionClient: - client = automl_v1beta1.TablesClient(client_info=client_info_mock) + client = automl_v1beta1.TablesClient( + client_info=client_info_mock, credentials=AnonymousCredentials() + ) _, prediction_client_kwargs = MockPredictionClient.call_args assert "client_info" in prediction_client_kwargs assert prediction_client_kwargs["client_info"] == client_info_mock From 8cfb2e51f6f47065100bc971ab778a1b9ded8442 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Fri, 1 Apr 2022 13:54:15 -0600 Subject: [PATCH 2/3] fix(deps): require google-api-core >= 1.31.5, >= 2.3.2 on v1 release (#355) Allow google-api-core<3.0.0dev on previous release of library. This will be followed by a release PR. --- docs/conf.py | 12 +- .../gapic/prediction_service_client.py | 6 +- .../proto/prediction_service_pb2_grpc.py | 72 +++--- .../cloud/automl_v1/proto/service_pb2_grpc.py | 155 ++++++------- .../gapic/prediction_service_client.py | 6 +- .../proto/prediction_service_pb2_grpc.py | 82 +++---- .../automl_v1beta1/proto/service_pb2_grpc.py | 205 ++++++++---------- .../automl_v1beta1/tables/tables_client.py | 16 +- noxfile.py | 2 +- setup.py | 2 +- 10 files changed, 269 insertions(+), 289 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0b6aebeb..d8c4ea10 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -65,9 +65,9 @@ master_doc = "index" # General information about the project. -project = u"google-cloud-automl" -copyright = u"2019, Google" -author = u"Google APIs" +project = "google-cloud-automl" +copyright = "2019, Google" +author = "Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -261,7 +261,7 @@ ( master_doc, "google-cloud-automl.tex", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", author, "manual", ) @@ -296,7 +296,7 @@ ( master_doc, "google-cloud-automl", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", [author], 1, ) @@ -315,7 +315,7 @@ ( master_doc, "google-cloud-automl", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", author, "google-cloud-automl", "google-cloud-automl Library", diff --git a/google/cloud/automl_v1/gapic/prediction_service_client.py b/google/cloud/automl_v1/gapic/prediction_service_client.py index d6df5e54..b3c23621 100644 --- a/google/cloud/automl_v1/gapic/prediction_service_client.py +++ b/google/cloud/automl_v1/gapic/prediction_service_client.py @@ -185,8 +185,10 @@ def __init__( ) self.transport = transport else: - self.transport = prediction_service_grpc_transport.PredictionServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + self.transport = ( + prediction_service_grpc_transport.PredictionServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) ) if client_info is None: diff --git a/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py b/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py index 1970e0b2..03418f2a 100644 --- a/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py +++ b/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py @@ -12,16 +12,16 @@ class PredictionServiceStub(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Predict = channel.unary_unary( "/google.cloud.automl.v1.PredictionService/Predict", request_serializer=google_dot_cloud_dot_automl__v1_dot_proto_dot_prediction__service__pb2.PredictRequest.SerializeToString, @@ -37,45 +37,45 @@ def __init__(self, channel): class PredictionServiceServicer(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def Predict(self, request, context): """Perform an online prediction. The prediction result will be directly - returned in the response. - Available for following ML problems, and their expected request payloads: - * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Text Classification - TextSnippet, content up to 60,000 characters, - UTF-8 encoded. - * Text Extraction - TextSnippet, content up to 30,000 characters, - UTF-8 NFC encoded. - * Translation - TextSnippet, content up to 25,000 characters, UTF-8 - encoded. - * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 - encoded. - """ + returned in the response. + Available for following ML problems, and their expected request payloads: + * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Text Classification - TextSnippet, content up to 60,000 characters, + UTF-8 encoded. + * Text Extraction - TextSnippet, content up to 30,000 characters, + UTF-8 NFC encoded. + * Translation - TextSnippet, content up to 25,000 characters, UTF-8 + encoded. + * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 + encoded. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def BatchPredict(self, request, context): """Perform a batch prediction. Unlike the online - [Predict][google.cloud.automl.v1.PredictionService.Predict], batch - prediction result won't be immediately available in the response. Instead, - a long running operation object is returned. User can poll the operation - result via [GetOperation][google.longrunning.Operations.GetOperation] - method. Once the operation is done, - [BatchPredictResult][google.cloud.automl.v1.BatchPredictResult] is returned - in the [response][google.longrunning.Operation.response] field. Available - for following ML problems: - * Image Classification - * Image Object Detection - * Text Extraction - """ + [Predict][google.cloud.automl.v1.PredictionService.Predict], batch + prediction result won't be immediately available in the response. Instead, + a long running operation object is returned. User can poll the operation + result via [GetOperation][google.longrunning.Operations.GetOperation] + method. Once the operation is done, + [BatchPredictResult][google.cloud.automl.v1.BatchPredictResult] is returned + in the [response][google.longrunning.Operation.response] field. Available + for following ML problems: + * Image Classification + * Image Object Detection + * Text Extraction + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1/proto/service_pb2_grpc.py b/google/cloud/automl_v1/proto/service_pb2_grpc.py index 0ad90914..d45d47e2 100644 --- a/google/cloud/automl_v1/proto/service_pb2_grpc.py +++ b/google/cloud/automl_v1/proto/service_pb2_grpc.py @@ -24,26 +24,26 @@ class AutoMlStub(object): """AutoML Server API. - The resource names are assigned by the server. - The server never reuses names that it has created after the resources with - those names are deleted. + The resource names are assigned by the server. + The server never reuses names that it has created after the resources with + those names are deleted. - An ID of a resource is the last element of the item's resource name. For - `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then - the id for the item is `{dataset_id}`. + An ID of a resource is the last element of the item's resource name. For + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then + the id for the item is `{dataset_id}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.CreateDataset = channel.unary_unary( "/google.cloud.automl.v1.AutoMl/CreateDataset", request_serializer=google_dot_cloud_dot_automl__v1_dot_proto_dot_service__pb2.CreateDatasetRequest.SerializeToString, @@ -139,139 +139,130 @@ def __init__(self, channel): class AutoMlServicer(object): """AutoML Server API. - The resource names are assigned by the server. - The server never reuses names that it has created after the resources with - those names are deleted. + The resource names are assigned by the server. + The server never reuses names that it has created after the resources with + those names are deleted. - An ID of a resource is the last element of the item's resource name. For - `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then - the id for the item is `{dataset_id}`. + An ID of a resource is the last element of the item's resource name. For + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then + the id for the item is `{dataset_id}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def CreateDataset(self, request, context): - """Creates a dataset. - """ + """Creates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetDataset(self, request, context): - """Gets a dataset. - """ + """Gets a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListDatasets(self, request, context): - """Lists datasets in a project. - """ + """Lists datasets in a project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateDataset(self, request, context): - """Updates a dataset. - """ + """Updates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteDataset(self, request, context): """Deletes a dataset and all of its contents. - Returns empty response in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns empty response in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ImportData(self, request, context): - """Imports data into a dataset. - """ + """Imports data into a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportData(self, request, context): """Exports dataset's data to the provided output location. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetAnnotationSpec(self, request, context): - """Gets an annotation spec. - """ + """Gets an annotation spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def CreateModel(self, request, context): """Creates a model. - Returns a Model in the [response][google.longrunning.Operation.response] - field when it completes. - When you create a model, several model evaluations are created for it: - a global evaluation, and one evaluation for each annotation spec. - """ + Returns a Model in the [response][google.longrunning.Operation.response] + field when it completes. + When you create a model, several model evaluations are created for it: + a global evaluation, and one evaluation for each annotation spec. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModel(self, request, context): - """Gets a model. - """ + """Gets a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModels(self, request, context): - """Lists models. - """ + """Lists models.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteModel(self, request, context): """Deletes a model. - Returns `google.protobuf.Empty` in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns `google.protobuf.Empty` in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateModel(self, request, context): - """Updates a model. - """ + """Updates a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeployModel(self, request, context): """Deploys a model. If a model is already deployed, deploying it with the - same parameters has no effect. Deploying with different parametrs - (as e.g. changing + same parameters has no effect. Deploying with different parametrs + (as e.g. changing - [node_number][google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata.node_number]) - will reset the deployment state without pausing the model's availability. + [node_number][google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata.node_number]) + will reset the deployment state without pausing the model's availability. - Only applicable for Text Classification, Image Object Detection; all other - domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection; all other + domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -279,39 +270,37 @@ def DeployModel(self, request, context): def UndeployModel(self, request, context): """Undeploys a model. If the model is not deployed this method has no effect. - Only applicable for Text Classification, Image Object Detection; - all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection; + all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportModel(self, request, context): """Exports a trained, "export-able", model to a user specified Google Cloud - Storage location. A model is considered export-able if and only if it has - an export format defined for it in - [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. + Storage location. A model is considered export-able if and only if it has + an export format defined for it in + [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModelEvaluation(self, request, context): - """Gets a model evaluation. - """ + """Gets a model evaluation.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModelEvaluations(self, request, context): - """Lists model evaluations. - """ + """Lists model evaluations.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/gapic/prediction_service_client.py b/google/cloud/automl_v1beta1/gapic/prediction_service_client.py index 57cedc90..14888426 100644 --- a/google/cloud/automl_v1beta1/gapic/prediction_service_client.py +++ b/google/cloud/automl_v1beta1/gapic/prediction_service_client.py @@ -189,8 +189,10 @@ def __init__( ) self.transport = transport else: - self.transport = prediction_service_grpc_transport.PredictionServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + self.transport = ( + prediction_service_grpc_transport.PredictionServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) ) if client_info is None: diff --git a/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py b/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py index 8049017e..39d41bb1 100644 --- a/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py +++ b/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py @@ -12,16 +12,16 @@ class PredictionServiceStub(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Predict = channel.unary_unary( "/google.cloud.automl.v1beta1.PredictionService/Predict", request_serializer=google_dot_cloud_dot_automl__v1beta1_dot_proto_dot_prediction__service__pb2.PredictRequest.SerializeToString, @@ -37,51 +37,51 @@ def __init__(self, channel): class PredictionServiceServicer(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def Predict(self, request, context): """Perform an online prediction. The prediction result will be directly - returned in the response. - Available for following ML problems, and their expected request payloads: - * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Text Classification - TextSnippet, content up to 60,000 characters, - UTF-8 encoded. - * Text Extraction - TextSnippet, content up to 30,000 characters, - UTF-8 NFC encoded. - * Translation - TextSnippet, content up to 25,000 characters, UTF-8 - encoded. - * Tables - Row, with column values matching the columns of the model, - up to 5MB. Not available for FORECASTING + returned in the response. + Available for following ML problems, and their expected request payloads: + * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Text Classification - TextSnippet, content up to 60,000 characters, + UTF-8 encoded. + * Text Extraction - TextSnippet, content up to 30,000 characters, + UTF-8 NFC encoded. + * Translation - TextSnippet, content up to 25,000 characters, UTF-8 + encoded. + * Tables - Row, with column values matching the columns of the model, + up to 5MB. Not available for FORECASTING - [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. - * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 - encoded. - """ + [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. + * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 + encoded. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def BatchPredict(self, request, context): """Perform a batch prediction. Unlike the online - [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch - prediction result won't be immediately available in the response. Instead, - a long running operation object is returned. User can poll the operation - result via [GetOperation][google.longrunning.Operations.GetOperation] - method. Once the operation is done, - [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is - returned in the [response][google.longrunning.Operation.response] field. - Available for following ML problems: - * Image Classification - * Image Object Detection - * Video Classification - * Video Object Tracking * Text Extraction - * Tables - """ + [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch + prediction result won't be immediately available in the response. Instead, + a long running operation object is returned. User can poll the operation + result via [GetOperation][google.longrunning.Operations.GetOperation] + method. Once the operation is done, + [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is + returned in the [response][google.longrunning.Operation.response] field. + Available for following ML problems: + * Image Classification + * Image Object Detection + * Video Classification + * Video Object Tracking * Text Extraction + * Tables + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py b/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py index eb049c20..c162e8c4 100644 --- a/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py +++ b/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py @@ -30,26 +30,26 @@ class AutoMlStub(object): """AutoML Server API. - The resource names are assigned by the server. - The server never reuses names that it has created after the resources with - those names are deleted. + The resource names are assigned by the server. + The server never reuses names that it has created after the resources with + those names are deleted. - An ID of a resource is the last element of the item's resource name. For - `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then - the id for the item is `{dataset_id}`. + An ID of a resource is the last element of the item's resource name. For + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then + the id for the item is `{dataset_id}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.CreateDataset = channel.unary_unary( "/google.cloud.automl.v1beta1.AutoMl/CreateDataset", request_serializer=google_dot_cloud_dot_automl__v1beta1_dot_proto_dot_service__pb2.CreateDatasetRequest.SerializeToString, @@ -175,181 +175,168 @@ def __init__(self, channel): class AutoMlServicer(object): """AutoML Server API. - The resource names are assigned by the server. - The server never reuses names that it has created after the resources with - those names are deleted. + The resource names are assigned by the server. + The server never reuses names that it has created after the resources with + those names are deleted. - An ID of a resource is the last element of the item's resource name. For - `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then - the id for the item is `{dataset_id}`. + An ID of a resource is the last element of the item's resource name. For + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then + the id for the item is `{dataset_id}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def CreateDataset(self, request, context): - """Creates a dataset. - """ + """Creates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetDataset(self, request, context): - """Gets a dataset. - """ + """Gets a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListDatasets(self, request, context): - """Lists datasets in a project. - """ + """Lists datasets in a project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateDataset(self, request, context): - """Updates a dataset. - """ + """Updates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteDataset(self, request, context): """Deletes a dataset and all of its contents. - Returns empty response in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns empty response in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ImportData(self, request, context): """Imports data into a dataset. - For Tables this method can only be called on an empty Dataset. - - For Tables: - * A - [schema_inference_version][google.cloud.automl.v1beta1.InputConfig.params] - parameter must be explicitly set. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + For Tables this method can only be called on an empty Dataset. + + For Tables: + * A + [schema_inference_version][google.cloud.automl.v1beta1.InputConfig.params] + parameter must be explicitly set. + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportData(self, request, context): """Exports dataset's data to the provided output location. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetAnnotationSpec(self, request, context): - """Gets an annotation spec. - """ + """Gets an annotation spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetTableSpec(self, request, context): - """Gets a table spec. - """ + """Gets a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListTableSpecs(self, request, context): - """Lists table specs in a dataset. - """ + """Lists table specs in a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateTableSpec(self, request, context): - """Updates a table spec. - """ + """Updates a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetColumnSpec(self, request, context): - """Gets a column spec. - """ + """Gets a column spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListColumnSpecs(self, request, context): - """Lists column specs in a table spec. - """ + """Lists column specs in a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateColumnSpec(self, request, context): - """Updates a column spec. - """ + """Updates a column spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def CreateModel(self, request, context): """Creates a model. - Returns a Model in the [response][google.longrunning.Operation.response] - field when it completes. - When you create a model, several model evaluations are created for it: - a global evaluation, and one evaluation for each annotation spec. - """ + Returns a Model in the [response][google.longrunning.Operation.response] + field when it completes. + When you create a model, several model evaluations are created for it: + a global evaluation, and one evaluation for each annotation spec. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModel(self, request, context): - """Gets a model. - """ + """Gets a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModels(self, request, context): - """Lists models. - """ + """Lists models.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteModel(self, request, context): """Deletes a model. - Returns `google.protobuf.Empty` in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns `google.protobuf.Empty` in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeployModel(self, request, context): """Deploys a model. If a model is already deployed, deploying it with the - same parameters has no effect. Deploying with different parametrs - (as e.g. changing + same parameters has no effect. Deploying with different parametrs + (as e.g. changing - [node_number][google.cloud.automl.v1beta1.ImageObjectDetectionModelDeploymentMetadata.node_number]) - will reset the deployment state without pausing the model's availability. + [node_number][google.cloud.automl.v1beta1.ImageObjectDetectionModelDeploymentMetadata.node_number]) + will reset the deployment state without pausing the model's availability. - Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -357,60 +344,58 @@ def DeployModel(self, request, context): def UndeployModel(self, request, context): """Undeploys a model. If the model is not deployed this method has no effect. - Only applicable for Text Classification, Image Object Detection and Tables; - all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection and Tables; + all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportModel(self, request, context): """Exports a trained, "export-able", model to a user specified Google Cloud - Storage location. A model is considered export-able if and only if it has - an export format defined for it in + Storage location. A model is considered export-able if and only if it has + an export format defined for it in - [ModelExportOutputConfig][google.cloud.automl.v1beta1.ModelExportOutputConfig]. + [ModelExportOutputConfig][google.cloud.automl.v1beta1.ModelExportOutputConfig]. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportEvaluatedExamples(self, request, context): """Exports examples on which the model was evaluated (i.e. which were in the - TEST set of the dataset the model was created from), together with their - ground truth annotations and the annotations created (predicted) by the - model. - The examples, ground truth and predictions are exported in the state - they were at the moment the model was evaluated. + TEST set of the dataset the model was created from), together with their + ground truth annotations and the annotations created (predicted) by the + model. + The examples, ground truth and predictions are exported in the state + they were at the moment the model was evaluated. - This export is available only for 30 days since the model evaluation is - created. + This export is available only for 30 days since the model evaluation is + created. - Currently only available for Tables. + Currently only available for Tables. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModelEvaluation(self, request, context): - """Gets a model evaluation. - """ + """Gets a model evaluation.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModelEvaluations(self, request, context): - """Lists model evaluations. - """ + """Lists model evaluations.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/tables/tables_client.py b/google/cloud/automl_v1beta1/tables/tables_client.py index 378eca61..fd36c327 100644 --- a/google/cloud/automl_v1beta1/tables/tables_client.py +++ b/google/cloud/automl_v1beta1/tables/tables_client.py @@ -35,12 +35,12 @@ def to_proto_value(value): """translates a Python value to a google.protobuf.Value. - Args: - value: The Python value to be translated. + Args: + value: The Python value to be translated. - Returns: - Tuple of the translated google.protobuf.Value and error if any. - """ + Returns: + Tuple of the translated google.protobuf.Value and error if any. + """ # possible Python types (this is a Python3 module): # https://simplejson.readthedocs.io/en/latest/#encoders-and-decoders # JSON Python 2 Python 3 @@ -183,8 +183,10 @@ def __init__( self.auto_ml_client = client if prediction_client is None: - self.prediction_client = gapic.prediction_service_client.PredictionServiceClient( - credentials=credentials, client_info=client_info_, **kwargs + self.prediction_client = ( + gapic.prediction_service_client.PredictionServiceClient( + credentials=credentials, client_info=client_info_, **kwargs + ) ) else: self.prediction_client = prediction_client diff --git a/noxfile.py b/noxfile.py index dfccb58c..e1a03258 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,7 +23,7 @@ import nox -BLACK_VERSION = "black==19.3b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] if os.path.exists("samples"): diff --git a/setup.py b/setup.py index e6af67da..029c0461 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ version = "1.0.1" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", + "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", 'enum34; python_version < "3.4"', ] extras = { From 65d705099394c5a6de7e33c70245e2c133a7cdc2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 08:59:41 -0600 Subject: [PATCH 3/3] chore(v1): release 1.0.2 (#368) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b1591ec..d4826806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-cloud-automl/#history +### [1.0.2](https://github.com/googleapis/python-automl/compare/v1.0.1...v1.0.2) (2022-04-04) + + +### Bug Fixes + +* **deps:** require google-api-core >= 1.31.5, >= 2.3.2 on v1 release ([#355](https://github.com/googleapis/python-automl/issues/355)) ([8cfb2e5](https://github.com/googleapis/python-automl/commit/8cfb2e51f6f47065100bc971ab778a1b9ded8442)) + ### [1.0.1](https://www.github.com/googleapis/python-automl/compare/v1.0.0...v1.0.1) (2020-06-18) diff --git a/setup.py b/setup.py index 029c0461..0cef01cd 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ name = "google-cloud-automl" description = "Cloud AutoML API client library" -version = "1.0.1" +version = "1.0.2" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",