Cement watchdog extension module.

Note This extension has an external dependency on watchdog. Cement explicitly does not include external dependencies for optional extensions.

  • In Cement >=3.0.8 you must include cement[watchdog] in your applications dependencies.
  • In Cement <3.0.8 you must include watchdog in your applications dependencies.
class cement.ext.ext_watchdog.WatchdogEventHandler(app, *args, **kw)[source]

Bases: watchdog.events.FileSystemEventHandler

Default event handler used by Cement, that logs all events to the application’s debug log. Additional *args and **kwargs are passed to the parent class.

Parameters:app – The application object

Catch-all event handler.

Parameters:event (FileSystemEvent) – The event object representing the file system event.
class cement.ext.ext_watchdog.WatchdogManager(app, *args, **kw)[source]

Bases: cement.core.meta.MetaMixin

The manager class that is attached to the application object via App.extend().


with MyApp() as app:
add(path, event_handler=None, recursive=True)[source]

Add a directory path and event handler to the observer.


path (str) – A directory path to monitor (str)

Keyword Arguments:
  • event_handler (class) – An event handler class used to handle events for path (class)
  • recursive (bool) – Whether to monitor the path recursively

True if the path is added, False otherwise.

Return type:


join(*args, **kw)[source]

Join the observer with the parent process. All *args and **kwargs are passed down to the backend observer.

start(*args, **kw)[source]

Start the observer. All *args and **kwargs are passed down to the backend observer.

stop(*args, **kw)[source]

Stop the observer. All *args and **kwargs are passed down to the backend observer.