Simple, modern and high performance file watching and code reload in python.
Project description
watchfiles
Simple, modern and high performance file watching and code reload in python.
Documentation: watchfiles.helpmanual.io
Source Code: github.com/samuelcolvin/watchfiles
Underlying file system notifications are handled by the Notify rust library.
This package was previously named "watchgod", see the migration guide for more information.
Installation
watchfiles requires Python 3.7 - 3.10.
pip install watchfiles
Binaries are available for:
- Linux:
x86_64
,aarch64
,i686
,musl-x86_64
&musl-aarch64
- MacOS:
x86_64
&arm64
(except python 3.7) - Windows:
amd64
&win32
Otherwise, you can install from source which requires Rust stable to be installed.
Usage
Here are some examples of what watchfiles can do:
watch
Usage
from watchfiles import watch
for changes in watch('./path/to/dir'):
print(changes)
See watch
docs for more details.
awatch
Usage
import asyncio
from watchfiles import awatch
async def main():
async for changes in awatch('/path/to/dir'):
print(changes)
asyncio.run(main())
See awatch
docs for more details.
run_process
Usage
from watchfiles import run_process
def foobar(a, b, c):
...
if __name__ == '__main__':
run_process('./path/to/dir', target=foobar, args=(1, 2, 3))
See run_process
docs for more details.
arun_process
Usage
import asyncio
from watchfiles import arun_process
def foobar(a, b, c):
...
async def main():
await arun_process('./path/to/dir', target=foobar, args=(1, 2, 3))
if __name__ == '__main__':
asyncio.run(main())
See arun_process
docs for more details.
CLI
watchfiles also comes with a CLI for running and reloading code. To run some command
when files in src
change:
watchfiles "some command" src
For more information, see the CLI docs.
Or run
watchfiles --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b52f76341dc18b686f199cb4ae08d1061a2fc428936c8a403dd36922de8222ef |
|
MD5 | 6018acd3a811fc5dc2798e5c6968034b |
|
BLAKE2b-256 | 709dba0cfa68fdf348e08e20bd80c5920ccbdc7fe71c6fd590448478addae356 |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d69f4103901b0132583d4b9eb8f92e0ca14b45d16c8239be50ae61e68471740 |
|
MD5 | ecde37bec868e203aa68409f9949c62a |
|
BLAKE2b-256 | 96315645629e7e198da196e1e2f92daf892ca1afb78f4668c2ba20452316072c |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a43b44f6d10f5ca00f7e427c1721049d76e68907f5a8a17925e092aa6acab99b |
|
MD5 | 4b7abaac10e6fb166012c4f6e402f1f5 |
|
BLAKE2b-256 | 0df9f4aa58ca947b38a96edb602f95f439a44b8dad49511b8fef679b2c6f960a |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0502b356fc758af7a3c3f5ff8d068de9d198780c066aa4504f72550455d284a5 |
|
MD5 | fabf50f0b3c980a89db0debfb5424e4a |
|
BLAKE2b-256 | 61d56308f8b78327911ea7de37b0e2f470c8858b1ba7fe568e695e09c8df0488 |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f915d57c81c9aa1de18b2110fe0c9d47ebf06d58636b3787bff67e4e1a065c99 |
|
MD5 | 7e8aac4073e280e3640894b6223366cf |
|
BLAKE2b-256 | c6119f2bb85771179abfd2f53ea302da28dbd6bfc37391fc75fbd67f174a9b48 |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec1d24dbfcc79db90df86d80b655e0dca7842ea0d889c1bd9046e7d534d483ce |
|
MD5 | 90f686a985da03bf545ebec4deb234b2 |
|
BLAKE2b-256 | 19cb16692876b2a8fc940586a853ec700980e6dfd153bf5ccd6da2b3ff98229a |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbfd9fe159134fba21ce8f93f163c07f3a0d8a3227924af2a8d33490ee8cb471 |
|
MD5 | ce9b6d7252d36a387d5ddf02f8d9d2a8 |
|
BLAKE2b-256 | 27e3741431508d64ae04f55ab34f984800287d97e41c3adfb5fabc53572c7e90 |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21880ad52da519b26b0a2ce20e8bc0d3792e48205e456068297042821d4f1990 |
|
MD5 | f18d92e35dc5d81001c15389f8fbc235 |
|
BLAKE2b-256 | 1ea4224fde39cdf02819b1f548e49ff24e8e8cefd3ab8c5a6d06f1e6a29bcab6 |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdcdc7f3ddd33bf63a0eb23997fd291a579f7bfcddb083d5acddc42a6d8d4c2e |
|
MD5 | 31e2be50c2cb203d9e93e448db8246a6 |
|
BLAKE2b-256 | 3346e1873f1d753ee76d17878d360b8ccd702373d58ce5e06b5dafbdc3615d7d |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd44f41ec7fcfe3ec0ae5276522c8c5d498556c497e89a19a56119eeb3201905 |
|
MD5 | 9324de902e6fb830d4f757288dc63c72 |
|
BLAKE2b-256 | fcd9c2dde3dd6026e6b446ec9567609b7e9e8fe9ba6d7ebf748dae7e8fbdc6fb |
Hashes for watchfiles-0.15.0_alpha1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c825f10e292476b56a90460782c79e3ce6770a924bd2663e0d9db778414abc72 |
|
MD5 | bdfe5bde30ff7f533ee929db27c2f05f |
|
BLAKE2b-256 | d81c319bcd9094dbe3fb5f050ea5db86600a5932799267d0d8e327030f851799 |