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

Drop support for Python v3.8 and remove asgiref from non Django code #1222

Open
medihack opened this issue Oct 13, 2024 · 5 comments
Open

Drop support for Python v3.8 and remove asgiref from non Django code #1222

medihack opened this issue Oct 13, 2024 · 5 comments
Assignees
Milestone

Comments

@medihack
Copy link
Member

medihack commented Oct 13, 2024

As discussed on Discord, we want to drop support for Python v3.8 as it reached its end-of-life. We then can use asyncio.to_thread (available in Python >= 3.9) instead of asgiref.sync.sync_to_async (we should then do this together in the 3.0 release).

@medihack medihack added this to the Version 3.0 milestone Oct 13, 2024
@medihack
Copy link
Member Author

I took a quick look at replacing asgiref.sync_to_async with asyncio.to_thread, but I don't think it is worth it. We use sync_to_async quite often as a decorator, which is not directly possible with asyncio.to_thread. And asgiref also has the convenient method the other way around (async_to_sync).

@onlyann
Copy link
Contributor

onlyann commented Oct 16, 2024

I think it is more nuanced than that.

asgiref might need to stay for the Django integration as per their async doc.

However, there is no need to make it a dependency for any consumer that is not using Django.

We use sync_to_async quite often as a decorator, which is not directly possible with asyncio.to_thread

That should be fine. Beside Django integration, it seems it is only used in tests. That could stay there or it would be trivial to update to not use a decorator and explicitly wrap the function.

@medihack
Copy link
Member Author

Ok, good point. I will give it a try.

@medihack medihack self-assigned this Oct 16, 2024
@ewjoachim
Copy link
Member

So shall I close this as #1224 was merged or do we keep it open for the replacement of sync_to_async ?

@medihack medihack changed the title Drop support for Python v3.8 Drop support for Python v3.8 and remove asgiref from non Django code Oct 19, 2024
@medihack
Copy link
Member Author

So shall I close this as #1224 was merged or do we keep it open for the replacement of sync_to_async ?

PR #1226 will close it :-)

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

No branches or pull requests

3 participants