= Changes introduced with Pyinotify 0.9.0 = * It is possible to stop Notifier instance from its associated event loop's callback function, see [http://git.dbzteam.org/pyinotify/commit/?id=a3fbdda201166260886f2644f4fe725e5a832fd5 this commit]. * It is safe now to call add_watch() multiple times on the same path without any risk of modifying existing watches, see [http://git.dbzteam.org/pyinotify/commit/?id=f7510650b8e9950247d14841967eb64d0b2d0294 this commit]. * Similar events can be coalesced together, see [http://git.dbzteam.org/pyinotify/commit/?id=134f1628ed438995b0367c76ea749d9d11067eb6 this commit]. = Changes introduced with Pyinotify 0.8.9 = * The syntax of exclusion filter files has changed see the [http://git.dbzteam.org/pyinotify/commit/?id=7bbd6dab1c317314161567a6088076282100f736 related commit] and the new syntax [http://github.com/seb-m/pyinotify/tree/master/python2/examples/exclude.lst exclude.lst]. This new way of parsing external patterns is safer. * Pyinotify is not licensed anymore under GPL2+, its new license is now the [http://www.opensource.org/licenses/mit-license.php MIT License]. * This is the first release to support Python 3. = Changes introduced with Pyinotify 0.8.7 = A new function was added in order to provide a minimal compatibility mode with Pyinotify 0.7.1. Call this function from your code only if it was developed for the old versions of Pyinotify (<= 0.7.1) (although you should strongly consider upgrading your code, read [http://github.com/seb-m/pyinotify/blob/master/NEWS_old this link] for more details on what has changed). The compatibility mode is set to `False` by default therefore you have to make an explicit call to activate it (note that once this mode is activated at runtime, it is not possible to disable it). {{{ #!python import pyinotify # [... old code ...] if __name__ == '__main__': pyinotify.compatibily_mode() # Turns on compatibility mode # [... old code ...] }}} = Changes introduced with Pyinotify 0.8.0 = === Structural modifications === * pyinotify.py is now a standalone file. * The namespace is reduced to `pyinotify`. Thus, you access everything from `pyinotify`, For instance accessing `max_user_instances` attribute : {{{ >>> import pyinotify >>> pyinotify.max_user_watches >>> pyinotify.max_user_watches.value 524288 >>> pyinotify.max_user_watches.value = 42 >>> pyinotify.max_user_watches.value 42 }}} * Likewise, events names are directly accessible at pyinotify's scope eg: `pyinotify.IN_MODIFY`. * Event instances provide a new attribute: `an_event.pathname`. Example: === Chaining several processing functions together === * !ProcessEvent instances can be chained, see [http://github.com/seb-m/pyinotify/tree/master/python2/examples/chain.py chain.py]. === Debugging and statistics === * Use the [http://docs.python.org/library/logging.html logging module] through `pyinotify.log` attribute to manage errors and debugging informations. Every 'print' statements have been removed. * There is a tiny functionality available to display statistics see new option `-s` (from command line) and this example [http://github.com/seb-m/pyinotify/tree/master/python2/examples/stats.py stats.py], which has given this output: [[Image(stats.jpg)]] === New method Notifier.loop() === * Notifier now provides a loop() method (the former pattern `while True: ...` is now useless), see [http://github.com/seb-m/pyinotify/tree/master/python2/examples/loop.py loop.py]. === Policy for reading events === * select.Poll timeout's value is set to None when called from Notifier and !ThreadedNotifier. * Notifier's constructor accepts read_freq, threshold and timeout as parameters, for specifying at which frequency and when to read new events. read_freq sets the minimal period of time between two read of events (0s by default), sleeping during the rest of time. threshold is the minimal size (0 byte by default) of accumulated events needed before accepting to read the queue (must be used in combination with read_freq, read the docstrings for more details). timeout is the parameter given to select.poll. {{{ #!python # examples: n = Notifier(wm, read_freq=0, threshold=0, timeout=None) # values by default read events asap n = Notifier(wm, read_freq=5) # read events every 5s n = Notifier(wm, read_freq=5, threshold=512) # read events every 5s if size to read is >= 512 bytes }}} === Functionality for helping watch transient files === * Supports simplified watch of transient files (for instance for watching pid files /var/run/myapp.pid), see [http://github.com/seb-m/pyinotify/tree/master/python2/examples/transient_file.py transient_file.py], [http://github.com/seb-m/pyinotify/tree/master/python2/examples/transient_file.sh transient_file.sh]. === Daemonize pyinotify === * Ability to detach and daemonize Notifier instances, see [http://github.com/seb-m/pyinotify/tree/master/python2/examples/daemon.py daemon.py] {{{ #!python notifier.loop(daemonize=True) # By default writes its pid to /var/run/.pid }}} === Exclude files from being watched === * !WatchManager and .add_watch support an exclusion path filter: a boolean function can optionally be called each time a new path is about to be watched, if this predicate returns True this path is excluded (i.e. not watched). * See how it works through this example [http://github.com/seb-m/pyinotify/tree/master/python2/examples/exclude.lst exclude.lst] and [http://github.com/seb-m/pyinotify/tree/master/python2/examples/exclude.py exclude.py]. === Various improvements === * There is a way to delegate initialization to my_init(*kargs) when !ProcessEvent's subclass is instantiated. Override this method in your subclass for achieving custom initialization. Moreover, you must instantiate your class with keyworded arguments, see the following example [http://github.com/seb-m/pyinotify/tree/master/python2/examples/chain.py chain.py]. {{{ #!python class Log(ProcessEvent): def my_init(self, pathname): self._fileobj = file(pathname, 'w') [...] notifier = Notifier(wm, Empty(TrackMofications(Log(pathname=f)), msg='outer')) }}} * Accepts a New option `-e` list,of,events,separated,with,commas. It works like this: python pyinotify.py -e IN_CREATE,IN_DELETE