Skip to content

Commit 700a47f

Browse files
committed
fix: add extra for aiohttp
1 parent 58516ef commit 700a47f

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

google/api_core/rest_streaming_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import google.auth.aio.transport
2323
except ImportError as e: # pragma: NO COVER
2424
raise ImportError(
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."
2626
) from e
2727

2828
import google.protobuf.message

noxfile.py

+20-12
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def install_prerelease_dependencies(session, constraints_path):
110110
session.install(*other_deps)
111111

112112

113-
def default(session, install_grpc=True, prerelease=False, install_auth_aio=False):
113+
def default(session, install_grpc=True, prerelease=False, install_async_rest=False):
114114
"""Default unit test session.
115115
116116
This is intended to be run **without** an interpreter set, so
@@ -136,20 +136,28 @@ def default(session, install_grpc=True, prerelease=False, install_auth_aio=False
136136
session, f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt"
137137
)
138138
# This *must* be the last install command to get the package from source.
139-
session.install("-e", ".", "--no-deps")
139+
session.install(
140+
"-e", "." + ("[async_rest]" if install_async_rest else ""), "--no-deps"
141+
)
140142
else:
141143
session.install(
142144
"-e",
143-
".[grpc]" if install_grpc else ".",
145+
"."
146+
+ (
147+
"[grpc,async_rest]"
148+
if install_grpc and install_async_rest
149+
else (
150+
"[grpc]"
151+
if install_grpc
152+
else "[async_rest]"
153+
if install_async_rest
154+
else ""
155+
)
156+
),
144157
"-c",
145158
f"{constraints_dir}/constraints-{session.python}.txt",
146159
)
147160

148-
if install_auth_aio:
149-
session.install(
150-
"google-auth @ git+https://git@github.com/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad"
151-
)
152-
153161
# Print out package versions of dependencies
154162
session.run(
155163
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
@@ -236,9 +244,9 @@ def unit_wo_grpc(session):
236244

237245

238246
@nox.session(python=PYTHON_VERSIONS)
239-
def unit_with_auth_aio(session):
240-
"""Run the unit test suite with google.auth.aio installed"""
241-
default(session, install_auth_aio=True)
247+
def unit_with_async_rest_extra(session):
248+
"""Run the unit test suite with the `async_rest` extra"""
249+
default(session, install_async_rest=True)
242250

243251

244252
@nox.session(python=DEFAULT_PYTHON_VERSION)
@@ -261,7 +269,7 @@ def mypy(session):
261269
"""Run type-checking."""
262270
# TODO(https://github.com/googleapis/python-api-core/issues/682):
263271
# Use the latest version of mypy instead of mypy<1.11.0
264-
session.install(".[grpc]", "mypy<1.11.0")
272+
session.install(".[grpc,async_rest]", "mypy<1.11.0")
265273
session.install(
266274
"types-setuptools",
267275
"types-requests",

setup.py

+3
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'",

tests/asyncio/test_rest_streaming_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
if not AUTH_AIO_INSTALLED: # pragma: NO COVER
3737
pytest.skip(
38-
"google-auth>=2.35.0 is required to use asynchronous rest streaming.",
38+
"google-api-core[async_rest] is required to use asynchronous rest streaming.",
3939
allow_module_level=True,
4040
)
4141

0 commit comments

Comments
 (0)