Skip to content

Commit

Permalink
Merge branch 'main' into owl-bot-update-lock-bacc3af03bff793a03add584…
Browse files Browse the repository at this point in the history
…537b36b5644342931ad989e3ba1171d3bd5399f5
  • Loading branch information
parthea authored Dec 2, 2023
2 parents f2dd44d + d218f4e commit 06e69fe
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 111 deletions.
6 changes: 0 additions & 6 deletions google/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions google/cloud/__init__.py

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions google/cloud/bigtable_v2/services/bigtable/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore

from google.cloud.bigtable_v2.types import bigtable
from google.cloud.bigtable_v2.types import data
Expand Down Expand Up @@ -250,7 +250,7 @@ def read_rows(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -345,7 +345,7 @@ def sample_row_keys(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -457,7 +457,7 @@ async def mutate_row(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -496,7 +496,7 @@ async def mutate_row(
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.mutate_row,
default_retry=retries.Retry(
default_retry=retries.AsyncRetry(
initial=0.01,
maximum=60.0,
multiplier=2,
Expand Down Expand Up @@ -579,7 +579,7 @@ def mutate_rows(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -718,7 +718,7 @@ async def check_and_mutate_row(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -828,7 +828,7 @@ async def ping_and_warm(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -946,7 +946,7 @@ async def read_modify_write_row(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -1052,7 +1052,7 @@ def generate_initial_change_stream_partitions(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down Expand Up @@ -1151,7 +1151,7 @@ def read_change_stream(
This corresponds to the ``app_profile_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.6
python_version = 3.8
namespace_packages = True
exclude = tests/unit/gapic/

Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def mypy(session):
)
session.install("google-cloud-testutils")
# TODO: also verify types on tests, all of google package
session.run("mypy", "google/", "tests/")
session.run("mypy", "-p", "google", "-p", "tests")


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def mypy(session):
session.install("mypy", "types-setuptools", "types-protobuf", "types-mock", "types-requests")
session.install("google-cloud-testutils")
# TODO: also verify types on tests, all of google package
session.run("mypy", "google/", "tests/")
session.run("mypy", "-p", "google", "-p", "tests")
@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,10 @@
# benchmarks, etc.
packages = [
package
for package in setuptools.PEP420PackageFinder.find()
for package in setuptools.find_namespace_packages()
if package.startswith("google")
]

# Determine which namespaces are needed.
namespaces = ["google"]
if "google.cloud" in packages:
namespaces.append("google.cloud")


setuptools.setup(
name=name,
version=version,
Expand All @@ -94,7 +88,6 @@
],
platforms="Posix; MacOS X; Windows",
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require=extras,
scripts=[
Expand Down
37 changes: 37 additions & 0 deletions tests/unit/test_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import subprocess
import sys


def test_namespace_package_compat(tmp_path):
# The ``google`` namespace package should not be masked
# by the presence of ``google-cloud-bigtable``.
google = tmp_path / "google"
google.mkdir()
google.joinpath("othermod.py").write_text("")
env = dict(os.environ, PYTHONPATH=str(tmp_path))
cmd = [sys.executable, "-m", "google.othermod"]
subprocess.check_call(cmd, env=env)

# The ``google.cloud`` namespace package should not be masked
# by the presence of ``google-cloud-bigtable``.
google_cloud = tmp_path / "google" / "cloud"
google_cloud.mkdir()
google_cloud.joinpath("othermod.py").write_text("")
env = dict(os.environ, PYTHONPATH=str(tmp_path))
cmd = [sys.executable, "-m", "google.cloud.othermod"]
subprocess.check_call(cmd, env=env)

0 comments on commit 06e69fe

Please sign in to comment.