Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.67k stars 149 forks source link

file watch support? #27

Open samuelcolvin opened 7 years ago

samuelcolvin commented 7 years ago

While answering https://github.com/aio-libs/aiohttp-devtools/issues/118 I suddenly wondered if aiofiles had support for watching for file changes.

It seems it doesn't at the moment, is it something you'd consider in the future?

Like watchdog it could start by implementing a brute force "iterate over files looking for changes" interface then go on to use inotify in the future (and equivalent for other OSs).

yeraydiazdiaz commented 7 years ago

My tailsocket project actually (ab)uses vanilla asyncio.add_reader which works fine on kqueue compatible platforms, on Linux though I used pyinotify which has asyncio support and seems to work well.

I haven't tested this thoroughly though.

samuelcolvin commented 7 years ago

The problem is that aiohttp-devtools should support windows and osx so AFAIK pyinotify is out of the running.

However watchdog seems slightly buggy and does strange things with threads which is causing problems.