watchfiles
watchfiles copied to clipboard
Add option to disable recursive watch of folders
Currently, all folders are recursively watched, with the only option to exclude folders via options with filters.
https://github.com/samuelcolvin/watchfiles/blob/937d00fe5ba9c1c8f6360823078a9b6387c9e07c/src/lib.rs#L50
I would propose to include a boolean flag recursive=False
that would disable this default behaviour, to only parse the folders without recursion.
I'm willing to implement the future, as it seems simple enough, but my Rust knowledge is limited.
Seems fair to me, PR welcome.
Hello @samuelcolvin ,
I was working on this feature (see here https://github.com/bvanelli/watchfiles/commit/7daf501e71d9d5354defa532e6458313537a2c76) but I'm noticing some strange behavior regarding the notify library.
On the add recursive in my tests, no event is raised for the subdirectory: https://github.com/bvanelli/watchfiles/blob/178-disable-recursion/tests/test_rust_notify.py#L19
However, for the modify test, suddenly there is a modify event raised for the parent directory, when modifying a file inside the directory: https://github.com/bvanelli/watchfiles/blob/178-disable-recursion/tests/test_rust_notify.py#L47
I tried searching on the library documentation but without success. Also, there is no issue open on notify for this particular behavior. I also thought it could be related to OS, I'm running windows.
Do you know anything about it?
Do you know anything about it?
Sorry, I don't know, best to ask on notify
. But I suspect the answer will be, that's just weird behaviours/a bug in the OS implementation, we can't fix it.
fixed in #183