-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: file watcher #2306
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
base: main
Are you sure you want to change the base?
feat: file watcher #2306
Conversation
35a858e
to
6281f12
Compare
… inotifywait Signed-off-by: Bruno Grbavac <[email protected]>
Signed-off-by: Bruno Grbavac <[email protected]>
Signed-off-by: Bruno Grbavac <[email protected]>
Signed-off-by: Bruno Grbavac <[email protected]>
…ith dns resolution Signed-off-by: Bruno Grbavac <[email protected]>
Signed-off-by: Bruno Grbavac <[email protected]>
6281f12
to
9257340
Compare
Signed-off-by: Bruno Grbavac <[email protected]>
…method Signed-off-by: MDzaja <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, run yarn docs && yarn nx build docs
.
class WatchHandle: | ||
"""Handle for a file watching session.""" | ||
|
||
def __init__(self, close_func: Callable[[], None]): | ||
"""Initialize a new WatchHandle. | ||
|
||
Args: | ||
close_func: Function to call to stop watching | ||
""" | ||
self._close_func = close_func | ||
|
||
async def close(self) -> None: | ||
"""Stop watching the directory.""" | ||
self._close_func() | ||
|
||
|
||
class SyncWatchHandle: | ||
"""Synchronous handle for a file watching session.""" | ||
|
||
def __init__(self, close_func: Callable[[], None]): | ||
"""Initialize a new SyncWatchHandle. | ||
|
||
Args: | ||
close_func: Function to call to stop watching | ||
""" | ||
self._close_func = close_func | ||
|
||
def close(self) -> None: | ||
"""Stop watching the directory.""" | ||
self._close_func() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d move these into _sync/_async file_watcher.py
, since they differ per module. I’d also rename the async version to AsyncWatchHandle
and the sync version to WatchHandle
(auto-generated from the async one) to stay consistent with the naming convention of other existing classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add this to docs:file-watcher
and docs:async-file-watcher
in package.json
so the documentation gets autogenerated under the File Watcher
page.
File Watching Support to Daytona SDKs
Description
Adds real-time file watching capabilities to both TypeScript and Python SDKs via WebSocket connections.
Features
Key Changes
FileSystem
class withwatchFiles()
methodwatch_files()
method with async context managerfsnotify