Tomorrow is my birthday. 😁
Remote
Marcelo Trylesinski
@marcelotryle@fosstodon.org
mastodon 4.7.3Software Engineer 🧑🏻💻🇧🇷🇺🇾🇮🇹🇺🇦
Uvicorn & Starlette maintainer 🦄🌟
FastAPI Expert ⚡
230 Followers
58 Following
13 Posts
Joined November 16, 2022
GitHub:
Open post
Open post
Open post
Open post
How would you build a package to detect blocking IO running on coroutines?
I need ideas.
0
15
0
0
Open post
Open post
Replying to
import asyncio
async def fun():
with open("main.py", "r") as f:
print(f.read())
asyncio.run(fun(), debug=True)
I want with open to raise a warning to the user. Either being a linter or at runtime.
0
12
0
0
Open post
Replying to
@carlton@fosstodon.org I'm not following how that is suppose to help me. 🤔
I want a big warning: "On line x, you are running blocking IO, please use the loop.run_in_executor".
0
1
0
0
Open post
Replying to
@carlton@fosstodon.org but that log entry just says that you run the fun coroutine in x seconds, it doesn't tell me that I open a file, does it? 🧐
0
4
0
0
Open post
Replying to
@carlton@fosstodon.org it tells that the coroutine fun is blocking yeah, but it doesn't tell that opening a file shouldn't be done there (you should have used loop.run_in_executor).
0
2
0
0
Open post
Replying to
@carlton@fosstodon.org I don't think it's in the scope, because it's not even an error yet (nor I think it will ever be, because it's just a callable). But well, if this can be logged on debug mode, it would be amazing 👀
0
0
0
0
Open post