Skip to content
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

nwis_client: SyntaxError #153

Closed
jarq6c opened this issue Nov 3, 2021 · 12 comments
Closed

nwis_client: SyntaxError #153

jarq6c opened this issue Nov 3, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@jarq6c
Copy link
Collaborator

jarq6c commented Nov 3, 2021

Issue

hydrotools.nwis_client version 3.0.6 raises a SyntaxError on import.
@aaraney would you mind looking into this?

Environment:

Python 3.8.10 (default, Jun  4 2021, 15:09:15)
[GCC 7.5.0] :: Anaconda, Inc. on linux

Duplicate

import hydrotools.nwis_client

Error

'base_url:typing.Union[str, yarl.URL, NoneType]=None' of kind 'POSITIONAL_OR_KEYWORD' follows 'cache:CacheBackend=None' of kind 'KEYWORD_ONLY'
Traceback (most recent call last):
  File "/home/jason.regina/Projects/nwis_test/miniconda3/lib/python3.8/site-packages/aiohttp_client_cache/docs/forge_utils.py", line 32, in wrapper
    return revision(target_function)
  File "/home/jason.regina/Projects/nwis_test/miniconda3/lib/python3.8/site-packages/forge/_revision.py", line 330, in __call__
    next_.validate()
  File "/home/jason.regina/Projects/nwis_test/miniconda3/lib/python3.8/site-packages/forge/_signature.py", line 1344, in validate
    raise SyntaxError(
SyntaxError: 'base_url:typing.Union[str, yarl.URL, NoneType]=None' of kind 'POSITIONAL_OR_KEYWORD' follows 'cache:CacheBackend=None' of kind 'KEYWORD_ONLY'
@jarq6c jarq6c added the bug Something isn't working label Nov 3, 2021
@jarq6c
Copy link
Collaborator Author

jarq6c commented Nov 3, 2021

Note: Encountered this error while trying to troubleshoot #150

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

@jarq6c, thanks for bringing this to my attention. I will take a look at it.

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

This looks like it might be a downstream issue with aiohttp_client_cache. I was able to reproduce the issue by just importing aiohttp_client_cache:

import aiohttp_client_cache

> 'base_url:typing.Union[str, yarl.URL, NoneType]=None' of kind 'POSITIONAL_OR_KEYWORD' follows 'cache:CacheBackend=None' of kind 'KEYWORD_ONLY'
Traceback (most recent call last):
  File "/Users/araney/github/test_hydrotools/venv/lib/python3.8/site-packages/aiohttp_client_cache/docs/forge_utils.py", line 32, in wrapper
    return revision(target_function)
  File "/Users/araney/github/test_hydrotools/venv/lib/python3.8/site-packages/forge/_revision.py", line 330, in __call__
    next_.validate()
  File "/Users/araney/github/test_hydrotools/venv/lib/python3.8/site-packages/forge/_signature.py", line 1344, in validate
    raise SyntaxError(
SyntaxError: 'base_url:typing.Union[str, yarl.URL, NoneType]=None' of kind 'POSITIONAL_OR_KEYWORD' follows 'cache:CacheBackend=None' of kind 'KEYWORD_ONLY'

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

I will try rolling back the version of aiohttp-client-cache and see if this resolves the issue. v0.5.1 of aiohttp-client-cache was released on September 10, 2021 so I would have hoped that other tests would have caught this before then. Ill update the ticket with my findings shortly.

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

I found that rolling back aiohttp-client-cache did not mitigate the issue. My guess is this is related to aiohttp's October 31, 2021 release. Going to try rolling back aiohttp from 3.8.0.

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

Okay, so I just verified that the issue is with 3.8.0 of aiohttp. I rolled the version back to aiohttp==3.7.4.post0 and the issue disappeared. Ill open an issue in aiohttp-client-cache to let them know of the issue. Ill also release a new patched version of _restclient and pin aiohttp to 3.7.4.post0.

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

pinning self opened issue aiohttp-client-cache #103

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

redeployed _restclient (see #154)

update using:

pip install -U hydrotools._restclient

@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

I heard back from the maintainer of aiohttp_client_cache:

Thanks for reporting! Looks like a new base_url param was added in aio-libs/aiohttp#6129, and for some reason it's positional-or-keyword instead of keyword-only like the rest of the params. I'll get that fixed shortly.

@jarq6c
Copy link
Collaborator Author

jarq6c commented Nov 3, 2021

Thanks for doing all the leg work!

@jarq6c jarq6c closed this as completed Nov 3, 2021
@aaraney
Copy link
Member

aaraney commented Nov 3, 2021

For sure! Have a nice evening!

@jarq6c
Copy link
Collaborator Author

jarq6c commented Nov 3, 2021

Just confirming that the error was fixed on my end by updating _restclient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants