samuelcolvin / watchfiles

Simple, modern and fast file watching and code reload in Python.
https://watchfiles.helpmanual.io
MIT License
1.72k stars 108 forks source link

Feature request: add or remove watched directories while `async for changes in awatch('/path/to/dir')` is iterating #298

Open tovrstra opened 3 weeks ago

tovrstra commented 3 weeks ago

I was hoping to use watchfiles, but it seems impossible to add or remove watches while iterating over changes. (?)

Such a feature would be useful for more complex programs where one coroutine or thread is responsible for deciding which directories to (un)watch, typically not recursively, while another part of the program is in charge of processing file system events.