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

Bump uvloop to v0.18.0 #2134

Closed
wants to merge 4 commits into from
Closed

Conversation

Ale-Cas
Copy link

@Ale-Cas Ale-Cas commented Oct 20, 2023

Summary

This PR bumps uvloop to v0.18.0 to try and address the mypy error in feat/support-3.12.
Related:
#2129 (comment)

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@Kludex
Copy link
Member

Kludex commented Oct 20, 2023

That PR is already using the latest uvloop, that's exactly why it's failing.

@Ale-Cas
Copy link
Author

Ale-Cas commented Oct 20, 2023

You're right I thought it was using 0.17 but I double-checked the run and it's already 0.18, I'm trying to understand what would make mypy see EventLoopPolicy since it's in the uvloop init but I guess that's not related to uvicorn so I'll close this, sorry for the spam 🙏🏻

@Ale-Cas Ale-Cas closed this Oct 20, 2023
@Kludex
Copy link
Member

Kludex commented Oct 20, 2023

np. Thanks for closing it. 👍

@Ale-Cas Ale-Cas deleted the bump-uvloop branch October 20, 2023 11:27
@graingert
Copy link
Member

graingert commented Oct 20, 2023

@Ale-Cas they added an __init__.pyi with most of the members removed this hides EventLoopPolicy from mypy. The issue is fixed upstream pending a release this weekend: MagicStack/uvloop#575 (comment)

@Ale-Cas
Copy link
Author

Ale-Cas commented Oct 20, 2023

Great! thank you both!
I was thinking something like this workaround / temp solution would make mypy happy:

def uvloop_setup(use_subprocess: bool = False) -> None:
    if hasattr(uvloop, "EventLoopPolicy"):
        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

and maybe not related but what's the reason for the unused use_subprocess variable there? is it just for compatibility with the loop_setup from asyncio?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants