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

Commit84bf637

Browse files
partheaohmayrgcf-owl-bot[bot]
authored
chore: addasync_rest extra for async rest dependencies (#701)
* fix: add extra for aiohttp* improve error message* with -> w; apply same change to prerelease_deps* move error to try block* address feedback* 🦉 Updates from OwlBot post-processorSeehttps://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md* update noxfile---------Co-authored-by: ohmayr <omairnaveed@ymail.com>Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent45b8a6d commit84bf637

File tree

7 files changed

+55
-25
lines changed

7 files changed

+55
-25
lines changed

‎.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", "_with_prerelease_deps", "_with_auth_aio"]
14+
option:["", "_grpc_gcp", "_wo_grpc", "_w_prerelease_deps", "_w_async_rest_extra"]
1515
python:
1616
-"3.7"
1717
-"3.8"

‎google/api_core/rest_streaming_async.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
importgoogle.auth.aio.transport
2323
exceptImportErrorase:# pragma: NO COVER
2424
raiseImportError(
25-
"google-auth>=2.35.0 is required to use asynchronous rest streaming."
25+
"`google-api-core[async_rest]` is required to use asynchronous rest streaming. "
26+
"Install the `async_rest` extra of `google-api-core` using "
27+
"`pip install google-api-core[async_rest]`."
2628
)frome
2729

2830
importgoogle.protobuf.message

‎noxfile.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"unit",
3939
"unit_grpc_gcp",
4040
"unit_wo_grpc",
41-
"unit_with_auth_aio",
41+
"unit_w_prerelease_deps",
42+
"unit_w_async_rest_extra",
4243
"cover",
4344
"pytype",
4445
"mypy",
@@ -110,7 +111,7 @@ def install_prerelease_dependencies(session, constraints_path):
110111
session.install(*other_deps)
111112

112113

113-
defdefault(session,install_grpc=True,prerelease=False,install_auth_aio=False):
114+
defdefault(session,install_grpc=True,prerelease=False,install_async_rest=False):
114115
"""Default unit test session.
115116
116117
This is intended to be run **without** an interpreter set, so
@@ -129,25 +130,38 @@ def default(session, install_grpc=True, prerelease=False, install_auth_aio=False
129130
"pytest-xdist",
130131
)
131132

133+
install_extras= []
134+
ifinstall_grpc:
135+
install_extras.append("grpc")
136+
132137
constraints_dir=str(CURRENT_DIRECTORY/"testing")
138+
ifinstall_async_rest:
139+
install_extras.append("async_rest")
140+
constraints_type="async-rest-"
141+
else:
142+
constraints_type=""
133143

144+
lib_with_extras=f".[{','.join(install_extras)}]"iflen(install_extras)else"."
134145
ifprerelease:
135146
install_prerelease_dependencies(
136-
session,f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt"
147+
session,
148+
f"{constraints_dir}/constraints-{constraints_type}{PYTHON_VERSIONS[0]}.txt",
137149
)
138150
# This *must* be the last install command to get the package from source.
139-
session.install("-e",".","--no-deps")
151+
session.install("-e",lib_with_extras,"--no-deps")
140152
else:
141-
session.install(
142-
"-e",
143-
".[grpc]"ifinstall_grpcelse".",
144-
"-c",
145-
f"{constraints_dir}/constraints-{session.python}.txt",
153+
constraints_file= (
154+
f"{constraints_dir}/constraints-{constraints_type}{session.python}.txt"
146155
)
156+
# fall back to standard constraints file
157+
ifnotpathlib.Path(constraints_file).exists():
158+
constraints_file=f"{constraints_dir}/constraints-{session.python}.txt"
147159

148-
ifinstall_auth_aio:
149160
session.install(
150-
"google-auth @ git+https://git@github.com/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad"
161+
"-e",
162+
lib_with_extras,
163+
"-c",
164+
constraints_file,
151165
)
152166

153167
# Print out package versions of dependencies
@@ -205,7 +219,7 @@ def unit(session):
205219

206220

207221
@nox.session(python=PYTHON_VERSIONS)
208-
defunit_with_prerelease_deps(session):
222+
defunit_w_prerelease_deps(session):
209223
"""Run the unit test suite."""
210224
default(session,prerelease=True)
211225

@@ -236,9 +250,9 @@ def unit_wo_grpc(session):
236250

237251

238252
@nox.session(python=PYTHON_VERSIONS)
239-
defunit_with_auth_aio(session):
240-
"""Run the unit test suite withgoogle.auth.aio installed"""
241-
default(session,install_auth_aio=True)
253+
defunit_w_async_rest_extra(session):
254+
"""Run the unit test suite withthe `async_rest` extra"""
255+
default(session,install_async_rest=True)
242256

243257

244258
@nox.session(python=DEFAULT_PYTHON_VERSION)
@@ -261,7 +275,7 @@ def mypy(session):
261275
"""Run type-checking."""
262276
# TODO(https://github.com/googleapis/python-api-core/issues/682):
263277
# Use the latest version of mypy instead of mypy<1.11.0
264-
session.install(".[grpc]","mypy<1.11.0")
278+
session.install(".[grpc,async_rest]","mypy<1.11.0")
265279
session.install(
266280
"types-setuptools",
267281
"types-requests",

‎setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
"requests >= 2.18.0, < 3.0.0.dev0",
3737
]
3838
extras= {
39+
"async_rest": [
40+
"google-auth[aiohttp] >= 2.35.0, < 3.0.dev0",
41+
],
3942
"grpc": [
4043
"grpcio >= 1.33.2, < 2.0dev",
4144
"grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'",

‎testing/constraints-3.7.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ googleapis-common-protos==1.56.2
99
protobuf==3.19.5
1010
google-auth==2.14.1
1111
requests==2.18.0
12-
packaging==14.3
1312
grpcio==1.33.2
1413
grpcio-status==1.33.2
1514
grpcio-gcp==0.2.2
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This constraints file is used to check that lower bounds
2+
# are correct in setup.py
3+
# List *all* library dependencies and extras in this file.
4+
# Pin the version to the lower bound.
5+
#
6+
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
7+
# Then this file should have foo==1.14.0
8+
googleapis-common-protos==1.56.2
9+
protobuf==3.19.5
10+
google-auth==2.35.0
11+
# from google-auth[aiohttp]
12+
aiohttp==3.6.2
13+
requests==2.20.0
14+
grpcio==1.33.2
15+
grpcio-status==1.33.2
16+
grpcio-gcp==0.2.2
17+
proto-plus==1.22.3

‎tests/asyncio/test_rest_streaming_async.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@
2828

2929
try:
3030
fromgoogle.auth.aio.transportimportResponse
31-
32-
AUTH_AIO_INSTALLED=True
3331
exceptImportError:
34-
AUTH_AIO_INSTALLED=False
35-
36-
ifnotAUTH_AIO_INSTALLED:# pragma: NO COVER
3732
pytest.skip(
38-
"google-auth>=2.35.0 is required touse asynchronous rest streaming.",
33+
"google-api-core[async_rest] is required totest asynchronous rest streaming.",
3934
allow_module_level=True,
4035
)
4136

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp