@@ -6,10 +6,14 @@ Watchdog
6
6
7
7
Python API and shell utilities to monitor file system events.
8
8
9
- Works on Python 2.7 and 3.4+. If you want to use an old version of Python, you should stick with watchdog < 0.10.0.
9
+ Works on 3.5+.
10
+
11
+ If you want to use Python 2.6, you should stick with watchdog < 0.10.0.
12
+ If you want to use Python 2.7 or 3.4, you should stick with watchdog < 1.0.0.
10
13
11
14
Example API Usage
12
15
-----------------
16
+
13
17
A simple program that uses watchdog to monitor directories specified
14
18
as command-line arguments and logs events generated:
15
19
@@ -40,6 +44,7 @@ as command-line arguments and logs events generated:
40
44
41
45
Shell Utilities
42
46
---------------
47
+
43
48
Watchdog comes with an *optional * utility script called ``watchmedo ``.
44
49
Please type ``watchmedo --help `` at the shell prompt to
45
50
know more about this tool.
@@ -76,6 +81,7 @@ Please see the help information for these commands by typing:
76
81
77
82
About ``watchmedo `` Tricks
78
83
~~~~~~~~~~~~~~~~~~~~~~~~~~
84
+
79
85
``watchmedo `` can read ``tricks.yaml `` files and execute tricks within them in
80
86
response to file system events. Tricks are actually event handlers that
81
87
subclass ``watchdog.tricks.Trick `` and are written by plugin authors. Trick
@@ -112,20 +118,16 @@ The directory containing the ``tricks.yaml`` file will be monitored. Each trick
112
118
class is initialized with its corresponding keys in the ``tricks.yaml `` file as
113
119
arguments and events are fed to an instance of this class as they arrive.
114
120
115
- Tricks will be included in the 0.5.0 release. I need community input about them.
116
- Please file enhancement requests at the `issue tracker `_.
117
-
118
-
119
121
Installation
120
122
------------
121
123
Install from PyPI using ``pip ``:
122
124
123
125
.. code-block :: bash
124
126
125
- $ python -m pip install watchdog
127
+ $ python -m pip install -U watchdog
126
128
127
129
# or to install the watchmedo utility:
128
- $ python -m pip install watchdog[watchmedo]
130
+ $ python -m pip install -U watchdog[watchmedo]
129
131
130
132
Install from source:
131
133
@@ -139,6 +141,7 @@ Install from source:
139
141
140
142
Installation Caveats
141
143
~~~~~~~~~~~~~~~~~~~~
144
+
142
145
The ``watchmedo `` script depends on PyYAML _ which links with LibYAML _,
143
146
which brings a performance boost to the PyYAML parser. However, installing
144
147
LibYAML _ is optional but recommended. On Mac OS X, you can use homebrew _
@@ -153,31 +156,34 @@ do it on Ubuntu:
153
156
154
157
.. code-block :: bash
155
158
156
- $ sudo aptitude install libyaml-dev
159
+ $ sudo apt install libyaml-dev
157
160
158
161
On Windows, please install PyYAML _ using the binaries they provide.
159
162
160
163
Documentation
161
164
-------------
165
+
162
166
You can browse the latest release documentation _ online.
163
167
164
168
Contribute
165
169
----------
170
+
166
171
Fork the `repository `_ on GitHub and send a pull request, or file an issue
167
172
ticket at the `issue tracker `_. For general help and questions use the official
168
173
`mailing list `_ or ask on `stackoverflow `_ with tag `python-watchdog `.
169
174
170
175
Create and activate your virtual environment, then::
171
176
172
177
python -m pip install pytest pytest-cov
173
- python -m pip install -e .[watchmedo]
178
+ python -m pip install -e " .[watchmedo]"
174
179
python -m pytest tests
175
180
176
181
If you are making a substantial change, add an entry to the "Unreleased" section
177
182
of the `changelog `_.
178
183
179
184
Supported Platforms
180
185
-------------------
186
+
181
187
* Linux 2.6 (inotify)
182
188
* Mac OS X (FSEvents, kqueue)
183
189
* FreeBSD/BSD (kqueue)
@@ -206,6 +212,7 @@ files.
206
212
207
213
About using watchdog with editors like Vim
208
214
------------------------------------------
215
+
209
216
Vim does not modify files unless directed to do so.
210
217
It creates backup files and then swaps them in to replace
211
218
the files you are editing on the disk. This means that
@@ -217,6 +224,7 @@ this feature.
217
224
218
225
About using watchdog with CIFS
219
226
------------------------------
227
+
220
228
When you want to watch changes in CIFS, you need to explicitly tell watchdog to
221
229
use ``PollingObserver ``, that is, instead of letting watchdog decide an
222
230
appropriate observer like in the example above, do::
@@ -226,25 +234,28 @@ appropriate observer like in the example above, do::
226
234
227
235
Dependencies
228
236
------------
229
- 1. Python 3.4 or above.
237
+
238
+ 1. Python 3.5 or above.
230
239
3. XCode _ (only on Mac OS X)
231
240
4. PyYAML _ (only for ``watchmedo `` script)
232
241
5. argh _ (only for ``watchmedo `` script)
233
242
234
243
235
244
Licensing
236
245
---------
246
+
237
247
Watchdog is licensed under the terms of the `Apache License, version 2.0 `_.
238
248
239
249
Copyright 2011 `Yesudeep Mangalapilly `_.
240
250
241
- Copyright 2012 Google, Inc.
251
+ Copyright 2012 Google, Inc & contributors .
242
252
243
253
Project `source code `_ is available at Github. Please report bugs and file
244
254
enhancement requests at the `issue tracker `_.
245
255
246
256
Why Watchdog?
247
257
-------------
258
+
248
259
Too many people tried to do the same thing and none did what I needed Python
249
260
to do:
250
261
0 commit comments