uvloop icon indicating copy to clipboard operation
uvloop copied to clipboard

expose libuv uv_fs_event functionality

Open jensbjorgensen opened this issue 2 years ago • 7 comments

It's quite natural for filesystem monitoring to be part of the event loop, and libuv has done a cross-platform implementation. Actually asyncio should probably expose this as well--maybe they will draw from this example implementation to inform their own api?

I wasn't sure what the best way to expose the FS_EVENT_* constants was--I preferred to have them refer directly to the constants defined in libuv but I'm a cython newb and I couldn't get the right incantation. In the merge below they are hardcoded in uvloop.const. Maybe you can suggest a better way.

jensbjorgensen avatar Jun 15 '22 20:06 jensbjorgensen

ok, looks like some items for me to look at. the specific tests I added passed but I see there are formatting issues, sorry I hadn't run those, will update

jensbjorgensen avatar Jun 15 '22 21:06 jensbjorgensen

the tests I've added are passing, seems like the test suite just takes too long to run for some reason?

jensbjorgensen avatar Jun 15 '22 21:06 jensbjorgensen

the failures in 3.9 are apparently due to asyncio.events._TransProtPair not being defined in python 3.9

jensbjorgensen avatar Jun 15 '22 22:06 jensbjorgensen

ok! I got test_sourcecode.py fixed up (which I didn't break but ... bonus!), that'd be awesome if one of you maintainers could take a look

jensbjorgensen avatar Jun 21 '22 20:06 jensbjorgensen

please have a look at my latest push and thanks for your time reviewing the PR :-)

jensbjorgensen avatar Jul 18 '22 17:07 jensbjorgensen

I think everything is lined up now with your comments? Let me know if there's anything else.

jensbjorgensen avatar Jul 19 '22 22:07 jensbjorgensen

ping-ping?

jensbjorgensen avatar Jul 27 '22 00:07 jensbjorgensen

Hey sorry for the delay! I talked to Yury and I'm convinced that this new API could have arguably different designs, and it's preferred to be a user-space extension of uvloop, while uvloop is targeting to be a drop-in replacement for asyncio itself only. With that said, we could still have the get_uv_loop_ptr() API accepted (#310) for easier integration with the libuv loop.

fantix avatar Aug 13 '22 18:08 fantix

Hey thanks for getting back to me. Understood, if we can get access to the underlying uv_loop_t we can use the functionality from there. I'll pull from git and take a look!

On 8/13/22 1:01 PM, Fantix King wrote:

Hey sorry for the delay! I talked to Yury and I'm convinced that this new API could have arguably different designs, and it's preferred to be a user-space extension of uvloop, while uvloop is targeting to be a drop-in replacement for asyncio itself only. With that said, we could still have the |get_uv_loop_ptr()| API accepted for easier integration with the libuv loop.

— Reply to this email directly, view it on GitHub https://github.com/MagicStack/uvloop/pull/474#issuecomment-1214198761, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNVZ3EX5JVUMTKGRJVYGS3VY7PGRANCNFSM5Y4UF4GQ. You are receiving this because you authored the thread.Message ID: @.***>

-- Jens B. Jorgensen @.***

jensbjorgensen avatar Aug 15 '22 14:08 jensbjorgensen

@jensbjorgensen We changed our mind - let's move forward with this PR! I'll probably just push a few commits to make the API private, drop the partially-implemented recursive flag, and merge the rest as it is.

Please feel free to let me know if you have any comments, or create a new PR if this is already merged.

fantix avatar Sep 01 '22 17:09 fantix

Awesome, great news! No remaining comments or anything from my side. Looking forward to it.

On 9/1/22 12:32 PM, Fantix King wrote:

@jensbjorgensen https://github.com/jensbjorgensen We changed our mind - let's move forward with this PR! I'll probably just push a few commits to make the API private, drop the partially-implemented https://github.com/libuv/libuv/issues/1778 |recursive| flag, and merge the rest as it is.

Please feel free to let me know if you have any comments, or create a new PR if this is already merged.

— Reply to this email directly, view it on GitHub https://github.com/MagicStack/uvloop/pull/474#issuecomment-1234579236, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNVZ3F5TPGWGALPWEMJCXDV4DSDZANCNFSM5Y4UF4GQ. You are receiving this because you were mentioned.Message ID: @.***>

-- Jens B. Jorgensen @.***

jensbjorgensen avatar Sep 01 '22 17:09 jensbjorgensen

Not that I expect you to change your mind, but FWIW the file-watching mechanism is something that naturally wants to be part of an I/O loop wouldn't you say? (maybe not on Windows?) Another way of looking at the change is it would give the asyncio folks a working mechanism to look at which they could consider as an API-addition. Having a working implementation is a great way for API mechanisms to get a trial run before they make it into the standard library, like how Boost ==> C++ std library works ;-)

On 8/13/22 1:01 PM, Fantix King wrote:

Hey sorry for the delay! I talked to Yury and I'm convinced that this new API could have arguably different designs, and it's preferred to be a user-space extension of uvloop, while uvloop is targeting to be a drop-in replacement for asyncio itself only. With that said, we could still have the |get_uv_loop_ptr()| API accepted for easier integration with the libuv loop.

— Reply to this email directly, view it on GitHub https://github.com/MagicStack/uvloop/pull/474#issuecomment-1214198761, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNVZ3EX5JVUMTKGRJVYGS3VY7PGRANCNFSM5Y4UF4GQ. You are receiving this because you authored the thread.Message ID: @.***>

-- Jens B. Jorgensen @.***

jensbjorgensen avatar Oct 11 '22 08:10 jensbjorgensen