{"id":13419227,"url":"https://github.com/samuelcolvin/watchfiles","last_synced_at":"2025-12-11T23:09:54.760Z","repository":{"id":37100479,"uuid":"106854381","full_name":"samuelcolvin/watchfiles","owner":"samuelcolvin","description":"Simple, modern and fast file watching and code reload in Python.","archived":false,"fork":false,"pushed_at":"2025-04-10T14:34:25.000Z","size":2086,"stargazers_count":1981,"open_issues_count":28,"forks_count":109,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-07T23:33:11.295Z","etag":null,"topics":["asyncio","filesystem","inotify","inotifywatch","notify","python","uvicorn"],"latest_commit_sha":null,"homepage":"https://watchfiles.helpmanual.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samuelcolvin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"samuelcolvin"}},"created_at":"2017-10-13T17:31:51.000Z","updated_at":"2025-05-07T16:03:11.000Z","dependencies_parsed_at":"2024-01-29T06:15:19.373Z","dependency_job_id":"1bfcc4ad-1bb1-4243-aac7-4ce051d2973b","html_url":"https://github.com/samuelcolvin/watchfiles","commit_stats":{"total_commits":253,"total_committers":48,"mean_commits":5.270833333333333,"dds":"0.40711462450592883","last_synced_commit":"946a29616ef555b313249b51038ff1b51e2e97ec"},"previous_names":["samuelcolvin/watchgod"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fwatchfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fwatchfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fwatchfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fwatchfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelcolvin","download_url":"https://codeload.github.com/samuelcolvin/watchfiles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043219,"owners_count":22004912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","filesystem","inotify","inotifywatch","notify","python","uvicorn"],"created_at":"2024-07-30T22:01:13.054Z","updated_at":"2025-12-11T23:09:54.716Z","avatar_url":"https://github.com/samuelcolvin.png","language":"Python","funding_links":["https://github.com/sponsors/samuelcolvin"],"categories":["Python","语言资源库","File Manipulation","File Watching \u0026 System Utilities"],"sub_categories":["python"],"readme":"# watchfiles\n\n[![CI](https://github.com/samuelcolvin/watchfiles/actions/workflows/ci.yml/badge.svg)](https://github.com/samuelcolvin/watchfiles/actions/workflows/ci.yml?query=branch%3Amain)\n[![Coverage](https://codecov.io/gh/samuelcolvin/watchfiles/branch/main/graph/badge.svg)](https://codecov.io/gh/samuelcolvin/watchfiles)\n[![pypi](https://img.shields.io/pypi/v/watchfiles.svg)](https://pypi.python.org/pypi/watchfiles)\n[![CondaForge](https://img.shields.io/conda/v/conda-forge/watchfiles.svg)](https://anaconda.org/conda-forge/watchfiles)\n[![license](https://img.shields.io/github/license/samuelcolvin/watchfiles.svg)](https://github.com/samuelcolvin/watchfiles/blob/main/LICENSE)\n\nSimple, modern and high performance file watching and code reload in python.\n\n---\n\n**Documentation**: [watchfiles.helpmanual.io](https://watchfiles.helpmanual.io)\n\n**Source Code**: [github.com/samuelcolvin/watchfiles](https://github.com/samuelcolvin/watchfiles)\n\n---\n\nUnderlying file system notifications are handled by the [Notify](https://github.com/notify-rs/notify) rust library.\n\nThis package was previously named \"watchgod\",\nsee [the migration guide](https://watchfiles.helpmanual.io/migrating/) for more information.\n\n## Installation\n\n**watchfiles** requires Python 3.8 - 3.13.\n\n```bash\npip install watchfiles\n```\n\nBinaries are available for:\n\n* **Linux**: `x86_64`, `aarch64`, `i686`, `armv7l`, `musl-x86_64` \u0026 `musl-aarch64`\n* **MacOS**: `x86_64` \u0026 `arm64`\n* **Windows**: `amd64` \u0026 `win32`\n\nOtherwise, you can install from source which requires Rust stable to be installed.\n\n## Usage\n\nHere are some examples of what **watchfiles** can do:\n\n### `watch` Usage\n\n```py\nfrom watchfiles import watch\n\nfor changes in watch('./path/to/dir'):\n    print(changes)\n```\nSee [`watch` docs](https://watchfiles.helpmanual.io/api/watch/#watchfiles.watch) for more details.\n\n### `awatch` Usage\n\n```py\nimport asyncio\nfrom watchfiles import awatch\n\nasync def main():\n    async for changes in awatch('/path/to/dir'):\n        print(changes)\n\nasyncio.run(main())\n```\nSee [`awatch` docs](https://watchfiles.helpmanual.io/api/watch/#watchfiles.awatch) for more details.\n\n### `run_process` Usage\n\n```py\nfrom watchfiles import run_process\n\ndef foobar(a, b, c):\n    ...\n\nif __name__ == '__main__':\n    run_process('./path/to/dir', target=foobar, args=(1, 2, 3))\n```\nSee [`run_process` docs](https://watchfiles.helpmanual.io/api/run_process/#watchfiles.run_process) for more details.\n\n### `arun_process` Usage\n\n```py\nimport asyncio\nfrom watchfiles import arun_process\n\ndef foobar(a, b, c):\n    ...\n\nasync def main():\n    await arun_process('./path/to/dir', target=foobar, args=(1, 2, 3))\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```\nSee [`arun_process` docs](https://watchfiles.helpmanual.io/api/run_process/#watchfiles.arun_process) for more details.\n\n## CLI\n\n**watchfiles** also comes with a CLI for running and reloading code. To run `some command` when files in `src` change:\n\n```\nwatchfiles \"some command\" src\n```\n\nFor more information, see [the CLI docs](https://watchfiles.helpmanual.io/cli/).\n\nOr run\n\n```bash\nwatchfiles --help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fwatchfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelcolvin%2Fwatchfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fwatchfiles/lists"}