-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking file rename #201
Comments
Notify does support renaming with some backends, see here, I think some back-ends (e.g. polling) don't support it but most do. If you run watchfiles in debug mode, you'll see the raw events and be able to see what we get to process (e.g. run I guess there are two options for watchfiles:
I guess the third option would be to combine the two, but I think that's too complicated - if we really wanted rename events with backends that don't natively support it, I'd rather that was implemented in notify, there was even some discussion of this on notify-rs/notify#20 and maybe in other issues. This might also required better event ordering, see #148 (comment) - if the theory prosited on #148 that the order problem is caused by use of hashset, it should be pretty easy to fix. |
Yes, I think we should take advantage of Notifiy's information about renaming when it is available.
I agree that it would be better if it were implemented in Notify, but maybe watchfiles could go a bit further and for instance support a file tracking mode, where you explicitly pass a file that you want to track. Then it could offer several strategies to try and track this file, the most brute-force being identifying files by content. By reducing the scope of events to just this file, it might not be too expensive. I think this kind of things would likely not be accepted in Notify, and easier to implement in watchfiles? |
Maybe, but it sounds complicated in watchfiles too 😄. Let's start by fixing #148 and adding a Another question: this would be a breaking change. How do you feel about releasing what we have on main now as V1 (see #186), then any breaking changes to support renaming would be released as V2? I'm well aware that watchfiles is should be at v1 by now. |
👍
I agree with that, release |
New plan at #202 (comment). If anyone wants to take this on, feel free. |
In jupyter-server/jupyverse#244 I implemented the tracking of file renames using |
ok, I still think it would still be a good idea here, but good to know it's not urgent. |
As a consumer, simply getting a If I had access to the raw event Kind, I would be able to detect rename events and even know the 'from' and 'to' paths without changing the existing I am looking for new files added to a directory and, in its current state, I cannot use |
In Jupyter we have a new service that allows to track files when they are renamed. It currently implements most of the logic, but I was wondering if this is something that watchfiles could support.
I know Notify doesn't support that feature, but maybe this could be a nice addition to watchfiles?
The text was updated successfully, but these errors were encountered: