{ "info": { "author": "Samuel Colvin", "author_email": "s@muelcolvin.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Environment :: MacOS X", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "watchgod\n========\n\n|BuildStatus| |Coverage| |pypi|\n\nSimple, modern file watching and code reload in python.\n\nUsage\n-----\n\nTo watch for changes in a directory:\n\n.. code:: python\n\n from watchgod import watch\n\n for changes in watch('./path/to/dir'):\n print(changes)\n\n\nTo run a function and restart it when code changes:\n\n.. code:: python\n\n from watchgod import run_process\n\n def foobar(a, b, c):\n ...\n\n run_process('./path/to/dir', foobar, args=(1, 2, 3))\n\n``run_process`` uses ``PythonWatcher`` so only changes to python files will prompt a\nreload, see *custom watchers* below.\n\nIf you need notifications about change events as well as to restart a process you can\nuse the ``callback`` argument to pass a function will will be called on every file change\nwith one argument: the set of file changes.\n\nAsynchronous Methods\n....................\n\n*watchgod* comes with an asynchronous equivalents of ``watch``: ``awatch`` which uses\na ``ThreadPoolExecutor`` to iterate over files.\n\n.. code:: python\n\n import asyncio\n from watchgod import awatch\n\n async def main():\n async for changes in awatch('/path/to/dir'):\n print(changes)\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\n\n\nThere's also an asynchronous equivalents of ``run_process``: ``arun_process`` which in turn\nuses ``awatch``:\n\n.. code:: python\n\n import asyncio\n from watchgod import arun_process\n\n def foobar(a, b, c):\n ...\n\n async def main():\n await arun_process('./path/to/dir', foobar, args=(1, 2, 3))\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\n\n``arun_process`` uses ``PythonWatcher`` so only changes to python files will prompt a\nreload, see *custom watchers* below.\n\nThe signature of ``arun_process`` is almost identical to ``run_process`` except that\nthe ``callback`` argument if provide must be a coroutine, not a function.\n\nCustom Watchers\n...............\n\n*watchgod* comes with the following watcher classes which can be used via the ``watcher_cls``\nkeyword argument to any of the methods above.\n\nFor more details, checkout\n`watcher.py `_,\nit's pretty simple.\n\n**AllWatcher**\n The base watcher, all files are checked for changes.\n\n**DefaultWatcher**\n The watcher used by default by ``watch`` and ``awatch``, commonly ignored files\n like ``*.swp``, ``*.pyc`` and ``*~`` are ignored along with directories like\n ``.git``.\n\n**PythonWatcher**\n Specific to python files, only ``*.py``, ``*.pyx`` and ``*.pyd`` files are watched.\n\n**DefaultDirWatcher**\n Is the base for ``DefaultWatcher`` and ``DefaultDirWatcher`` and takes care of ignoring\n some regular directories.\n\n\nIf these classes aren't sufficient you can define your own watcher, in particular\nyou will want to override ``should_watch_dir`` and ``should_watch_file``. Unless you're\ndoing something very odd you'll want to inherit from ``DefaultDirWatcher``.\n\nCLI\n...\n\n*wathgod* also comes with a CLI for running and reloading python code.\n\nLets say you have ``foobar.py``:\n\n.. code:: python\n\n from aiohttp import web\n\n async def handle(request):\n return web.Response(text='testing')\n\n app = web.Application()\n app.router.add_get('/', handle)\n\n def main():\n web.run_app(app, port=8000)\n\nYou could run this and reload it when any file in the current directory changes with::\n\n watchgod foobar.main\n\nRun ``watchgod --help`` for more options. *watchgod* is also available as a python executable module\nvia ``python -m watchgod ...``.\n\nWhy no inotify / kqueue / fsevent / winapi support\n--------------------------------------------------\n\n*watchgod* (for now) uses file polling rather than the OS's built in file change notifications.\n\nThis is not an oversight, it's a decision with the following rationale:\n\n1. Polling is \"fast enough\", particularly since PEP 471 introduced fast ``scandir``.\n\n With a reasonably large project like the TutorCruncher code base with 850 files and 300k lines\n of code *watchgod* can scan the entire tree in ~24ms. With a scan interval of 400ms that's roughly\n 5% of one CPU - perfectly acceptable load during development.\n\n2. The clue is in the title, there are at least 4 different file notification systems to integrate\n with, most of them not trivial. And that's before we get to changes between different OS versions.\n\n3. Polling works well when you want to group or \"debounce\" changes.\n\n Let's say you're running a dev server and you change branch in git, 100 files change.\n Do you want to reload the dev server 100 times or once? Right.\n\n Polling periodically will likely group these changes into one event. If you're receiving a\n stream of events you need to delay execution of the reload when you receive the first event\n to see if it's part of a whole bunch of file changes, this is not completely trivial.\n\n\nAll that said, I might still implement ``inotify`` support. I don't use anything other\nthan Linux so I definitely won't be working on dedicated support for any other OS.\n\n\n.. |BuildStatus| image:: https://travis-ci.org/samuelcolvin/watchgod.svg?branch=master\n :target: https://travis-ci.org/samuelcolvin/watchgod\n.. |Coverage| image:: https://codecov.io/gh/samuelcolvin/watchgod/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/samuelcolvin/watchgod\n.. |pypi| image:: https://img.shields.io/pypi/v/watchgod.svg\n :target: https://pypi.python.org/pypi/watchgod\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/samuelcolvin/watchgod", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "watchgod", "package_url": "https://pypi.org/project/watchgod/", "platform": "", "project_url": "https://pypi.org/project/watchgod/", "project_urls": { "Homepage": "https://github.com/samuelcolvin/watchgod" }, "release_url": "https://pypi.org/project/watchgod/0.5/", "requires_dist": null, "requires_python": ">=3.5", "summary": "Simple, modern file watching and code reload in python.", "version": "0.5" }, "last_serial": 5751891, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e6b6f856e181d9cabb4ed66a2598e578", "sha256": "d1bed30f8a3564cc70a535e52fc3f66420dfb07433d3bc2572bd6ba8d709c7c0" }, "downloads": -1, "filename": "watchgod-0.0.1-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "e6b6f856e181d9cabb4ed66a2598e578", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 9435, "upload_time": "2017-10-17T17:44:55", "url": "https://files.pythonhosted.org/packages/42/a2/177d9b564f4df3ccfa764f1e2235af518e0b21f7f028f4346aea60bade50/watchgod-0.0.1-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "66dd288c649aa5c33ba44dc29195003b", "sha256": "a49d846c094a734fc1a4bca46172885ca0b5c1278c0d0f45c54e81ae749cb93d" }, "downloads": -1, "filename": "watchgod-0.0.1.tar.gz", "has_sig": false, "md5_digest": "66dd288c649aa5c33ba44dc29195003b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 6168, "upload_time": "2017-10-17T17:44:56", "url": "https://files.pythonhosted.org/packages/12/0d/69e08a213c0d096c74b57b419511b9e3443b6246caceadc05d8a78364360/watchgod-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "88b9e7d92ccf3eb99ed77e1feeb5d74e", "sha256": "d34e0ba0a7378dbd7f32862bbaeb89913c0413cec177ba3109f4e69e084d0368" }, "downloads": -1, "filename": "watchgod-0.0.2-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "88b9e7d92ccf3eb99ed77e1feeb5d74e", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 9474, "upload_time": "2017-10-18T11:47:31", "url": "https://files.pythonhosted.org/packages/5a/21/f0bf6b3265f7b075fa07da286557e62d335ee1bd49f0b6e29f470fe19535/watchgod-0.0.2-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "76c18ef4f32b29bb2f2b238cd11101c3", "sha256": "af26c1b08e4dc5cf7a8c01db07541ec082b6b8e6dea206037450d091a7417d21" }, "downloads": -1, "filename": "watchgod-0.0.2.tar.gz", "has_sig": false, "md5_digest": "76c18ef4f32b29bb2f2b238cd11101c3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 6200, "upload_time": "2017-10-18T11:47:32", "url": "https://files.pythonhosted.org/packages/59/6e/10ceb513b6cb5fcc442dab9e16018623d5bff0112414bfb69a8ba68dd6ee/watchgod-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "859962249acf21ac031ea3ba507effcd", "sha256": "d6936cd43a25c2c194091e5b64ef20697fc3344278f92845db1b6a2470cbb87f" }, "downloads": -1, "filename": "watchgod-0.0.3-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "859962249acf21ac031ea3ba507effcd", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 11885, "upload_time": "2017-10-19T11:14:46", "url": "https://files.pythonhosted.org/packages/6f/3b/503fe7f9129ccf9f60a7bc8eac8372d5b263ba913536018eae202f4ed357/watchgod-0.0.3-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e1efd1cc40ce4331df4c6dfdd029e1c", "sha256": "8fa55479f8ab13288f1e471f10903d254ffbe5a496fc31a4324fad02e7c781a9" }, "downloads": -1, "filename": "watchgod-0.0.3.tar.gz", "has_sig": false, "md5_digest": "8e1efd1cc40ce4331df4c6dfdd029e1c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 7703, "upload_time": "2017-10-19T11:14:48", "url": "https://files.pythonhosted.org/packages/22/9f/4b29d954426651492f9858273e33468e998da2ef0fe34dd2558355fc0e00/watchgod-0.0.3.tar.gz" } ], "0.1": [ { "comment_text": "", "digests": { "md5": "1d19cac0b535a931f55b380bba21edaa", "sha256": "0fae0e814558aca3b68964a364bdb5d2abcae3f2d62846aceea26a03bdaff698" }, "downloads": -1, "filename": "watchgod-0.1-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "1d19cac0b535a931f55b380bba21edaa", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 8644, "upload_time": "2018-04-06T18:58:23", "url": "https://files.pythonhosted.org/packages/4b/3f/9cebb3d5261e6670ddbae9a0e52216efb4be61c9c1c0d783af2749c7b2b4/watchgod-0.1-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "644cc906fd74f3184a7e58d43cc0a8b4", "sha256": "b118bea02b065696207262ca7e714ccd95b49f64f7cb7606c17567bd71071d2a" }, "downloads": -1, "filename": "watchgod-0.1.tar.gz", "has_sig": false, "md5_digest": "644cc906fd74f3184a7e58d43cc0a8b4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 7788, "upload_time": "2018-04-06T18:58:24", "url": "https://files.pythonhosted.org/packages/f1/31/7039e337d34b83c8ad9ebc2f571f438465db1abc8bb556434e4d8b855c1e/watchgod-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a4782e1e42e59425bec47acbc278dabb", "sha256": "77a96e5fb916d689b30b5036c9aafb20731dd4760bbe9528b449ad23a9505100" }, "downloads": -1, "filename": "watchgod-0.1.1-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "a4782e1e42e59425bec47acbc278dabb", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 8772, "upload_time": "2018-04-06T21:38:57", "url": "https://files.pythonhosted.org/packages/fb/8c/1607b6eee8714a8e442c6357b033fa8b562ba4d5532dcce14a49350b91fc/watchgod-0.1.1-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0acb1d0bf0c8eeb0b42c52b526ebccfa", "sha256": "a5a502c8c87c973534e74b2c5f0cd8ba15f061f4a4cd444c8add28fa29f83897" }, "downloads": -1, "filename": "watchgod-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0acb1d0bf0c8eeb0b42c52b526ebccfa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 7887, "upload_time": "2018-04-06T21:38:58", "url": "https://files.pythonhosted.org/packages/1b/2e/a7667627e57c012ab83da01288f6bc2f3182d545ffa25350a82eba50db84/watchgod-0.1.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "e49142fc9e1a291defa6237d621a4649", "sha256": "d4c9e47526328fa91635d01560c4914f87904b8b835584a57db1245289dd2d65" }, "downloads": -1, "filename": "watchgod-0.2-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "e49142fc9e1a291defa6237d621a4649", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 9018, "upload_time": "2018-05-11T16:15:59", "url": "https://files.pythonhosted.org/packages/48/3a/f74dfa513114f4455b7d02b3d1bd996b626280129f1c3cce98c19e60b73e/watchgod-0.2-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1056b7d8fc6b49027fae65e3db3be7a", "sha256": "b491f816fe9e69d8164cbe569596ccf855339ff773d46d7aad2b6ef44f778e46" }, "downloads": -1, "filename": "watchgod-0.2.tar.gz", "has_sig": false, "md5_digest": "a1056b7d8fc6b49027fae65e3db3be7a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 8108, "upload_time": "2018-05-11T16:16:00", "url": "https://files.pythonhosted.org/packages/bf/27/6257bc04776b8fb118420886e1af542d9d4ec1882382cd147cc835e45264/watchgod-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "312c629ff308619fedfac8dff07cbe5d", "sha256": "137bfbfaa24c686aff3f269f6a9b19262c667c673125df789fd58a331ea695e5" }, "downloads": -1, "filename": "watchgod-0.3-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "312c629ff308619fedfac8dff07cbe5d", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 9974, "upload_time": "2018-11-15T22:40:10", "url": "https://files.pythonhosted.org/packages/22/b5/26672d4f418454410653722a7e1d4c16133b94a0364f8e31548dafa56a9b/watchgod-0.3-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c28588b509f924b584afbebcbb4ca33", "sha256": "d788cc49fd20be1b3fb52fba46e462882423177a0a792d01dc99979a3ed9ebaf" }, "downloads": -1, "filename": "watchgod-0.3.tar.gz", "has_sig": false, "md5_digest": "0c28588b509f924b584afbebcbb4ca33", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 8358, "upload_time": "2018-11-15T22:40:11", "url": "https://files.pythonhosted.org/packages/9e/2c/10f314807941215bd59112f764e78ac88fad306676c16b9f03c2b1e3367b/watchgod-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "1ed1e634a7e09e90929546b4577f0c73", "sha256": "0795e9221b147ba1799326f98c643d0cd928c327bd7ab54c781ac16f509fb9f0" }, "downloads": -1, "filename": "watchgod-0.4-py35,py36-none-any.whl", "has_sig": false, "md5_digest": "1ed1e634a7e09e90929546b4577f0c73", "packagetype": "bdist_wheel", "python_version": "py35,py36", "requires_python": ">=3.5", "size": 9977, "upload_time": "2018-12-07T09:22:29", "url": "https://files.pythonhosted.org/packages/37/96/53762aa3faf1fec4691e4f9c7b204d3fceed846ddb6361035f532b8a5750/watchgod-0.4-py35,py36-none-any.whl" }, { "comment_text": "", "digests": { "md5": "84cdf79d9350d52a88c61c7012703558", "sha256": "7e71db5d327b4285f86c5729e737b2c75fb59915402842db1e4623fc60191dcf" }, "downloads": -1, "filename": "watchgod-0.4.tar.gz", "has_sig": false, "md5_digest": "84cdf79d9350d52a88c61c7012703558", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 8360, "upload_time": "2018-12-07T09:22:31", "url": "https://files.pythonhosted.org/packages/67/a2/519e8a0b410b74c99f65564178babe92f9880646a9caa97f6d20c8bbee90/watchgod-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "ded13bf6896edb10933771c8909fb22c", "sha256": "30ffb90c692e0797d23a39d695928c57d8c01a4a9708434e9dca16d7bd4e24c7" }, "downloads": -1, "filename": "watchgod-0.5-py35.py36.py37-none-any.whl", "has_sig": false, "md5_digest": "ded13bf6896edb10933771c8909fb22c", "packagetype": "bdist_wheel", "python_version": "py35.py36.py37", "requires_python": ">=3.5", "size": 10108, "upload_time": "2019-08-29T12:10:58", "url": "https://files.pythonhosted.org/packages/5c/a2/a3c50820206ad9771a22e1f06dc1a212a5cc3ea8acc14a3953465d6b9bad/watchgod-0.5-py35.py36.py37-none-any.whl" }, { "comment_text": "", "digests": { "md5": "54ac825669108d66ead8d7a893bad837", "sha256": "78d44cbacf4fbbf7573d10fcf0f156f1b0d71598d32477c34f8cf66001bafc1f" }, "downloads": -1, "filename": "watchgod-0.5.tar.gz", "has_sig": false, "md5_digest": "54ac825669108d66ead8d7a893bad837", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 10163, "upload_time": "2019-08-29T12:10:59", "url": "https://files.pythonhosted.org/packages/c3/99/5f6830868033454b526fd51800a044850c3942c9d4965183da22900d3244/watchgod-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ded13bf6896edb10933771c8909fb22c", "sha256": "30ffb90c692e0797d23a39d695928c57d8c01a4a9708434e9dca16d7bd4e24c7" }, "downloads": -1, "filename": "watchgod-0.5-py35.py36.py37-none-any.whl", "has_sig": false, "md5_digest": "ded13bf6896edb10933771c8909fb22c", "packagetype": "bdist_wheel", "python_version": "py35.py36.py37", "requires_python": ">=3.5", "size": 10108, "upload_time": "2019-08-29T12:10:58", "url": "https://files.pythonhosted.org/packages/5c/a2/a3c50820206ad9771a22e1f06dc1a212a5cc3ea8acc14a3953465d6b9bad/watchgod-0.5-py35.py36.py37-none-any.whl" }, { "comment_text": "", "digests": { "md5": "54ac825669108d66ead8d7a893bad837", "sha256": "78d44cbacf4fbbf7573d10fcf0f156f1b0d71598d32477c34f8cf66001bafc1f" }, "downloads": -1, "filename": "watchgod-0.5.tar.gz", "has_sig": false, "md5_digest": "54ac825669108d66ead8d7a893bad837", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 10163, "upload_time": "2019-08-29T12:10:59", "url": "https://files.pythonhosted.org/packages/c3/99/5f6830868033454b526fd51800a044850c3942c9d4965183da22900d3244/watchgod-0.5.tar.gz" } ] }