{ "info": { "author": "Oliver Berger", "author_email": "diefans@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: AsyncIO", "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", "Programming Language :: Python :: 3 :: Only" ], "description": "inotipy is a high-level Python wrapper for the Linux\n[`inotify(7)`](http://man7.org/linux/man-pages/man7/inotify.7.html) API,\nthat is designed to work with\n[`asyncio`](https://docs.python.org/3/library/asyncio.html) event loops\nin Python 3.5 or later. This lets you efficiently monitor one or more\nfiles or directories for interesting happenings, without having to\ncontinually poll the filesystem. But note, however, that if events are\ncoming too thick and fast, the kernel is liable to start dropping\nthem, which will be reported to you by events with the `IN.Q_OVERFLOW`\nbit set.\n\n\nBasic Usage\n===========\n\nLet us say there is a directory, initially empty, called \u201ctest\u201d.\nThe following script monitors that for changes:\n\n import sys\n import asyncio\n import inotipy\n\n loop = asyncio.get_event_loop()\n\n paths_to_watch = [\"test\"] # edit as necessary\n\n async def mainline() :\n watcher = inotipy.Watcher.create()\n for path in paths_to_watch :\n watcher.watch(path, inotipy.IN.ALL_EVENTS)\n #end for\n while True :\n event = await watcher.get()\n sys.stdout.write(\"Got event: %s\\n\" % repr(event))\n #end while\n #end mainline\n\n loop.run_until_complete(mainline())\n\nSuppose we start the script, and then in another terminal session\nperform the following series of command-line actions:\n\n $ echo hi >test/f1\n $ mv test/f1 test/f2\n $ cat test/f2\n $ rm test/f2\n $ rmdir test\n\nthen we should see the script report an event stream something like\nthis:\n\n Got event: Event(1, [], 0, 'f1')\n Got event: Event(1, [], 0, 'f1')\n Got event: Event(1, [], 0, 'f1')\n Got event: Event(1, [], 0, 'f1')\n Got event: Event(1, [], 217185, 'f1')\n Got event: Event(1, [], 217185, 'f2')\n Got event: Event(1, [], 0, 'f2')\n Got event: Event(1, [], 0, 'f2')\n Got event: Event(1, [], 0, 'f2')\n Got event: Event(1, [], 0, 'f2')\n Got event: Event(1, [], 0, '')\n Got event: Event(1, [], 0, '')\n\nThat should give you the basic flavour. For more elaborate examples,\nsee my `inotipy_examples` repo\n([GitLab](https://gitlab.com/ldo/inotipy_examples),\n[GitHub](https://github.com/ldo/inotipy_examples)).\n\nThere is more functionality available: see the `inotify(7)` man page\nfor more details, and of course the documentation in `inotify.py`\nitself.\n\nLawrence D'Oliveiro \n2018 March 11\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/diefans/inotipy", "keywords": "inotify asyncio", "license": "GNU Lesser General Public License v2.1", "maintainer": "", "maintainer_email": "", "name": "inotipy", "package_url": "https://pypi.org/project/inotipy/", "platform": "", "project_url": "https://pypi.org/project/inotipy/", "project_urls": { "Homepage": "https://github.com/diefans/inotipy" }, "release_url": "https://pypi.org/project/inotipy/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "inotify for asyncio", "version": "0.1.1" }, "last_serial": 4345574, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "ab2f12d0b605df298eaa2af700d97075", "sha256": "825a26cd669047f49f56ce708bbe3b04b662710bce54cdf29a76f3a0ad40c988" }, "downloads": -1, "filename": "inotipy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ab2f12d0b605df298eaa2af700d97075", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15970, "upload_time": "2018-10-05T19:32:25", "url": "https://files.pythonhosted.org/packages/f8/0d/c5ab325342bcc9fccf65a4619ded6c15db44b2292cada703afe7e9ccaa28/inotipy-0.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ab2f12d0b605df298eaa2af700d97075", "sha256": "825a26cd669047f49f56ce708bbe3b04b662710bce54cdf29a76f3a0ad40c988" }, "downloads": -1, "filename": "inotipy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ab2f12d0b605df298eaa2af700d97075", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15970, "upload_time": "2018-10-05T19:32:25", "url": "https://files.pythonhosted.org/packages/f8/0d/c5ab325342bcc9fccf65a4619ded6c15db44b2292cada703afe7e9ccaa28/inotipy-0.1.1-py3-none-any.whl" } ] }