diff --git a/packages/google-cloud-bigquery-datatransfer/CONTRIBUTING.rst b/packages/google-cloud-bigquery-datatransfer/CONTRIBUTING.rst index ad8546e76c0f..7e25e6bc4689 100644 --- a/packages/google-cloud-bigquery-datatransfer/CONTRIBUTING.rst +++ b/packages/google-cloud-bigquery-datatransfer/CONTRIBUTING.rst @@ -80,25 +80,6 @@ We use `nox `__ to instrument our tests. .. nox: https://pypi.org/project/nox/ -Note on Editable Installs / Develop Mode -======================================== - -- As mentioned previously, using ``setuptools`` in `develop mode`_ - or a ``pip`` `editable install`_ is not possible with this - library. This is because this library uses `namespace packages`_. - For context see `Issue #2316`_ and the relevant `PyPA issue`_. - - Since ``editable`` / ``develop`` mode can't be used, packages - need to be installed directly. Hence your changes to the source - tree don't get incorporated into the **already installed** - package. - -.. _namespace packages: https://www.python.org/dev/peps/pep-0420/ -.. _Issue #2316: https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2316 -.. _PyPA issue: https://github.com/pypa/packaging-problems/issues/12 -.. _develop mode: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode -.. _editable install: https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs - ***************************************** I'm getting weird errors... Can you help? ***************************************** diff --git a/packages/google-cloud-bigquery-datatransfer/UPGRADING.md b/packages/google-cloud-bigquery-datatransfer/UPGRADING.md index 4c157b23f9a9..0bac7ed1d949 100644 --- a/packages/google-cloud-bigquery-datatransfer/UPGRADING.md +++ b/packages/google-cloud-bigquery-datatransfer/UPGRADING.md @@ -38,8 +38,24 @@ The 2.0.0 release requires Python 3.6+. > **WARNING**: Breaking change -The library was moved into `google.cloud.bigquery` namespace. Existing imports -need to be updated. + +### Version 2.1.0 + +The library had its old namespace restored, since importing from +`google.cloud.bigquery` clashed with the `google-cloud-bigquery` library when the +latter was also installed. + +The import paths that were changed in version `2.0.0` should be reverted: + +```py +from google.cloud import bigquery_datatransfer +from google.cloud import bigquery_datatransfer_v1 +``` + +### Version 2.0.0 + +(obsolete) The library was moved into `google.cloud.bigquery` namespace. Existing +imports need to be updated, unless using a version `>=2.1.0`. **Before:** ```py diff --git a/packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/services.rst b/packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/services.rst similarity index 72% rename from packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/services.rst rename to packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/services.rst index 46c2ba6f8cfa..8dddd817811a 100644 --- a/packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/services.rst +++ b/packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Bigquery Datatransfer v1 API ====================================================== -.. automodule:: google.cloud.bigquery.datatransfer_v1.services.data_transfer_service +.. automodule:: google.cloud.bigquery_datatransfer_v1.services.data_transfer_service :members: :inherited-members: diff --git a/packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/types.rst b/packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/types.rst similarity index 66% rename from packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/types.rst rename to packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/types.rst index 6e8bc0008011..e47782ffac13 100644 --- a/packages/google-cloud-bigquery-datatransfer/docs/datatransfer_v1/types.rst +++ b/packages/google-cloud-bigquery-datatransfer/docs/bigquery_datatransfer_v1/types.rst @@ -1,5 +1,5 @@ Types for Google Cloud Bigquery Datatransfer v1 API =================================================== -.. automodule:: google.cloud.bigquery.datatransfer_v1.types +.. automodule:: google.cloud.bigquery_datatransfer_v1.types :members: diff --git a/packages/google-cloud-bigquery-datatransfer/docs/conf.py b/packages/google-cloud-bigquery-datatransfer/docs/conf.py index 41549e0722f4..fab78815ee73 100644 --- a/packages/google-cloud-bigquery-datatransfer/docs/conf.py +++ b/packages/google-cloud-bigquery-datatransfer/docs/conf.py @@ -39,6 +39,7 @@ "sphinx.ext.autosummary", "sphinx.ext.intersphinx", "sphinx.ext.coverage", + "sphinx.ext.doctest", "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", diff --git a/packages/google-cloud-bigquery-datatransfer/docs/index.rst b/packages/google-cloud-bigquery-datatransfer/docs/index.rst index 824b52076097..46d9325153c6 100644 --- a/packages/google-cloud-bigquery-datatransfer/docs/index.rst +++ b/packages/google-cloud-bigquery-datatransfer/docs/index.rst @@ -8,8 +8,8 @@ API Reference .. toctree:: :maxdepth: 2 - Client - Types + Client + Types Migration Guide diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/__init__.py similarity index 56% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/__init__.py index 55860e3fd5e7..721bb151205c 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer/__init__.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/__init__.py @@ -15,84 +15,84 @@ # limitations under the License. # -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.async_client import ( +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.async_client import ( DataTransferServiceAsyncClient, ) -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.client import ( +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.client import ( DataTransferServiceClient, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( CheckValidCredsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( CheckValidCredsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( CreateTransferConfigRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import DataSource -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import DataSourceParameter -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import DataSource +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import DataSourceParameter +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( DeleteTransferConfigRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( DeleteTransferRunRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( GetDataSourceRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( GetTransferConfigRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( GetTransferRunRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListDataSourcesRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListDataSourcesResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferConfigsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferConfigsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferLogsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferLogsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferRunsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ListTransferRunsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ScheduleTransferRunsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( ScheduleTransferRunsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( StartManualTransferRunsRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( StartManualTransferRunsResponse, ) -from google.cloud.bigquery.datatransfer_v1.types.datatransfer import ( +from google.cloud.bigquery_datatransfer_v1.types.datatransfer import ( UpdateTransferConfigRequest, ) -from google.cloud.bigquery.datatransfer_v1.types.transfer import EmailPreferences -from google.cloud.bigquery.datatransfer_v1.types.transfer import ScheduleOptions -from google.cloud.bigquery.datatransfer_v1.types.transfer import TransferConfig -from google.cloud.bigquery.datatransfer_v1.types.transfer import TransferMessage -from google.cloud.bigquery.datatransfer_v1.types.transfer import TransferRun -from google.cloud.bigquery.datatransfer_v1.types.transfer import TransferState -from google.cloud.bigquery.datatransfer_v1.types.transfer import TransferType +from google.cloud.bigquery_datatransfer_v1.types.transfer import EmailPreferences +from google.cloud.bigquery_datatransfer_v1.types.transfer import ScheduleOptions +from google.cloud.bigquery_datatransfer_v1.types.transfer import TransferConfig +from google.cloud.bigquery_datatransfer_v1.types.transfer import TransferMessage +from google.cloud.bigquery_datatransfer_v1.types.transfer import TransferRun +from google.cloud.bigquery_datatransfer_v1.types.transfer import TransferState +from google.cloud.bigquery_datatransfer_v1.types.transfer import TransferType __all__ = ( "CheckValidCredsRequest", diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer/py.typed b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/py.typed similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer/py.typed rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/py.typed diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/py.typed b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/py.typed similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/py.typed rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/py.typed diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/async_client.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/async_client.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py index 2bbd0f2f053c..da83e37e3096 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/async_client.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py @@ -28,9 +28,9 @@ from google.auth import credentials # type: ignore from google.oauth2 import service_account # type: ignore -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import pagers -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import pagers +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore from google.protobuf import struct_pb2 as struct # type: ignore diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/client.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/client.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py index 2c3c755bdd62..f4cd6199644b 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/client.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py @@ -32,9 +32,9 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import pagers -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import pagers +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore from google.protobuf import struct_pb2 as struct # type: ignore diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/pagers.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/pagers.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/pagers.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/pagers.py index 922e208624e1..d1bb2a72f2c2 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/pagers.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/pagers.py @@ -17,8 +17,8 @@ from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer class ListDataSourcesPager: diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/base.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/base.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/base.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/base.py index d4d82fa2b8d7..8d2f456937d4 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/base.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/base.py @@ -25,8 +25,8 @@ from google.api_core import retry as retries # type: ignore from google.auth import credentials # type: ignore -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import empty_pb2 as empty # type: ignore diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc.py index 282f8eb7776d..8ac75a7c0a65 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc.py @@ -26,8 +26,8 @@ import grpc # type: ignore -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import empty_pb2 as empty # type: ignore from .base import DataTransferServiceTransport, DEFAULT_CLIENT_INFO diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py index 32f5706c2eb7..c4220d113977 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py @@ -27,8 +27,8 @@ import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import empty_pb2 as empty # type: ignore from .base import DataTransferServiceTransport, DEFAULT_CLIENT_INFO diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/__init__.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/__init__.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/datatransfer.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/datatransfer.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/datatransfer.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/datatransfer.py index f067a49af802..2fab069945e2 100644 --- a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/datatransfer.py +++ b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/datatransfer.py @@ -18,7 +18,7 @@ import proto # type: ignore -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore diff --git a/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/transfer.py b/packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/transfer.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery/datatransfer_v1/types/transfer.py rename to packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/types/transfer.py diff --git a/packages/google-cloud-bigquery-datatransfer/samples/create_scheduled_query.py b/packages/google-cloud-bigquery-datatransfer/samples/create_scheduled_query.py index a05cfd13291d..297e1f734f4e 100644 --- a/packages/google-cloud-bigquery-datatransfer/samples/create_scheduled_query.py +++ b/packages/google-cloud-bigquery-datatransfer/samples/create_scheduled_query.py @@ -20,9 +20,9 @@ def sample_create_transfer_config(project_id, dataset_id, authorization_code=""): # [START bigquerydatatransfer_create_scheduled_query] - from google.cloud.bigquery import datatransfer_v1 + from google.cloud import bigquery_datatransfer - client = datatransfer_v1.DataTransferServiceClient() + client = bigquery_datatransfer.DataTransferServiceClient() # TODO(developer): Set the project_id to the project that contains the # destination dataset. @@ -54,7 +54,7 @@ def sample_create_transfer_config(project_id, dataset_id, authorization_code="") parent = f"projects/{project_id}" - transfer_config = datatransfer_v1.types.TransferConfig( + transfer_config = bigquery_datatransfer.TransferConfig( destination_dataset_id=dataset_id, display_name="Your Scheduled Query Name", data_source_id="scheduled_query", diff --git a/packages/google-cloud-bigquery-datatransfer/samples/snippets/quickstart.py b/packages/google-cloud-bigquery-datatransfer/samples/snippets/quickstart.py index 347ccdbf5f7c..042a6459d6c1 100644 --- a/packages/google-cloud-bigquery-datatransfer/samples/snippets/quickstart.py +++ b/packages/google-cloud-bigquery-datatransfer/samples/snippets/quickstart.py @@ -17,9 +17,9 @@ def run_quickstart(project="my-project"): # [START bigquerydatatransfer_quickstart] - from google.cloud.bigquery import datatransfer + from google.cloud import bigquery_datatransfer - client = datatransfer.DataTransferServiceClient() + client = bigquery_datatransfer.DataTransferServiceClient() # TODO: Update to your project ID. # project = "my-project" diff --git a/packages/google-cloud-bigquery-datatransfer/samples/tests/conftest.py b/packages/google-cloud-bigquery-datatransfer/samples/tests/conftest.py index 05e32436a3b0..90589e8b9838 100644 --- a/packages/google-cloud-bigquery-datatransfer/samples/tests/conftest.py +++ b/packages/google-cloud-bigquery-datatransfer/samples/tests/conftest.py @@ -39,9 +39,9 @@ def credentials(): @pytest.fixture(scope="module") def bqdts_client(credentials): - from google.cloud.bigquery import datatransfer_v1 + from google.cloud import bigquery_datatransfer - return datatransfer_v1.DataTransferServiceClient(credentials=credentials) + return bigquery_datatransfer.DataTransferServiceClient(credentials=credentials) @pytest.fixture(scope="module") diff --git a/packages/google-cloud-bigquery-datatransfer/samples/update_transfer_config.py b/packages/google-cloud-bigquery-datatransfer/samples/update_transfer_config.py index c1f4190cd486..11e21ddb405c 100644 --- a/packages/google-cloud-bigquery-datatransfer/samples/update_transfer_config.py +++ b/packages/google-cloud-bigquery-datatransfer/samples/update_transfer_config.py @@ -20,9 +20,9 @@ def sample_update_transfer_config(config_name, display_name): # [START bigquerydatatransfer_update_transfer_config] - from google.cloud.bigquery import datatransfer_v1 + from google.cloud import bigquery_datatransfer - client = datatransfer_v1.DataTransferServiceClient() + client = bigquery_datatransfer.DataTransferServiceClient() # TODO(developer): Set the config_name which user wants to update. # config_name = "your-created-transfer-config-name" diff --git a/packages/google-cloud-bigquery-datatransfer/scripts/fixup_datatransfer_v1_keywords.py b/packages/google-cloud-bigquery-datatransfer/scripts/fixup_bigquery_datatransfer_v1_keywords.py similarity index 96% rename from packages/google-cloud-bigquery-datatransfer/scripts/fixup_datatransfer_v1_keywords.py rename to packages/google-cloud-bigquery-datatransfer/scripts/fixup_bigquery_datatransfer_v1_keywords.py index f5fcc272f044..a8fbf7c550c1 100644 --- a/packages/google-cloud-bigquery-datatransfer/scripts/fixup_datatransfer_v1_keywords.py +++ b/packages/google-cloud-bigquery-datatransfer/scripts/fixup_bigquery_datatransfer_v1_keywords.py @@ -37,7 +37,7 @@ def partition( return results[1], results[0] -class datatransferCallTransformer(cst.CSTTransformer): +class bigquery_datatransferCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'check_valid_creds': ('name', ), @@ -103,7 +103,7 @@ def fix_files( in_dir: pathlib.Path, out_dir: pathlib.Path, *, - transformer=datatransferCallTransformer(), + transformer=bigquery_datatransferCallTransformer(), ): """Duplicate the input dir to the output dir, fixing file method calls. @@ -136,7 +136,7 @@ def fix_files( if __name__ == '__main__': parser = argparse.ArgumentParser( - description="""Fix up source that uses the datatransfer client library. + description="""Fix up source that uses the bigquery_datatransfer client library. The existing sources are NOT overwritten but are copied to output_dir with changes made. diff --git a/packages/google-cloud-bigquery-datatransfer/setup.py b/packages/google-cloud-bigquery-datatransfer/setup.py index c44d66952733..2a553128f3ea 100644 --- a/packages/google-cloud-bigquery-datatransfer/setup.py +++ b/packages/google-cloud-bigquery-datatransfer/setup.py @@ -57,9 +57,6 @@ if "google.cloud" in packages: namespaces.append("google.cloud") -if "google.cloud.bigquery" in packages: - namespaces.append("google.cloud.bigquery") - setuptools.setup( name=name, version=version, @@ -87,7 +84,7 @@ install_requires=dependencies, extras_require=extras, python_requires=">=3.6", - scripts=["scripts/fixup_datatransfer_v1_keywords.py"], + scripts=["scripts/fixup_bigquery_datatransfer_v1_keywords.py"], include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-bigquery-datatransfer/synth.metadata b/packages/google-cloud-bigquery-datatransfer/synth.metadata index 30c7dbc52ac0..20b58a931e2c 100644 --- a/packages/google-cloud-bigquery-datatransfer/synth.metadata +++ b/packages/google-cloud-bigquery-datatransfer/synth.metadata @@ -4,21 +4,21 @@ "git": { "name": ".", "remote": "git@github.com:plamut/python-bigquery-datatransfer.git", - "sha": "b1bdf7efd37c00871a8716340a45184a20acb4ad" + "sha": "41256eec1994fbff48894c7055e6440b4e636628" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "dba48bb9bc6959c232bec9150ac6313b608fe7bd" + "sha": "da29da32b3a988457b49ae290112b74f14b713cc" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "dba48bb9bc6959c232bec9150ac6313b608fe7bd" + "sha": "da29da32b3a988457b49ae290112b74f14b713cc" } } ], diff --git a/packages/google-cloud-bigquery-datatransfer/synth.py b/packages/google-cloud-bigquery-datatransfer/synth.py index ee143409444a..abfa2af98756 100644 --- a/packages/google-cloud-bigquery-datatransfer/synth.py +++ b/packages/google-cloud-bigquery-datatransfer/synth.py @@ -54,12 +54,12 @@ # Fix missing async client in datatransfer_v1 s.replace( - "google/cloud/bigquery/datatransfer_v1/__init__.py", + "google/cloud/bigquery_datatransfer_v1/__init__.py", r"from \.services\.data_transfer_service import DataTransferServiceClient", "\g<0>\nfrom .services.data_transfer_service import DataTransferServiceAsyncClient", ) s.replace( - "google/cloud/bigquery/datatransfer_v1/__init__.py", + "google/cloud/bigquery_datatransfer_v1/__init__.py", r"'DataTransferServiceClient',", '\g<0>\n "DataTransferServiceAsyncClient"', ) diff --git a/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/datatransfer_v1/__init__.py b/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/__init__.py similarity index 100% rename from packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/datatransfer_v1/__init__.py rename to packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/__init__.py diff --git a/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/datatransfer_v1/test_data_transfer_service.py b/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py similarity index 99% rename from packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/datatransfer_v1/test_data_transfer_service.py rename to packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py index 249f6f382434..63e74a84c940 100644 --- a/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/datatransfer_v1/test_data_transfer_service.py +++ b/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py @@ -32,18 +32,18 @@ from google.api_core import grpc_helpers_async from google.auth import credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import ( +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import ( DataTransferServiceAsyncClient, ) -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import ( +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import ( DataTransferServiceClient, ) -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import pagers -from google.cloud.bigquery.datatransfer_v1.services.data_transfer_service import ( +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import pagers +from google.cloud.bigquery_datatransfer_v1.services.data_transfer_service import ( transports, ) -from google.cloud.bigquery.datatransfer_v1.types import datatransfer -from google.cloud.bigquery.datatransfer_v1.types import transfer +from google.cloud.bigquery_datatransfer_v1.types import datatransfer +from google.cloud.bigquery_datatransfer_v1.types import transfer from google.oauth2 import service_account from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore @@ -455,7 +455,7 @@ def test_data_transfer_service_client_client_options_credentials_file( def test_data_transfer_service_client_client_options_from_dict(): with mock.patch( - "google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceGrpcTransport.__init__" + "google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceGrpcTransport.__init__" ) as grpc_transport: grpc_transport.return_value = None client = DataTransferServiceClient( @@ -4318,7 +4318,7 @@ def test_data_transfer_service_base_transport_error(): def test_data_transfer_service_base_transport(): # Instantiate the base transport. with mock.patch( - "google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport.__init__" + "google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport.__init__" ) as Transport: Transport.return_value = None transport = transports.DataTransferServiceTransport( @@ -4353,7 +4353,7 @@ def test_data_transfer_service_base_transport_with_credentials_file(): with mock.patch.object( auth, "load_credentials_from_file" ) as load_creds, mock.patch( - "google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport._prep_wrapped_messages" + "google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None load_creds.return_value = (credentials.AnonymousCredentials(), None) @@ -4370,7 +4370,7 @@ def test_data_transfer_service_base_transport_with_credentials_file(): def test_data_transfer_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(auth, "default") as adc, mock.patch( - "google.cloud.bigquery.datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport._prep_wrapped_messages" + "google.cloud.bigquery_datatransfer_v1.services.data_transfer_service.transports.DataTransferServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None adc.return_value = (credentials.AnonymousCredentials(), None) diff --git a/packages/google-cloud-bigquery-datatransfer/tests/unit/test_shim.py b/packages/google-cloud-bigquery-datatransfer/tests/unit/test_shim.py index eff54512c624..bf80d60b5670 100644 --- a/packages/google-cloud-bigquery-datatransfer/tests/unit/test_shim.py +++ b/packages/google-cloud-bigquery-datatransfer/tests/unit/test_shim.py @@ -18,12 +18,14 @@ def test_shim(): - from google.cloud.bigquery import datatransfer - from google.cloud.bigquery import datatransfer_v1 + from google.cloud import bigquery_datatransfer + from google.cloud import bigquery_datatransfer_v1 - assert sorted(datatransfer.__all__) == sorted(datatransfer_v1.__all__) + assert sorted(bigquery_datatransfer.__all__) == sorted( + bigquery_datatransfer_v1.__all__ + ) - for name in datatransfer.__all__: - found = getattr(datatransfer, name) - expected = getattr(datatransfer_v1, name) + for name in bigquery_datatransfer.__all__: + found = getattr(bigquery_datatransfer, name) + expected = getattr(bigquery_datatransfer_v1, name) assert found is expected