-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: Use nest-asyncio when configured with env var #451
Conversation
try: | ||
asyncio.get_event_loop() | ||
except RuntimeError as ex: | ||
import nest_asyncio as _ # type: ignore |
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.
why is this import here?
except Exception: | ||
return False | ||
|
||
|
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.
make sure that there is at least one thing in cicd where we run the python sdk (for example in e2e test with flask), where nest_asyncio is not a dependency and then we make sure it all works
tests/test_config.py
Outdated
def test_nest_asyncio_import(): | ||
from supertokens_python.async_to_sync_wrapper import nest_asyncio_enabled, sync | ||
from os import getenv | ||
|
||
circleci = getenv("CIRCLECI", "false") == "true" | ||
|
||
if not circleci: | ||
return | ||
|
||
# Has to be circleci | ||
if nest_asyncio_enabled(): | ||
# nest-asyncio should be installed | ||
sync(asyncio.sleep(0.1)) | ||
else: | ||
# nest-asyncio shouldn't be installed and sync() should throw error | ||
try: | ||
sync(asyncio.sleep(0.1)) | ||
assert False, "Shouldn't come here" | ||
except ModuleNotFoundError: | ||
# should be missing | ||
assert True |
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.
remove this
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.
Done
Summary of change
Use nest-asyncio when configured with env var
Checklist for important updates
coreDriverInterfaceSupported.json
file has been updated (if needed)supertokens_python/constants.py
frontendDriverInterfaceSupported.json
file has been updated (if needed)setup.py
supertokens_python/constants.py
git tag
) in the formatvX.Y.Z
, and then find the latest branch (git branch --all
) whoseX.Y
is greater than the latest released tag.supertokens_python/utils.py
file to include that in theFRAMEWORKS
variablesyncio
/asyncio
functions are consistent.tests/sessions/test_access_token_version.py
to account for any new claims that are optional or omitted by the core