{ "info": { "author": "Chris Billington", "author_email": "chrisjbillington@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "inotify\\_simple 1.1\n===================\n\n``inotify_simple`` is a simple Python wrapper around\n`inotify `__. No\nfancy bells and whistles, just a literal wrapper with ctypes. Only 122\nlines of code!\n\n``inotify_init()`` is wrapped as a class that does little more than hold\nthe resulting inotify file descriptor. A ``read()`` method is provided\nwhich reads available data from the file descriptor and returns events\nas ``namedtuple`` objects after unpacking them with the ``struct``\nmodule. ``inotify_add_watch()`` and ``inotify_rm_watch()`` are wrapped\nwith no changes at all, taking and returning watch descriptor integers\nthat calling code is expected to keep track of itself, just as one would\nuse inotify from C. Works with Python 2.7 or Python >= 3.2.\n\n`View on PyPI `__ \\| `Fork\nme on github `__ \\|\n`Read the docs `__\n\nInstallation\n------------\n\nto install ``inotify_simple``, run:\n\n::\n\n $ pip3 install inotify_simple\n\nor to install from source:\n\n::\n\n $ python3 setup.py install\n\nNote: If on Python < 3.4, you'll need the backported `enum34\nmodule `__.\n\n``inotify_simple`` is a small amount of code and unlikely to change much\nin the future until inotify itself or Python changes, so you can also\njust copy and paste it into your project to avoid the extra dependency\nwith pretty low risk.\n\nIntroduction\n------------\n\nThere are many inotify python wrappers out there. `I found them all\nunsatisfactory `__. Most are far too high-level\nfor my tastes, and the supposed convenience they provide actually limits\none from using inotify in ways other than those the author imagined.\nOthers are C extensions, requiring compilation for different platforms\nand Python versions, rather than a pure python module using ctypes. This\none is pretty low-level and really just does what inotify itself does\nand nothing more. So hopefully if I've written it right, it will remain\nfunctional well into the future with no changes, recompilation or\nattention on my part.\n\nExample usage\n-------------\n\n.. code:: python\n\n import os\n from inotify_simple import INotify, flags\n\n os.mkdir('/tmp/inotify_test')\n\n inotify = INotify()\n watch_flags = flags.CREATE | flags.DELETE | flags.MODIFY | flags.DELETE_SELF\n wd = inotify.add_watch('/tmp/inotify_test', watch_flags)\n\n # Now create, delete and modify some files in the directory being monitored:\n os.chdir('/tmp/inotify_test')\n # CREATE event for a directory:\n os.system('mkdir foo')\n # CREATE event for a file:\n os.system('echo hello > test.txt')\n # MODIFY event for the file:\n os.system('echo world >> test.txt')\n # DELETE event for the file\n os.system('rm test.txt')\n # DELETE event for the directory\n os.system('rmdir foo')\n os.chdir('/tmp')\n # DELETE_SELF on the original directory. # Also generates an IGNORED event\n # indicating the watch was removed.\n os.system('rmdir inotify_test')\n\n # And see the corresponding events:\n for event in inotify.read():\n print(event)\n for flag in flags.from_mask(event.mask):\n print(' ' + str(flag))\n\nThis outputs the following:\n\n::\n\n Event(wd=1, mask=1073742080, cookie=0, name=u'foo')\n flags.CREATE\n flags.ISDIR\n Event(wd=1, mask=256, cookie=0, name=u'test.txt')\n flags.CREATE\n Event(wd=1, mask=2, cookie=0, name=u'test.txt')\n flags.MODIFY\n Event(wd=1, mask=512, cookie=0, name=u'test.txt')\n flags.DELETE\n Event(wd=1, mask=1073742336, cookie=0, name=u'foo')\n flags.DELETE\n flags.ISDIR\n Event(wd=1, mask=1024, cookie=0, name=u'')\n flags.DELETE_SELF\n Event(wd=1, mask=32768, cookie=0, name=u'')\n flags.IGNORED\n\nNote that the flags, since they are defined with an ``enum.IntEnum``,\nprint as what they are called rather than their integer values. However\nthey are still just integers and so can be bitwise-ANDed and ORed etc\nwith masks etc. The ``flags.from_mask()`` method bitwise-ANDs a mask\nwith all possible flags and returns a list of matches. This is for\nconvenience and useful for debugging which events are coming through,\nbut performance critical code should generally bitwise-AND masks with\nflags of interest itself so as to not do unnecessary checks.\n\n`See here `__ for more.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/chrisjbillington/inotify_simple", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "inotify_simple", "package_url": "https://pypi.org/project/inotify_simple/", "platform": "", "project_url": "https://pypi.org/project/inotify_simple/", "project_urls": { "Homepage": "https://github.com/chrisjbillington/inotify_simple" }, "release_url": "https://pypi.org/project/inotify_simple/1.1.8/", "requires_dist": null, "requires_python": "", "summary": "A simple wrapper around inotify. No fancy bells and whistles, just a literal wrapper with ctypes. Only 127 lines of code!", "version": "1.1.8" }, "last_serial": 4107097, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "33aaab8f39687e9414a875d9e6ac2ba8", "sha256": "e197d4f27ae9052f170c8fb14b296c3a37607cf464bd03342c9e082322daa3d7" }, "downloads": -1, "filename": "inotify_simple-1.0.0.tar.gz", "has_sig": false, "md5_digest": "33aaab8f39687e9414a875d9e6ac2ba8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4831, "upload_time": "2016-01-11T11:57:15", "url": "https://files.pythonhosted.org/packages/71/34/0d4c92570cb0e83bbc6cc3a3bfdd6afd5b1d9374af18f6af52df5d632a37/inotify_simple-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "5758a109d3c288bfdd0967666f5daa0f", "sha256": "61ac77157c96940133332d576a3b0952376f0f0fe49952b801600629d6b5464d" }, "downloads": -1, "filename": "inotify_simple-1.0.1.tar.gz", "has_sig": false, "md5_digest": "5758a109d3c288bfdd0967666f5daa0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5284, "upload_time": "2016-01-11T13:10:28", "url": "https://files.pythonhosted.org/packages/89/7c/a99c53ed2a8c5551a38280697985360fe41895f27f986e2931870753797e/inotify_simple-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "31d5340d8444d0b5d7dc382807a7a0a1", "sha256": "152e168555550a7d93fa921595c440ddb1fc395394c17e78f8e89ad0faf07f38" }, "downloads": -1, "filename": "inotify_simple-1.0.2.tar.gz", "has_sig": false, "md5_digest": "31d5340d8444d0b5d7dc382807a7a0a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5329, "upload_time": "2016-01-11T13:14:47", "url": "https://files.pythonhosted.org/packages/96/46/961c442a84927e0987d10ac13715b42f4c0e4adee4e8a371f3886cabcee7/inotify_simple-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "59440795aa84623c74f47e863d41646e", "sha256": "2cbb1626f29a145593fa5bd9ba835039cc09e80c4c5f80dd43f34eb04ab965a3" }, "downloads": -1, "filename": "inotify_simple-1.0.3.tar.gz", "has_sig": false, "md5_digest": "59440795aa84623c74f47e863d41646e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6051, "upload_time": "2016-01-11T13:25:49", "url": "https://files.pythonhosted.org/packages/f3/5b/4f1ee0c608883081b0b53470d25ee689901999e0caa6b1ac38bd6b6d279f/inotify_simple-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "c0d2dbf007551bf3a3e081b869f1b7e0", "sha256": "1328c4b512e0abd5e836383297f927686c34658ca7747f7b636c1eebbae129d0" }, "downloads": -1, "filename": "inotify_simple-1.0.4.tar.gz", "has_sig": false, "md5_digest": "c0d2dbf007551bf3a3e081b869f1b7e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6233, "upload_time": "2016-08-12T01:28:21", "url": "https://files.pythonhosted.org/packages/b4/1b/dadbc238a3c4637cd57dbce2437ca1ad444127a489f38e2f619d3356785d/inotify_simple-1.0.4.tar.gz" } ], "1.1.0": [], "1.1.1": [ { "comment_text": "", "digests": { "md5": "c0138d5c6f87e72bbda8d2a6d1ef7357", "sha256": "f2448559a2a47284538531c0189096291a40c97ae4c1d5caab34ac3534d46f23" }, "downloads": -1, "filename": "inotify_simple-1.1.1.tar.gz", "has_sig": false, "md5_digest": "c0138d5c6f87e72bbda8d2a6d1ef7357", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6765, "upload_time": "2017-03-05T06:17:51", "url": "https://files.pythonhosted.org/packages/f4/2b/19e2723595f1187fd876f7d7f52e2ccd84143efdd74bf514b29866d836ac/inotify_simple-1.1.1.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "964195bb3dbdcae5b033b743041489f7", "sha256": "7d8b2fb07f24066e34fee10684ecdcf87f9094e033003d10d10074cfd8ff5edf" }, "downloads": -1, "filename": "inotify_simple-1.1.4.tar.gz", "has_sig": false, "md5_digest": "964195bb3dbdcae5b033b743041489f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6779, "upload_time": "2017-11-20T19:14:57", "url": "https://files.pythonhosted.org/packages/af/18/1f98b25ddbc3db033ef8dfe18caad8c47d326cf3edd3dab98f56e0a84fb8/inotify_simple-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "65be0e01c5b111cd83e822ca2e1ee7f8", "sha256": "c7d3e9eb18415fc29c8b3a33a09e9748d594602a48f6e0c0b75047d51eca72c5" }, "downloads": -1, "filename": "inotify_simple-1.1.5.tar.gz", "has_sig": false, "md5_digest": "65be0e01c5b111cd83e822ca2e1ee7f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7229, "upload_time": "2017-11-20T19:25:52", "url": "https://files.pythonhosted.org/packages/e0/f0/3e2b617212661d07ad3d0030cb925d792ab7d0bd80ebaefb4028e0c00aba/inotify_simple-1.1.5.tar.gz" } ], "1.1.6": [ { "comment_text": "", "digests": { "md5": "6f03462031d29d2b82f4da57ce3dd042", "sha256": "00b37656d5570a778a8adbc20e1f4f8890ece46591184a9fd560bfe31fb41285" }, "downloads": -1, "filename": "inotify_simple-1.1.6.tar.gz", "has_sig": false, "md5_digest": "6f03462031d29d2b82f4da57ce3dd042", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7257, "upload_time": "2017-11-20T19:36:33", "url": "https://files.pythonhosted.org/packages/9f/5c/276c45a02c02a731fc93e60efab248c3122e708c1752c2f94e4669ff9668/inotify_simple-1.1.6.tar.gz" } ], "1.1.7": [ { "comment_text": "", "digests": { "md5": "076f74257b9e0d8ffa4f5f31f737ddd2", "sha256": "98edd756c5d876ef2296649209b17a474dfcd75fe611ae33e9e47a46d0dd71cb" }, "downloads": -1, "filename": "inotify_simple-1.1.7.tar.gz", "has_sig": false, "md5_digest": "076f74257b9e0d8ffa4f5f31f737ddd2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7274, "upload_time": "2017-11-24T22:10:03", "url": "https://files.pythonhosted.org/packages/3b/72/163c1d2eaf7d7c825f4442d0c8c6469fd77bcbb951dacd09526b54ad8931/inotify_simple-1.1.7.tar.gz" } ], "1.1.8": [ { "comment_text": "", "digests": { "md5": "4ef94f1d0bbe23af5e62c0dc08608ca3", "sha256": "fc2c10dd73278a1027d0663f2db51240af5946390f363a154361406ebdddd8dd" }, "downloads": -1, "filename": "inotify_simple-1.1.8.tar.gz", "has_sig": false, "md5_digest": "4ef94f1d0bbe23af5e62c0dc08608ca3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7323, "upload_time": "2018-07-27T02:36:17", "url": "https://files.pythonhosted.org/packages/55/80/4bbd33f6d6b305c509a90b37c1cf7255000344f513b36827ec2c17af5ad5/inotify_simple-1.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ef94f1d0bbe23af5e62c0dc08608ca3", "sha256": "fc2c10dd73278a1027d0663f2db51240af5946390f363a154361406ebdddd8dd" }, "downloads": -1, "filename": "inotify_simple-1.1.8.tar.gz", "has_sig": false, "md5_digest": "4ef94f1d0bbe23af5e62c0dc08608ca3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7323, "upload_time": "2018-07-27T02:36:17", "url": "https://files.pythonhosted.org/packages/55/80/4bbd33f6d6b305c509a90b37c1cf7255000344f513b36827ec2c17af5ad5/inotify_simple-1.1.8.tar.gz" } ] }