Skip to content
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

refactor: Disuse watchdog in favor of watchfiles. #1136

Merged
merged 4 commits into from May 6, 2023

Conversation

dairiki
Copy link
Contributor

@dairiki dairiki commented Apr 22, 2023

Watchfiles has a much cleaner API.
It has a (Rust-based) extension module, but wheels are distributed for a wide variety of targets.

Also, it's a flail, but I hope it might help with the hanging CI tests (see #1132) on macOS (which seem to be related to watchdog.)

Issue(s) Resolved

It simplifies our code quite a bit.

It might fix the CI test hangage on macOS.

Fixes #550
Fixes #1116

Related Issues / Links

#1132
#861

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)

@nixjdm
Copy link
Member

nixjdm commented Apr 22, 2023

Might this enable closing out #550 easily?

@dairiki
Copy link
Contributor Author

dairiki commented Apr 22, 2023

Might this enable closing out #550 easily?

Yes. Actually, I think it (inadvertently) fixes that already.

I chose to have our WatchFilter inherit from watchfiles' DefaultFilter. DefaultFilter is already set up to ignore things like .git, node_modules.

@dairiki dairiki marked this pull request as draft April 22, 2023 17:27
@dairiki dairiki force-pushed the refactor.watchfiles branch 6 times, most recently from 44687b8 to d13a850 Compare April 23, 2023 22:12
@dairiki dairiki marked this pull request as ready for review April 23, 2023 22:33
@dairiki dairiki added this to the 3.4 milestone Apr 24, 2023
Watchfiles has a much cleaner API.

Also, it's a flail, but I hope it might help with the hanging CI tests
on macOS (which seem to be related to watchdog.)
On macOS, watchfiles.watch sometimes seems to return events for
filesystem changes that happened slightly before the watcher was
started.  To keep that from screwing up the tests, wait a bit
before starting each test.
The project file does not necessarily have to be the project source tree.
@dairiki dairiki merged commit db204f6 into lektor:master May 6, 2023
15 checks passed
@dairiki dairiki deleted the refactor.watchfiles branch May 6, 2023 00:34
dairiki added a commit to dairiki/lektor that referenced this pull request Sep 11, 2023
* refactor: use watchfiles instead of watchdog

Watchfiles has a much cleaner API.

Also, it's a flail, but I hope it might help with the hanging CI tests
on macOS (which seem to be related to watchdog.)

* fix(test): (macOS) wait a bit for pending watch event to settle

* refactor: code cleanup

* fix: watch the project file for changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants