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

Appearance settings

Commit 977a198

Browse filesBrowse files
committed
fix: add extra for aiohttp
1 parent 45b8a6d commit 977a198
Copy full SHA for 977a198

File tree

7 files changed

+55
-20
lines changed
Filter options

7 files changed

+55
-20
lines changed

‎.github/workflows/unittest.yml

Copy file name to clipboardExpand all lines: .github/workflows/unittest.yml
+1-1Lines 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", "_with_prerelease_deps", "_with_async_rest_extra"]
1515
python:
1616
- "3.7"
1717
- "3.8"

‎google/api_core/rest_streaming_async.py

Copy file name to clipboardExpand all lines: google/api_core/rest_streaming_async.py
+1-1Lines changed: 1 addition & 1 deletion
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

Copy file name to clipboardExpand all lines: noxfile.py
+32-16Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"unit",
3939
"unit_grpc_gcp",
4040
"unit_wo_grpc",
41-
"unit_with_auth_aio",
41+
"unit_with_async_rest_extra",
4242
"cover",
4343
"pytype",
4444
"mypy",
@@ -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
@@ -130,24 +130,40 @@ def default(session, install_grpc=True, prerelease=False, install_auth_aio=False
130130
)
131131

132132
constraints_dir = str(CURRENT_DIRECTORY / "testing")
133-
133+
constraints_type = "async-rest-" if install_async_rest else ""
134134
if prerelease:
135135
install_prerelease_dependencies(
136-
session, f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt"
136+
session,
137+
f"{constraints_dir}/constraints-{constraints_type}{PYTHON_VERSIONS[0]}.txt",
137138
)
138139
# This *must* be the last install command to get the package from source.
139-
session.install("-e", ".", "--no-deps")
140-
else:
141140
session.install(
142-
"-e",
143-
".[grpc]" if install_grpc else ".",
144-
"-c",
145-
f"{constraints_dir}/constraints-{session.python}.txt",
141+
"-e", "." + ("[async_rest]" if install_async_rest else ""), "--no-deps"
146142
)
143+
else:
144+
constraints_file = (
145+
f"{constraints_dir}/constraints-{constraints_type}{session.python}.txt"
146+
)
147+
# fall back to standard constraints file
148+
if not pathlib.Path(constraints_file).exists:
149+
constraints_file = f"{constraints_dir}/constraints-{session.python}.txt"
147150

148-
if install_auth_aio:
149151
session.install(
150-
"google-auth @ git+https://git@github.com/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad"
152+
"-e",
153+
"."
154+
+ (
155+
"[grpc,async_rest]"
156+
if install_grpc and install_async_rest
157+
else (
158+
"[grpc]"
159+
if install_grpc
160+
else "[async_rest]"
161+
if install_async_rest
162+
else ""
163+
)
164+
),
165+
"-c",
166+
f"{constraints_dir}/constraints-{constraints_type}{session.python}.txt",
151167
)
152168

153169
# Print out package versions of dependencies
@@ -236,9 +252,9 @@ def unit_wo_grpc(session):
236252

237253

238254
@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)
255+
def unit_with_async_rest_extra(session):
256+
"""Run the unit test suite with the `async_rest` extra"""
257+
default(session, install_async_rest=True)
242258

243259

244260
@nox.session(python=DEFAULT_PYTHON_VERSION)
@@ -261,7 +277,7 @@ def mypy(session):
261277
"""Run type-checking."""
262278
# TODO(https://github.com/googleapis/python-api-core/issues/682):
263279
# Use the latest version of mypy instead of mypy<1.11.0
264-
session.install(".[grpc]", "mypy<1.11.0")
280+
session.install(".[grpc,async_rest]", "mypy<1.11.0")
265281
session.install(
266282
"types-setuptools",
267283
"types-requests",

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+3Lines 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

Copy file name to clipboardExpand all lines: testing/constraints-3.7.txt
-1Lines 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
+17Lines 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

Copy file name to clipboardExpand all lines: tests/asyncio/test_rest_streaming_async.py
+1-1Lines changed: 1 addition & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.