-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add async_rest
extra for async rest dependencies
#701
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3f26e81
fix: add extra for aiohttp
parthea a8af791
improve error message
parthea 9f7d36c
with -> w; apply same change to prerelease_deps
parthea cc20eb8
move error to try block
ohmayr ea13492
address feedback
ohmayr 3174c46
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] 4b7620b
update noxfile
ohmayr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,8 @@ | |
"unit", | ||
"unit_grpc_gcp", | ||
"unit_wo_grpc", | ||
"unit_with_auth_aio", | ||
"unit_w_prerelease_deps", | ||
"unit_w_async_rest_extra", | ||
"cover", | ||
"pytype", | ||
"mypy", | ||
|
@@ -110,7 +111,7 @@ def install_prerelease_dependencies(session, constraints_path): | |
session.install(*other_deps) | ||
|
||
|
||
def default(session, install_grpc=True, prerelease=False, install_auth_aio=False): | ||
def default(session, install_grpc=True, prerelease=False, install_async_rest=False): | ||
"""Default unit test session. | ||
|
||
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 | |
"pytest-xdist", | ||
) | ||
|
||
install_extras = [] | ||
if install_grpc: | ||
install_extras.append("grpc") | ||
|
||
constraints_dir = str(CURRENT_DIRECTORY / "testing") | ||
if install_async_rest: | ||
install_extras.append("async_rest") | ||
constraints_type = "async-rest-" | ||
else: | ||
constraints_type = "" | ||
|
||
lib_with_extras = f".[{','.join(install_extras)}]" if len(install_extras) else "." | ||
if prerelease: | ||
install_prerelease_dependencies( | ||
session, f"{constraints_dir}/constraints-{PYTHON_VERSIONS[0]}.txt" | ||
session, | ||
f"{constraints_dir}/constraints-{constraints_type}{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", lib_with_extras, "--no-deps") | ||
else: | ||
session.install( | ||
"-e", | ||
".[grpc]" if install_grpc else ".", | ||
"-c", | ||
f"{constraints_dir}/constraints-{session.python}.txt", | ||
constraints_file = ( | ||
f"{constraints_dir}/constraints-{constraints_type}{session.python}.txt" | ||
) | ||
# fall back to standard constraints file | ||
if not pathlib.Path(constraints_file).exists(): | ||
ohmayr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
constraints_file = f"{constraints_dir}/constraints-{session.python}.txt" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a reminder at the top of the else that the constraints file does not determine whether the listed imports are imported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed. |
||
|
||
if install_auth_aio: | ||
session.install( | ||
"google-auth @ git+https://git@github.com/googleapis/google-auth-library-python@8833ad6f92c3300d6645355994c7db2356bd30ad" | ||
"-e", | ||
lib_with_extras, | ||
"-c", | ||
constraints_file, | ||
) | ||
|
||
# Print out package versions of dependencies | ||
|
@@ -205,7 +219,7 @@ def unit(session): | |
|
||
|
||
@nox.session(python=PYTHON_VERSIONS) | ||
def unit_with_prerelease_deps(session): | ||
def unit_w_prerelease_deps(session): | ||
"""Run the unit test suite.""" | ||
default(session, prerelease=True) | ||
|
||
|
@@ -236,9 +250,9 @@ def unit_wo_grpc(session): | |
|
||
|
||
@nox.session(python=PYTHON_VERSIONS) | ||
def unit_with_auth_aio(session): | ||
"""Run the unit test suite with google.auth.aio installed""" | ||
default(session, install_auth_aio=True) | ||
def unit_w_async_rest_extra(session): | ||
"""Run the unit test suite with the `async_rest` extra""" | ||
default(session, install_async_rest=True) | ||
|
||
|
||
@nox.session(python=DEFAULT_PYTHON_VERSION) | ||
|
@@ -261,7 +275,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,async_rest]", "mypy<1.11.0") | ||
session.install( | ||
"types-setuptools", | ||
"types-requests", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This constraints file is used to check that lower bounds | ||
ohmayr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# are correct in setup.py | ||
# List *all* library dependencies and extras in this file. | ||
# Pin the version to the lower bound. | ||
# | ||
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", | ||
# Then this file should have foo==1.14.0 | ||
googleapis-common-protos==1.56.2 | ||
protobuf==3.19.5 | ||
google-auth==2.35.0 | ||
# from google-auth[aiohttp] | ||
aiohttp==3.6.2 | ||
requests==2.20.0 | ||
grpcio==1.33.2 | ||
grpcio-status==1.33.2 | ||
grpcio-gcp==0.2.2 | ||
proto-plus==1.22.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest restructuring just slightly for brevity (I marked with
##
the sections I changed). This depends onpip install foo[]
with an empty extras list working, which I think it does. If not, one more line will be needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed.