Skip to content

Commit

Permalink
fix: add extra for aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Sep 20, 2024
1 parent 58516ef commit 5a5d6ce
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion google/api_core/rest_streaming_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import google.auth.aio.transport
except ImportError as e: # pragma: NO COVER
raise ImportError(
"google-auth>=2.35.0 is required to use asynchronous rest streaming."
"google-api-core[aiohttp] is required to use asynchronous rest streaming."
) from e

import google.protobuf.message
Expand Down
24 changes: 16 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,28 @@ def default(session, install_grpc=True, prerelease=False, install_auth_aio=False
session, f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt"
)
# This *must* be the last install command to get the package from source.
session.install("-e", ".", "--no-deps")
session.install(
"-e", "." + ("[aiohttp]" if install_auth_aio else ""), "--no-deps"
)
else:
session.install(
"-e",
".[grpc]" if install_grpc else ".",
"."
+ (
"[grpc,aiohttp]"
if install_grpc and install_auth_aio
else (
"[grpc]"
if install_grpc
else "[aiohttp]"
if install_auth_aio
else ""
)
),
"-c",
f"{constraints_dir}/constraints-{session.python}.txt",
)

if install_auth_aio:
session.install(
"google-auth @ git+https://git@github.com/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad"
)

# Print out package versions of dependencies
session.run(
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
Expand Down Expand Up @@ -261,7 +269,7 @@ def mypy(session):
"""Run type-checking."""
# TODO(https://github.com/googleapis/python-api-core/issues/682):
# Use the latest version of mypy instead of mypy<1.11.0
session.install(".[grpc]", "mypy<1.11.0")
session.install(".[grpc,aiohttp]", "mypy<1.11.0")
session.install(
"types-setuptools",
"types-requests",
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"requests >= 2.18.0, < 3.0.0.dev0",
]
extras = {
"aiohttp": [
"google-auth[aiohttp] >= 2.35.0, < 3.0.dev0",
],
"grpc": [
"grpcio >= 1.33.2, < 2.0dev",
"grpcio >= 1.49.1, < 2.0dev; python_version>='3.11'",
Expand Down
2 changes: 1 addition & 1 deletion tests/asyncio/test_rest_streaming_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

if not AUTH_AIO_INSTALLED: # pragma: NO COVER
pytest.skip(
"google-auth>=2.35.0 is required to use asynchronous rest streaming.",
"google-api-core[aiohttp] is required to use asynchronous rest streaming.",
allow_module_level=True,
)

Expand Down

0 comments on commit 5a5d6ce

Please sign in to comment.