Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5da6733

Browse files
authored
fix: drop support for grpc-gcp (#401)
1 parente92045b commit5da6733

File tree

10 files changed

+20
-116
lines changed

10 files changed

+20
-116
lines changed

‎.github/sync-repo-settings.yaml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ branchProtectionRules:
1616
-'unit-3.8'
1717
-'unit-3.9'
1818
-'unit-3.10'
19-
-'unit_grpc_gcp-3.6'
20-
-'unit_grpc_gcp-3.7'
21-
-'unit_grpc_gcp-3.8'
22-
-'unit_grpc_gcp-3.9'
23-
-'unit_grpc_gcp-3.10'
2419
-'unit_wo_grpc-3.6'
2520
-'unit_wo_grpc-3.10'
2621
-'cover'

‎.github/workflows/unittest.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on:ubuntu-latest
1212
strategy:
1313
matrix:
14-
option:["", "_grpc_gcp", "_wo_grpc"]
14+
option:["", "_wo_grpc"]
1515
python:
1616
-"3.6"
1717
-"3.7"

‎google/api_core/grpc_helpers.py‎

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
importgoogle.auth.transport.grpc
2626
importgoogle.auth.transport.requests
2727

28-
try:
29-
importgrpc_gcp
30-
31-
HAS_GRPC_GCP=True
32-
exceptImportError:
33-
HAS_GRPC_GCP=False
34-
3528

3629
# The list of gRPC Callable interfaces that return iterators.
3730
_STREAM_WRAP_CLASSES= (grpc.UnaryStreamMultiCallable,grpc.StreamStreamMultiCallable)
@@ -282,8 +275,7 @@ def create_channel(
282275
default_scopes (Sequence[str]): Default scopes passed by a Google client
283276
library. Use 'scopes' for user-defined scopes.
284277
default_host (str): The default endpoint. e.g., "pubsub.googleapis.com".
285-
kwargs: Additional key-word args passed to
286-
:func:`grpc_gcp.secure_channel` or :func:`grpc.secure_channel`.
278+
kwargs: Additional key-word args passed to :func:`grpc.secure_channel`.
287279
288280
Returns:
289281
grpc.Channel: The created channel.
@@ -302,12 +294,7 @@ def create_channel(
302294
default_host=default_host,
303295
)
304296

305-
ifHAS_GRPC_GCP:
306-
# If grpc_gcp module is available use grpc_gcp.secure_channel,
307-
# otherwise, use grpc.secure_channel to create grpc channel.
308-
returngrpc_gcp.secure_channel(target,composite_credentials,**kwargs)
309-
else:
310-
returngrpc.secure_channel(target,composite_credentials,**kwargs)
297+
returngrpc.secure_channel(target,composite_credentials,**kwargs)
311298

312299

313300
_MethodCall=collections.namedtuple(

‎google/api_core/grpc_helpers_async.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
fromgoogle.api_coreimportexceptions,grpc_helpers
2828

2929

30-
# TODO(lidiz) Support gRPC GCP wrapper
31-
HAS_GRPC_GCP=False
32-
3330
# NOTE(lidiz) Alternatively, we can hack "__getattribute__" to perform
3431
# automatic patching for us. But that means the overhead of creating an
3532
# extra Python function spreads to every single send and receive.

‎noxfile.py‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
3333
nox.options.sessions= [
3434
"unit",
35-
"unit_grpc_gcp",
3635
"unit_wo_grpc",
3736
"cover",
3837
"pytype",
@@ -143,18 +142,6 @@ def unit(session):
143142
default(session)
144143

145144

146-
@nox.session(python=["3.6","3.7","3.8","3.9","3.10"])
147-
defunit_grpc_gcp(session):
148-
"""Run the unit test suite with grpcio-gcp installed."""
149-
constraints_path=str(
150-
CURRENT_DIRECTORY/"testing"/f"constraints-{session.python}.txt"
151-
)
152-
# Install grpcio-gcp
153-
session.install("-e",".[grpcgcp]","-c",constraints_path)
154-
155-
default(session)
156-
157-
158145
@nox.session(python=["3.6","3.10"])
159146
defunit_wo_grpc(session):
160147
"""Run the unit test suite w/o grpcio installed"""
@@ -173,14 +160,14 @@ def lint_setup_py(session):
173160
@nox.session(python="3.6")
174161
defpytype(session):
175162
"""Run type-checking."""
176-
session.install(".[grpc, grpcgcp]","pytype >= 2019.3.21")
163+
session.install(".[grpc]","pytype >= 2019.3.21")
177164
session.run("pytype")
178165

179166

180167
@nox.session(python=DEFAULT_PYTHON_VERSION)
181168
defmypy(session):
182169
"""Run type-checking."""
183-
session.install(".[grpc, grpcgcp]","mypy")
170+
session.install(".[grpc]","mypy")
184171
session.install(
185172
"types-setuptools",
186173
"types-requests",
@@ -207,7 +194,7 @@ def cover(session):
207194
defdocs(session):
208195
"""Build the docs for this library."""
209196

210-
session.install("-e",".[grpc, grpcgcp]")
197+
session.install("-e",".[grpc]")
211198
session.install("sphinx==4.0.1","alabaster","recommonmark")
212199

213200
shutil.rmtree(os.path.join("docs","_build"),ignore_errors=True)

‎setup.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
]
3737
extras= {
3838
"grpc": ["grpcio >= 1.33.2, < 2.0dev","grpcio-status >= 1.33.2, < 2.0dev"],
39-
"grpcgcp":"grpcio-gcp >= 0.2.2, < 1.0dev",
40-
"grpcio-gcp":"grpcio-gcp >= 0.2.2, < 1.0dev",
4139
}
4240

4341

‎testing/constraints-3.6.txt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ google-auth==1.25.0
1111
requests==2.18.0
1212
packaging==14.3
1313
grpcio==1.33.2
14-
grpcio-gcp==0.2.2
15-
grpcio-gcp==0.2.2
1614
grpcio-status==1.33.2

‎testing/constraints-3.7.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ google-auth==1.25.0
1111
requests==2.18.0
1212
packaging==14.3
1313
grpcio==1.33.2
14-
grpcio-gcp==0.2.2
1514
grpcio-status==1.33.2

‎tests/asyncio/test_grpc_helpers_async.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,8 @@ def test_create_channel_with_credentials_file_and_default_scopes(
565565
grpc_secure_channel.assert_called_once_with(target,composite_creds)
566566

567567

568-
@pytest.mark.skipif(
569-
grpc_helpers_async.HAS_GRPC_GCP,reason="grpc_gcp module not available"
570-
)
571568
@mock.patch("grpc.aio.secure_channel")
572-
deftest_create_channel_without_grpc_gcp(grpc_secure_channel):
569+
deftest_create_channel(grpc_secure_channel):
573570
target="example.com:443"
574571
scopes= ["test_scope"]
575572

‎tests/unit/test_grpc_helpers.py‎

Lines changed: 13 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,7 @@ def test_create_channel_implicit(grpc_secure_channel, default, composite_creds_c
365365

366366
default.assert_called_once_with(scopes=None,default_scopes=None)
367367

368-
ifgrpc_helpers.HAS_GRPC_GCP:
369-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
370-
else:
371-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
368+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
372369

373370

374371
@mock.patch("google.auth.transport.grpc.AuthMetadataPlugin",autospec=True)
@@ -400,10 +397,7 @@ def test_create_channel_implicit_with_default_host(
400397
mock.sentinel.credentials,mock.sentinel.Request,default_host=default_host
401398
)
402399

403-
ifgrpc_helpers.HAS_GRPC_GCP:
404-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
405-
else:
406-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
400+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
407401

408402

409403
@mock.patch("grpc.composite_channel_credentials")
@@ -426,10 +420,7 @@ def test_create_channel_implicit_with_ssl_creds(
426420

427421
composite_creds_call.assert_called_once_with(ssl_creds,mock.ANY)
428422
composite_creds=composite_creds_call.return_value
429-
ifgrpc_helpers.HAS_GRPC_GCP:
430-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
431-
else:
432-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
423+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
433424

434425

435426
@mock.patch("grpc.composite_channel_credentials")
@@ -451,10 +442,7 @@ def test_create_channel_implicit_with_scopes(
451442

452443
default.assert_called_once_with(scopes=["one","two"],default_scopes=None)
453444

454-
ifgrpc_helpers.HAS_GRPC_GCP:
455-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
456-
else:
457-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
445+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
458446

459447

460448
@mock.patch("grpc.composite_channel_credentials")
@@ -476,10 +464,7 @@ def test_create_channel_implicit_with_default_scopes(
476464

477465
default.assert_called_once_with(scopes=None,default_scopes=["three","four"])
478466

479-
ifgrpc_helpers.HAS_GRPC_GCP:
480-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
481-
else:
482-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
467+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
483468

484469

485470
deftest_create_channel_explicit_with_duplicate_credentials():
@@ -507,10 +492,7 @@ def test_create_channel_explicit(grpc_secure_channel, auth_creds, composite_cred
507492
)
508493

509494
assertchannelisgrpc_secure_channel.return_value
510-
ifgrpc_helpers.HAS_GRPC_GCP:
511-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
512-
else:
513-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
495+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
514496

515497

516498
@mock.patch("grpc.composite_channel_credentials")
@@ -530,10 +512,7 @@ def test_create_channel_explicit_scoped(grpc_secure_channel, composite_creds_cal
530512
credentials.with_scopes.assert_called_once_with(scopes,default_scopes=None)
531513

532514
assertchannelisgrpc_secure_channel.return_value
533-
ifgrpc_helpers.HAS_GRPC_GCP:
534-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
535-
else:
536-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
515+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
537516

538517

539518
@mock.patch("grpc.composite_channel_credentials")
@@ -557,10 +536,7 @@ def test_create_channel_explicit_default_scopes(
557536
)
558537

559538
assertchannelisgrpc_secure_channel.return_value
560-
ifgrpc_helpers.HAS_GRPC_GCP:
561-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
562-
else:
563-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
539+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
564540

565541

566542
@mock.patch("grpc.composite_channel_credentials")
@@ -582,10 +558,7 @@ def test_create_channel_explicit_with_quota_project(
582558
credentials.with_quota_project.assert_called_once_with("project-foo")
583559

584560
assertchannelisgrpc_secure_channel.return_value
585-
ifgrpc_helpers.HAS_GRPC_GCP:
586-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
587-
else:
588-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
561+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
589562

590563

591564
@mock.patch("grpc.composite_channel_credentials")
@@ -610,10 +583,7 @@ def test_create_channel_with_credentials_file(
610583
)
611584

612585
assertchannelisgrpc_secure_channel.return_value
613-
ifgrpc_helpers.HAS_GRPC_GCP:
614-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
615-
else:
616-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
586+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
617587

618588

619589
@mock.patch("grpc.composite_channel_credentials")
@@ -641,10 +611,7 @@ def test_create_channel_with_credentials_file_and_scopes(
641611
)
642612

643613
assertchannelisgrpc_secure_channel.return_value
644-
ifgrpc_helpers.HAS_GRPC_GCP:
645-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
646-
else:
647-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
614+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
648615

649616

650617
@mock.patch("grpc.composite_channel_credentials")
@@ -672,32 +639,11 @@ def test_create_channel_with_credentials_file_and_default_scopes(
672639
)
673640

674641
assertchannelisgrpc_secure_channel.return_value
675-
ifgrpc_helpers.HAS_GRPC_GCP:
676-
grpc_secure_channel.assert_called_once_with(target,composite_creds,None)
677-
else:
678-
grpc_secure_channel.assert_called_once_with(target,composite_creds)
642+
grpc_secure_channel.assert_called_once_with(target,composite_creds)
679643

680644

681-
@pytest.mark.skipif(
682-
notgrpc_helpers.HAS_GRPC_GCP,reason="grpc_gcp module not available"
683-
)
684-
@mock.patch("grpc_gcp.secure_channel")
685-
deftest_create_channel_with_grpc_gcp(grpc_gcp_secure_channel):
686-
target="example.com:443"
687-
scopes= ["test_scope"]
688-
689-
credentials=mock.create_autospec(google.auth.credentials.Scoped,instance=True)
690-
credentials.requires_scopes=True
691-
692-
grpc_helpers.create_channel(target,credentials=credentials,scopes=scopes)
693-
grpc_gcp_secure_channel.assert_called()
694-
695-
credentials.with_scopes.assert_called_once_with(scopes,default_scopes=None)
696-
697-
698-
@pytest.mark.skipif(grpc_helpers.HAS_GRPC_GCP,reason="grpc_gcp module not available")
699645
@mock.patch("grpc.secure_channel")
700-
deftest_create_channel_without_grpc_gcp(grpc_secure_channel):
646+
deftest_create_channel(grpc_secure_channel):
701647
target="example.com:443"
702648
scopes= ["test_scope"]
703649

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp