diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# 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. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f070a..129fd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,25 @@ # Changelog -### [1.0.2](https://github.com/googleapis/python-bigquery-logging/compare/v1.0.1...v1.0.2) (2022-03-05) +## [1.0.3](https://github.com/googleapis/python-bigquery-logging/compare/v1.0.2...v1.0.3) (2022-06-03) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#92](https://github.com/googleapis/python-bigquery-logging/issues/92)) ([c22b72f](https://github.com/googleapis/python-bigquery-logging/commit/c22b72fb6d2b943b5734de18b357a69d03473fda)) + + +### Documentation + +* fix changelog header to consistent size ([#93](https://github.com/googleapis/python-bigquery-logging/issues/93)) ([598a61b](https://github.com/googleapis/python-bigquery-logging/commit/598a61bf74058fa6bafb9cb84ccc262512f2207a)) + +## [1.0.2](https://github.com/googleapis/python-bigquery-logging/compare/v1.0.1...v1.0.2) (2022-03-05) ### Bug Fixes * **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#72](https://github.com/googleapis/python-bigquery-logging/issues/72)) ([609bf19](https://github.com/googleapis/python-bigquery-logging/commit/609bf19d1b3d4b7dc594f8e4a0904af0351143c7)) -### [1.0.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v1.0.0...v1.0.1) (2021-11-01) +## [1.0.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v1.0.0...v1.0.1) (2021-11-01) ### Bug Fixes @@ -33,14 +45,14 @@ * add context manager support in client ([#43](https://www.github.com/googleapis/python-bigquery-logging/issues/43)) ([493010c](https://www.github.com/googleapis/python-bigquery-logging/commit/493010cbfb288a75a58761d5281993009013e1b6)) -### [0.2.2](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.1...v0.2.2) (2021-09-24) +## [0.2.2](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.1...v0.2.2) (2021-09-24) ### Bug Fixes * add 'dict' annotation type to 'request' ([546c1b3](https://www.github.com/googleapis/python-bigquery-logging/commit/546c1b3539f03a172eed2cdf202615a5fa37418f)) -### [0.2.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.0...v0.2.1) (2021-07-29) +## [0.2.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.0...v0.2.1) (2021-07-29) ### Bug Fixes @@ -69,7 +81,7 @@ * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-bigquery-logging/issues/1127)) ([#7](https://www.github.com/googleapis/python-bigquery-logging/issues/7)) ([53f6808](https://www.github.com/googleapis/python-bigquery-logging/commit/53f6808fa2b317ee5f9a4ca0a54214267cc1dce0)), closes [#1126](https://www.github.com/googleapis/python-bigquery-logging/issues/1126) -### [0.1.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.1.0...v0.1.1) (2021-06-16) +## [0.1.1](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.1.0...v0.1.1) (2021-06-16) ### Bug Fixes diff --git a/docs/conf.py b/docs/conf.py index 92a1493..f4b18e9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/bigquery_logging/__init__.py b/google/cloud/bigquery_logging/__init__.py index 138a7b6..2578334 100644 --- a/google/cloud/bigquery_logging/__init__.py +++ b/google/cloud/bigquery_logging/__init__.py @@ -15,41 +15,43 @@ # -from google.cloud.bigquery_logging_v1.types.audit_data import AuditData -from google.cloud.bigquery_logging_v1.types.audit_data import BigQueryAcl -from google.cloud.bigquery_logging_v1.types.audit_data import Dataset -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInfo -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInsertRequest -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetInsertResponse -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetListRequest -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetName -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetUpdateRequest -from google.cloud.bigquery_logging_v1.types.audit_data import DatasetUpdateResponse -from google.cloud.bigquery_logging_v1.types.audit_data import EncryptionInfo -from google.cloud.bigquery_logging_v1.types.audit_data import Job -from google.cloud.bigquery_logging_v1.types.audit_data import JobCompletedEvent -from google.cloud.bigquery_logging_v1.types.audit_data import JobConfiguration -from google.cloud.bigquery_logging_v1.types.audit_data import JobGetQueryResultsRequest -from google.cloud.bigquery_logging_v1.types.audit_data import JobGetQueryResultsResponse -from google.cloud.bigquery_logging_v1.types.audit_data import JobInsertRequest -from google.cloud.bigquery_logging_v1.types.audit_data import JobInsertResponse -from google.cloud.bigquery_logging_v1.types.audit_data import JobName -from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryDoneResponse -from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryRequest -from google.cloud.bigquery_logging_v1.types.audit_data import JobQueryResponse -from google.cloud.bigquery_logging_v1.types.audit_data import JobStatistics -from google.cloud.bigquery_logging_v1.types.audit_data import JobStatus -from google.cloud.bigquery_logging_v1.types.audit_data import Table -from google.cloud.bigquery_logging_v1.types.audit_data import TableDataListRequest -from google.cloud.bigquery_logging_v1.types.audit_data import TableDataReadEvent -from google.cloud.bigquery_logging_v1.types.audit_data import TableDefinition -from google.cloud.bigquery_logging_v1.types.audit_data import TableInfo -from google.cloud.bigquery_logging_v1.types.audit_data import TableInsertRequest -from google.cloud.bigquery_logging_v1.types.audit_data import TableInsertResponse -from google.cloud.bigquery_logging_v1.types.audit_data import TableName -from google.cloud.bigquery_logging_v1.types.audit_data import TableUpdateRequest -from google.cloud.bigquery_logging_v1.types.audit_data import TableUpdateResponse -from google.cloud.bigquery_logging_v1.types.audit_data import TableViewDefinition +from google.cloud.bigquery_logging_v1.types.audit_data import ( + AuditData, + BigQueryAcl, + Dataset, + DatasetInfo, + DatasetInsertRequest, + DatasetInsertResponse, + DatasetListRequest, + DatasetName, + DatasetUpdateRequest, + DatasetUpdateResponse, + EncryptionInfo, + Job, + JobCompletedEvent, + JobConfiguration, + JobGetQueryResultsRequest, + JobGetQueryResultsResponse, + JobInsertRequest, + JobInsertResponse, + JobName, + JobQueryDoneResponse, + JobQueryRequest, + JobQueryResponse, + JobStatistics, + JobStatus, + Table, + TableDataListRequest, + TableDataReadEvent, + TableDefinition, + TableInfo, + TableInsertRequest, + TableInsertResponse, + TableName, + TableUpdateRequest, + TableUpdateResponse, + TableViewDefinition, +) __all__ = ( "AuditData", diff --git a/google/cloud/bigquery_logging_v1/__init__.py b/google/cloud/bigquery_logging_v1/__init__.py index fa17225..e8ea0a3 100644 --- a/google/cloud/bigquery_logging_v1/__init__.py +++ b/google/cloud/bigquery_logging_v1/__init__.py @@ -15,41 +15,43 @@ # -from .types.audit_data import AuditData -from .types.audit_data import BigQueryAcl -from .types.audit_data import Dataset -from .types.audit_data import DatasetInfo -from .types.audit_data import DatasetInsertRequest -from .types.audit_data import DatasetInsertResponse -from .types.audit_data import DatasetListRequest -from .types.audit_data import DatasetName -from .types.audit_data import DatasetUpdateRequest -from .types.audit_data import DatasetUpdateResponse -from .types.audit_data import EncryptionInfo -from .types.audit_data import Job -from .types.audit_data import JobCompletedEvent -from .types.audit_data import JobConfiguration -from .types.audit_data import JobGetQueryResultsRequest -from .types.audit_data import JobGetQueryResultsResponse -from .types.audit_data import JobInsertRequest -from .types.audit_data import JobInsertResponse -from .types.audit_data import JobName -from .types.audit_data import JobQueryDoneResponse -from .types.audit_data import JobQueryRequest -from .types.audit_data import JobQueryResponse -from .types.audit_data import JobStatistics -from .types.audit_data import JobStatus -from .types.audit_data import Table -from .types.audit_data import TableDataListRequest -from .types.audit_data import TableDataReadEvent -from .types.audit_data import TableDefinition -from .types.audit_data import TableInfo -from .types.audit_data import TableInsertRequest -from .types.audit_data import TableInsertResponse -from .types.audit_data import TableName -from .types.audit_data import TableUpdateRequest -from .types.audit_data import TableUpdateResponse -from .types.audit_data import TableViewDefinition +from .types.audit_data import ( + AuditData, + BigQueryAcl, + Dataset, + DatasetInfo, + DatasetInsertRequest, + DatasetInsertResponse, + DatasetListRequest, + DatasetName, + DatasetUpdateRequest, + DatasetUpdateResponse, + EncryptionInfo, + Job, + JobCompletedEvent, + JobConfiguration, + JobGetQueryResultsRequest, + JobGetQueryResultsResponse, + JobInsertRequest, + JobInsertResponse, + JobName, + JobQueryDoneResponse, + JobQueryRequest, + JobQueryResponse, + JobStatistics, + JobStatus, + Table, + TableDataListRequest, + TableDataReadEvent, + TableDefinition, + TableInfo, + TableInsertRequest, + TableInsertResponse, + TableName, + TableUpdateRequest, + TableUpdateResponse, + TableViewDefinition, +) __all__ = ( "AuditData", diff --git a/google/cloud/bigquery_logging_v1/types/audit_data.py b/google/cloud/bigquery_logging_v1/types/audit_data.py index 40a31dc..281c19a 100644 --- a/google/cloud/bigquery_logging_v1/types/audit_data.py +++ b/google/cloud/bigquery_logging_v1/types/audit_data.py @@ -13,14 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.logging.v1", @@ -162,31 +160,58 @@ class AuditData(proto.Message): """ table_insert_request = proto.Field( - proto.MESSAGE, number=1, oneof="request", message="TableInsertRequest", + proto.MESSAGE, + number=1, + oneof="request", + message="TableInsertRequest", ) table_update_request = proto.Field( - proto.MESSAGE, number=16, oneof="request", message="TableUpdateRequest", + proto.MESSAGE, + number=16, + oneof="request", + message="TableUpdateRequest", ) dataset_list_request = proto.Field( - proto.MESSAGE, number=2, oneof="request", message="DatasetListRequest", + proto.MESSAGE, + number=2, + oneof="request", + message="DatasetListRequest", ) dataset_insert_request = proto.Field( - proto.MESSAGE, number=3, oneof="request", message="DatasetInsertRequest", + proto.MESSAGE, + number=3, + oneof="request", + message="DatasetInsertRequest", ) dataset_update_request = proto.Field( - proto.MESSAGE, number=4, oneof="request", message="DatasetUpdateRequest", + proto.MESSAGE, + number=4, + oneof="request", + message="DatasetUpdateRequest", ) job_insert_request = proto.Field( - proto.MESSAGE, number=5, oneof="request", message="JobInsertRequest", + proto.MESSAGE, + number=5, + oneof="request", + message="JobInsertRequest", ) job_query_request = proto.Field( - proto.MESSAGE, number=6, oneof="request", message="JobQueryRequest", + proto.MESSAGE, + number=6, + oneof="request", + message="JobQueryRequest", ) job_get_query_results_request = proto.Field( - proto.MESSAGE, number=7, oneof="request", message="JobGetQueryResultsRequest", + proto.MESSAGE, + number=7, + oneof="request", + message="JobGetQueryResultsRequest", ) table_data_list_request = proto.Field( - proto.MESSAGE, number=8, oneof="request", message="TableDataListRequest", + proto.MESSAGE, + number=8, + oneof="request", + message="TableDataListRequest", ) set_iam_policy_request = proto.Field( proto.MESSAGE, @@ -195,22 +220,40 @@ class AuditData(proto.Message): message=iam_policy_pb2.SetIamPolicyRequest, ) table_insert_response = proto.Field( - proto.MESSAGE, number=9, oneof="response", message="TableInsertResponse", + proto.MESSAGE, + number=9, + oneof="response", + message="TableInsertResponse", ) table_update_response = proto.Field( - proto.MESSAGE, number=10, oneof="response", message="TableUpdateResponse", + proto.MESSAGE, + number=10, + oneof="response", + message="TableUpdateResponse", ) dataset_insert_response = proto.Field( - proto.MESSAGE, number=11, oneof="response", message="DatasetInsertResponse", + proto.MESSAGE, + number=11, + oneof="response", + message="DatasetInsertResponse", ) dataset_update_response = proto.Field( - proto.MESSAGE, number=12, oneof="response", message="DatasetUpdateResponse", + proto.MESSAGE, + number=12, + oneof="response", + message="DatasetUpdateResponse", ) job_insert_response = proto.Field( - proto.MESSAGE, number=18, oneof="response", message="JobInsertResponse", + proto.MESSAGE, + number=18, + oneof="response", + message="JobInsertResponse", ) job_query_response = proto.Field( - proto.MESSAGE, number=13, oneof="response", message="JobQueryResponse", + proto.MESSAGE, + number=13, + oneof="response", + message="JobQueryResponse", ) job_get_query_results_response = proto.Field( proto.MESSAGE, @@ -219,16 +262,26 @@ class AuditData(proto.Message): message="JobGetQueryResultsResponse", ) job_query_done_response = proto.Field( - proto.MESSAGE, number=15, oneof="response", message="JobQueryDoneResponse", + proto.MESSAGE, + number=15, + oneof="response", + message="JobQueryDoneResponse", ) policy_response = proto.Field( - proto.MESSAGE, number=21, oneof="response", message=policy_pb2.Policy, + proto.MESSAGE, + number=21, + oneof="response", + message=policy_pb2.Policy, ) job_completed_event = proto.Field( - proto.MESSAGE, number=17, message="JobCompletedEvent", + proto.MESSAGE, + number=17, + message="JobCompletedEvent", ) table_data_read_events = proto.RepeatedField( - proto.MESSAGE, number=19, message="TableDataReadEvent", + proto.MESSAGE, + number=19, + message="TableDataReadEvent", ) @@ -240,7 +293,11 @@ class TableInsertRequest(proto.Message): The new table. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Table",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Table", + ) class TableUpdateRequest(proto.Message): @@ -251,7 +308,11 @@ class TableUpdateRequest(proto.Message): The table to be updated. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Table",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Table", + ) class TableInsertResponse(proto.Message): @@ -262,7 +323,11 @@ class TableInsertResponse(proto.Message): Final state of the inserted table. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Table",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Table", + ) class TableUpdateResponse(proto.Message): @@ -273,7 +338,11 @@ class TableUpdateResponse(proto.Message): Final state of the updated table. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Table",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Table", + ) class DatasetListRequest(proto.Message): @@ -285,7 +354,10 @@ class DatasetListRequest(proto.Message): hidden ones. """ - list_all = proto.Field(proto.BOOL, number=1,) + list_all = proto.Field( + proto.BOOL, + number=1, + ) class DatasetInsertRequest(proto.Message): @@ -296,7 +368,11 @@ class DatasetInsertRequest(proto.Message): The dataset to be inserted. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Dataset", + ) class DatasetInsertResponse(proto.Message): @@ -307,7 +383,11 @@ class DatasetInsertResponse(proto.Message): Final state of the inserted dataset. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Dataset", + ) class DatasetUpdateRequest(proto.Message): @@ -318,7 +398,11 @@ class DatasetUpdateRequest(proto.Message): The dataset to be updated. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Dataset", + ) class DatasetUpdateResponse(proto.Message): @@ -329,7 +413,11 @@ class DatasetUpdateResponse(proto.Message): Final state of the updated dataset. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Dataset", + ) class JobInsertRequest(proto.Message): @@ -340,7 +428,11 @@ class JobInsertRequest(proto.Message): Job insert request. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Job",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Job", + ) class JobInsertResponse(proto.Message): @@ -351,7 +443,11 @@ class JobInsertResponse(proto.Message): Job insert response. """ - resource = proto.Field(proto.MESSAGE, number=1, message="Job",) + resource = proto.Field( + proto.MESSAGE, + number=1, + message="Job", + ) class JobQueryRequest(proto.Message): @@ -372,11 +468,27 @@ class JobQueryRequest(proto.Message): check that it would run. """ - query = proto.Field(proto.STRING, number=1,) - max_results = proto.Field(proto.UINT32, number=2,) - default_dataset = proto.Field(proto.MESSAGE, number=3, message="DatasetName",) - project_id = proto.Field(proto.STRING, number=4,) - dry_run = proto.Field(proto.BOOL, number=5,) + query = proto.Field( + proto.STRING, + number=1, + ) + max_results = proto.Field( + proto.UINT32, + number=2, + ) + default_dataset = proto.Field( + proto.MESSAGE, + number=3, + message="DatasetName", + ) + project_id = proto.Field( + proto.STRING, + number=4, + ) + dry_run = proto.Field( + proto.BOOL, + number=5, + ) class JobQueryResponse(proto.Message): @@ -390,8 +502,15 @@ class JobQueryResponse(proto.Message): Information about the queried job. """ - total_results = proto.Field(proto.UINT64, number=1,) - job = proto.Field(proto.MESSAGE, number=2, message="Job",) + total_results = proto.Field( + proto.UINT64, + number=1, + ) + job = proto.Field( + proto.MESSAGE, + number=2, + message="Job", + ) class JobGetQueryResultsRequest(proto.Message): @@ -404,8 +523,14 @@ class JobGetQueryResultsRequest(proto.Message): Zero-based row number at which to start. """ - max_results = proto.Field(proto.UINT32, number=1,) - start_row = proto.Field(proto.UINT64, number=2,) + max_results = proto.Field( + proto.UINT32, + number=1, + ) + start_row = proto.Field( + proto.UINT64, + number=2, + ) class JobGetQueryResultsResponse(proto.Message): @@ -420,8 +545,15 @@ class JobGetQueryResultsResponse(proto.Message): ``job.status.errorResult`` is also present. """ - total_results = proto.Field(proto.UINT64, number=1,) - job = proto.Field(proto.MESSAGE, number=2, message="Job",) + total_results = proto.Field( + proto.UINT64, + number=1, + ) + job = proto.Field( + proto.MESSAGE, + number=2, + message="Job", + ) class JobQueryDoneResponse(proto.Message): @@ -433,7 +565,11 @@ class JobQueryDoneResponse(proto.Message): ``job.status.state`` is ``DONE``. """ - job = proto.Field(proto.MESSAGE, number=1, message="Job",) + job = proto.Field( + proto.MESSAGE, + number=1, + message="Job", + ) class JobCompletedEvent(proto.Message): @@ -446,8 +582,15 @@ class JobCompletedEvent(proto.Message): Job information. """ - event_name = proto.Field(proto.STRING, number=1,) - job = proto.Field(proto.MESSAGE, number=2, message="Job",) + event_name = proto.Field( + proto.STRING, + number=1, + ) + job = proto.Field( + proto.MESSAGE, + number=2, + message="Job", + ) class TableDataReadEvent(proto.Message): @@ -465,8 +608,15 @@ class TableDataReadEvent(proto.Message): open a bug in the BigQuery issue tracker. """ - table_name = proto.Field(proto.MESSAGE, number=1, message="TableName",) - referenced_fields = proto.RepeatedField(proto.STRING, number=2,) + table_name = proto.Field( + proto.MESSAGE, + number=1, + message="TableName", + ) + referenced_fields = proto.RepeatedField( + proto.STRING, + number=2, + ) class TableDataListRequest(proto.Message): @@ -479,8 +629,14 @@ class TableDataListRequest(proto.Message): Maximum number of results to return. """ - start_row = proto.Field(proto.UINT64, number=1,) - max_results = proto.Field(proto.UINT32, number=2,) + start_row = proto.Field( + proto.UINT64, + number=1, + ) + max_results = proto.Field( + proto.UINT32, + number=2, + ) class Table(proto.Message): @@ -517,17 +673,50 @@ class Table(proto.Message): non-default encryption is used. """ - table_name = proto.Field(proto.MESSAGE, number=1, message="TableName",) - info = proto.Field(proto.MESSAGE, number=2, message="TableInfo",) - schema_json = proto.Field(proto.STRING, number=8,) - view = proto.Field(proto.MESSAGE, number=4, message="TableViewDefinition",) - expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + table_name = proto.Field( + proto.MESSAGE, + number=1, + message="TableName", + ) + info = proto.Field( + proto.MESSAGE, + number=2, + message="TableInfo", + ) + schema_json = proto.Field( + proto.STRING, + number=8, + ) + view = proto.Field( + proto.MESSAGE, + number=4, + message="TableViewDefinition", + ) + expire_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) truncate_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) + encryption = proto.Field( + proto.MESSAGE, + number=10, + message="EncryptionInfo", ) - update_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,) - encryption = proto.Field(proto.MESSAGE, number=10, message="EncryptionInfo",) class TableInfo(proto.Message): @@ -541,13 +730,23 @@ class TableInfo(proto.Message): A long description, perhaps several paragraphs, describing the table contents in detail. - labels (Sequence[google.cloud.bigquery_logging_v1.types.TableInfo.LabelsEntry]): + labels (Mapping[str, str]): Labels provided for the table. """ - friendly_name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - labels = proto.MapField(proto.STRING, proto.STRING, number=3,) + friendly_name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) class TableViewDefinition(proto.Message): @@ -558,7 +757,10 @@ class TableViewDefinition(proto.Message): SQL query defining the view. """ - query = proto.Field(proto.STRING, number=1,) + query = proto.Field( + proto.STRING, + number=1, + ) class Dataset(proto.Message): @@ -584,13 +786,35 @@ class Dataset(proto.Message): is empty, there is no default table expiration time. """ - dataset_name = proto.Field(proto.MESSAGE, number=1, message="DatasetName",) - info = proto.Field(proto.MESSAGE, number=2, message="DatasetInfo",) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - acl = proto.Field(proto.MESSAGE, number=6, message="BigQueryAcl",) + dataset_name = proto.Field( + proto.MESSAGE, + number=1, + message="DatasetName", + ) + info = proto.Field( + proto.MESSAGE, + number=2, + message="DatasetInfo", + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + acl = proto.Field( + proto.MESSAGE, + number=6, + message="BigQueryAcl", + ) default_table_expire_duration = proto.Field( - proto.MESSAGE, number=8, message=duration_pb2.Duration, + proto.MESSAGE, + number=8, + message=duration_pb2.Duration, ) @@ -605,13 +829,23 @@ class DatasetInfo(proto.Message): A long description, perhaps several paragraphs, describing the dataset contents in detail. - labels (Sequence[google.cloud.bigquery_logging_v1.types.DatasetInfo.LabelsEntry]): + labels (Mapping[str, str]): Labels provided for the dataset. """ - friendly_name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - labels = proto.MapField(proto.STRING, proto.STRING, number=3,) + friendly_name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) class BigQueryAcl(proto.Message): @@ -645,14 +879,37 @@ class Entry(proto.Message): Grants access to a BigQuery View. """ - role = proto.Field(proto.STRING, number=1,) - group_email = proto.Field(proto.STRING, number=2,) - user_email = proto.Field(proto.STRING, number=3,) - domain = proto.Field(proto.STRING, number=4,) - special_group = proto.Field(proto.STRING, number=5,) - view_name = proto.Field(proto.MESSAGE, number=6, message="TableName",) + role = proto.Field( + proto.STRING, + number=1, + ) + group_email = proto.Field( + proto.STRING, + number=2, + ) + user_email = proto.Field( + proto.STRING, + number=3, + ) + domain = proto.Field( + proto.STRING, + number=4, + ) + special_group = proto.Field( + proto.STRING, + number=5, + ) + view_name = proto.Field( + proto.MESSAGE, + number=6, + message="TableName", + ) - entries = proto.RepeatedField(proto.MESSAGE, number=1, message=Entry,) + entries = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Entry, + ) class Job(proto.Message): @@ -669,12 +926,26 @@ class Job(proto.Message): Job statistics. """ - job_name = proto.Field(proto.MESSAGE, number=1, message="JobName",) + job_name = proto.Field( + proto.MESSAGE, + number=1, + message="JobName", + ) job_configuration = proto.Field( - proto.MESSAGE, number=2, message="JobConfiguration", + proto.MESSAGE, + number=2, + message="JobConfiguration", + ) + job_status = proto.Field( + proto.MESSAGE, + number=3, + message="JobStatus", + ) + job_statistics = proto.Field( + proto.MESSAGE, + number=4, + message="JobStatistics", ) - job_status = proto.Field(proto.MESSAGE, number=3, message="JobStatus",) - job_statistics = proto.Field(proto.MESSAGE, number=4, message="JobStatistics",) class JobConfiguration(proto.Message): @@ -709,7 +980,7 @@ class JobConfiguration(proto.Message): dry_run (bool): If true, don't actually run the job. Just check that it would run. - labels (Sequence[google.cloud.bigquery_logging_v1.types.JobConfiguration.LabelsEntry]): + labels (Mapping[str, str]): Labels provided for the job. """ @@ -745,19 +1016,46 @@ class Query(proto.Message): CREATE_MODEL..) """ - query = proto.Field(proto.STRING, number=1,) - destination_table = proto.Field(proto.MESSAGE, number=2, message="TableName",) - create_disposition = proto.Field(proto.STRING, number=3,) - write_disposition = proto.Field(proto.STRING, number=4,) - default_dataset = proto.Field(proto.MESSAGE, number=5, message="DatasetName",) + query = proto.Field( + proto.STRING, + number=1, + ) + destination_table = proto.Field( + proto.MESSAGE, + number=2, + message="TableName", + ) + create_disposition = proto.Field( + proto.STRING, + number=3, + ) + write_disposition = proto.Field( + proto.STRING, + number=4, + ) + default_dataset = proto.Field( + proto.MESSAGE, + number=5, + message="DatasetName", + ) table_definitions = proto.RepeatedField( - proto.MESSAGE, number=6, message="TableDefinition", + proto.MESSAGE, + number=6, + message="TableDefinition", + ) + query_priority = proto.Field( + proto.STRING, + number=7, ) - query_priority = proto.Field(proto.STRING, number=7,) destination_table_encryption = proto.Field( - proto.MESSAGE, number=8, message="EncryptionInfo", + proto.MESSAGE, + number=8, + message="EncryptionInfo", + ) + statement_type = proto.Field( + proto.STRING, + number=9, ) - statement_type = proto.Field(proto.STRING, number=9,) class Load(proto.Message): r"""Describes a load job, which loads data from an external @@ -783,13 +1081,31 @@ class Load(proto.Message): non-default encryption is used. """ - source_uris = proto.RepeatedField(proto.STRING, number=1,) - schema_json = proto.Field(proto.STRING, number=6,) - destination_table = proto.Field(proto.MESSAGE, number=3, message="TableName",) - create_disposition = proto.Field(proto.STRING, number=4,) - write_disposition = proto.Field(proto.STRING, number=5,) + source_uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + schema_json = proto.Field( + proto.STRING, + number=6, + ) + destination_table = proto.Field( + proto.MESSAGE, + number=3, + message="TableName", + ) + create_disposition = proto.Field( + proto.STRING, + number=4, + ) + write_disposition = proto.Field( + proto.STRING, + number=5, + ) destination_table_encryption = proto.Field( - proto.MESSAGE, number=7, message="EncryptionInfo", + proto.MESSAGE, + number=7, + message="EncryptionInfo", ) class Extract(proto.Message): @@ -804,8 +1120,15 @@ class Extract(proto.Message): The source table. """ - destination_uris = proto.RepeatedField(proto.STRING, number=1,) - source_table = proto.Field(proto.MESSAGE, number=2, message="TableName",) + destination_uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + source_table = proto.Field( + proto.MESSAGE, + number=2, + message="TableName", + ) class TableCopy(proto.Message): r"""Describes a copy job, which copies an existing table to @@ -828,25 +1151,62 @@ class TableCopy(proto.Message): """ source_tables = proto.RepeatedField( - proto.MESSAGE, number=1, message="TableName", + proto.MESSAGE, + number=1, + message="TableName", + ) + destination_table = proto.Field( + proto.MESSAGE, + number=2, + message="TableName", + ) + create_disposition = proto.Field( + proto.STRING, + number=3, + ) + write_disposition = proto.Field( + proto.STRING, + number=4, ) - destination_table = proto.Field(proto.MESSAGE, number=2, message="TableName",) - create_disposition = proto.Field(proto.STRING, number=3,) - write_disposition = proto.Field(proto.STRING, number=4,) destination_table_encryption = proto.Field( - proto.MESSAGE, number=5, message="EncryptionInfo", + proto.MESSAGE, + number=5, + message="EncryptionInfo", ) - query = proto.Field(proto.MESSAGE, number=5, oneof="configuration", message=Query,) - load = proto.Field(proto.MESSAGE, number=6, oneof="configuration", message=Load,) + query = proto.Field( + proto.MESSAGE, + number=5, + oneof="configuration", + message=Query, + ) + load = proto.Field( + proto.MESSAGE, + number=6, + oneof="configuration", + message=Load, + ) extract = proto.Field( - proto.MESSAGE, number=7, oneof="configuration", message=Extract, + proto.MESSAGE, + number=7, + oneof="configuration", + message=Extract, ) table_copy = proto.Field( - proto.MESSAGE, number=8, oneof="configuration", message=TableCopy, + proto.MESSAGE, + number=8, + oneof="configuration", + message=TableCopy, + ) + dry_run = proto.Field( + proto.BOOL, + number=9, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=3, ) - dry_run = proto.Field(proto.BOOL, number=9,) - labels = proto.MapField(proto.STRING, proto.STRING, number=3,) class TableDefinition(proto.Message): @@ -860,8 +1220,14 @@ class TableDefinition(proto.Message): imported. """ - name = proto.Field(proto.STRING, number=1,) - source_uris = proto.RepeatedField(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + source_uris = proto.RepeatedField( + proto.STRING, + number=2, + ) class JobStatus(proto.Message): @@ -879,10 +1245,19 @@ class JobStatus(proto.Message): completed or was unsuccessful. """ - state = proto.Field(proto.STRING, number=1,) - error = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) + state = proto.Field( + proto.STRING, + number=1, + ) + error = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) additional_errors = proto.RepeatedField( - proto.MESSAGE, number=3, message=status_pb2.Status, + proto.MESSAGE, + number=3, + message=status_pb2.Status, ) @@ -947,29 +1322,77 @@ class ReservationResourceUsage(proto.Message): reservation for a particular job. """ - name = proto.Field(proto.STRING, number=1,) - slot_ms = proto.Field(proto.INT64, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + slot_ms = proto.Field( + proto.INT64, + number=2, + ) - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - total_processed_bytes = proto.Field(proto.INT64, number=4,) - total_billed_bytes = proto.Field(proto.INT64, number=5,) - billing_tier = proto.Field(proto.INT32, number=7,) - total_slot_ms = proto.Field(proto.INT64, number=8,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + total_processed_bytes = proto.Field( + proto.INT64, + number=4, + ) + total_billed_bytes = proto.Field( + proto.INT64, + number=5, + ) + billing_tier = proto.Field( + proto.INT32, + number=7, + ) + total_slot_ms = proto.Field( + proto.INT64, + number=8, + ) reservation_usage = proto.RepeatedField( - proto.MESSAGE, number=14, message=ReservationResourceUsage, + proto.MESSAGE, + number=14, + message=ReservationResourceUsage, ) referenced_tables = proto.RepeatedField( - proto.MESSAGE, number=9, message="TableName", + proto.MESSAGE, + number=9, + message="TableName", + ) + total_tables_processed = proto.Field( + proto.INT32, + number=10, ) - total_tables_processed = proto.Field(proto.INT32, number=10,) referenced_views = proto.RepeatedField( - proto.MESSAGE, number=11, message="TableName", + proto.MESSAGE, + number=11, + message="TableName", + ) + total_views_processed = proto.Field( + proto.INT32, + number=12, + ) + query_output_row_count = proto.Field( + proto.INT64, + number=15, + ) + total_load_output_bytes = proto.Field( + proto.INT64, + number=13, ) - total_views_processed = proto.Field(proto.INT32, number=12,) - query_output_row_count = proto.Field(proto.INT64, number=15,) - total_load_output_bytes = proto.Field(proto.INT64, number=13,) class DatasetName(proto.Message): @@ -982,8 +1405,14 @@ class DatasetName(proto.Message): The dataset ID within the project. """ - project_id = proto.Field(proto.STRING, number=1,) - dataset_id = proto.Field(proto.STRING, number=2,) + project_id = proto.Field( + proto.STRING, + number=1, + ) + dataset_id = proto.Field( + proto.STRING, + number=2, + ) class TableName(proto.Message): @@ -998,9 +1427,18 @@ class TableName(proto.Message): The table ID of the table within the dataset. """ - project_id = proto.Field(proto.STRING, number=1,) - dataset_id = proto.Field(proto.STRING, number=2,) - table_id = proto.Field(proto.STRING, number=3,) + project_id = proto.Field( + proto.STRING, + number=1, + ) + dataset_id = proto.Field( + proto.STRING, + number=2, + ) + table_id = proto.Field( + proto.STRING, + number=3, + ) class JobName(proto.Message): @@ -1015,9 +1453,18 @@ class JobName(proto.Message): The job location. """ - project_id = proto.Field(proto.STRING, number=1,) - job_id = proto.Field(proto.STRING, number=2,) - location = proto.Field(proto.STRING, number=3,) + project_id = proto.Field( + proto.STRING, + number=1, + ) + job_id = proto.Field( + proto.STRING, + number=2, + ) + location = proto.Field( + proto.STRING, + number=3, + ) class EncryptionInfo(proto.Message): @@ -1028,7 +1475,10 @@ class EncryptionInfo(proto.Message): unique identifier for cloud kms key """ - kms_key_name = proto.Field(proto.STRING, number=1,) + kms_key_name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 64d80db..ba3d6cb 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,10 @@ # import io import os + import setuptools # type: ignore -version = "1.0.2" +version = "1.0.3" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -46,8 +47,9 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", - "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", + "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ), python_requires=">=3.6", classifiers=[ diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index fca766f..60b7a7a 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,4 +7,5 @@ # Then this file should have foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 -grpc-google-iam-v1==0.12.3 +grpc-google-iam-v1==0.12.4 +protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..60b7a7a 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,11 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# 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.31.5 +proto-plus==1.15.0 +grpc-google-iam-v1==0.12.4 +protobuf==3.19.0