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
,armv7l
,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-cp37-abi3-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82238d08d8a49f1a1ba254278cd4329a154f6100b028393059722ebeddd2ff3d |
|
MD5 | 985fbef7a5a3aa69e04a689ee80a7fd4 |
|
BLAKE2b-256 | 7da69e25afd734d15146fd3a58cea6d3d8a3497317556835b873470065399125 |
Hashes for watchfiles-0.15.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b81c6e404b2aa62482a719eb778e4a16d01728302dce1f1512c1e5354a73fda |
|
MD5 | 0605b48587264447b6d804a74eb99acf |
|
BLAKE2b-256 | 41719eab568af6bf9a57b498a30a09e089a4b3963a4962827b02dcb506935947 |
Hashes for watchfiles-0.15.0-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56abed43e645d1f2d6def83e35999cc5758b051aff54ca1065cbfcaea15b3389 |
|
MD5 | 9a49d360fe5eda711ed7941804b0d855 |
|
BLAKE2b-256 | f1995049bb5730a7d303453900e89137efe0fbb2a32d46bcee4616670f443709 |
Hashes for watchfiles-0.15.0-cp37-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1f9de6b776b3aff17898a4cf5ac5a2d0a16212ea7aad2bbe0ef6aa3e79a96af |
|
MD5 | 9eac554482932ba36c80e38aa36d07cb |
|
BLAKE2b-256 | c7e94ca84d0d6cf629085541bef3eede8c5187034d5028d3b4e48b21e3ca4055 |
Hashes for watchfiles-0.15.0-cp37-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 715733c2ac9da67b2790788657ff6f8b3797eb31565bfc592289b523ae907ca2 |
|
MD5 | d8b07ccad4af0c70c14beed606cf0ee4 |
|
BLAKE2b-256 | ca8627c3d45da114b16afd4193fe53975c9d09d0828981ab8164a3c9f713fa93 |
Hashes for watchfiles-0.15.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 955e8f840e1996a8a41be57de4c03af7b1515a685b7fb6abe222f859e413a907 |
|
MD5 | d7a37548b3f3f340dad8b60f29e907e3 |
|
BLAKE2b-256 | 554df95f3c134f52a0c278e92d3a6a0c1fd6b1bc69290ceac6415f878e3c4b64 |
Hashes for watchfiles-0.15.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4f45acd1143db6d3ee77a4ff12d3239bc8083108133e6174e9dcce59c1f9902 |
|
MD5 | 25b50bdc2da9379134bd64aadff7a4dd |
|
BLAKE2b-256 | 399adc96c6ae0984d87023f695d81b2a6d72670066ec4170a9a4331b7272ff21 |
Hashes for watchfiles-0.15.0-cp37-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ca99a94fcab29d00aa406526eb29cf198c0661854d59a315596064fed02141 |
|
MD5 | 89c2eae768c89385dccee81473613925 |
|
BLAKE2b-256 | 6ed3ad947c6ece5fbfb68d0bcf9e20c57eecd8741dd1d41b8851108f3d3d45ed |
Hashes for watchfiles-0.15.0-cp37-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f71012e096e11256fae3b37617a9777980f281e18deb2e789e85cd5b113935 |
|
MD5 | f0efb5bb175e64e2691dc0a4c8640994 |
|
BLAKE2b-256 | d053a144d78d1474d529544d4c585016508387823fe344862195a542d7c58c5d |
Hashes for watchfiles-0.15.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0e8829d32b05151e6009570449f44f891e05f518e495d25f960e0d0b2d0064 |
|
MD5 | 52ec7bb518f005fc207b4f44cd5efae1 |
|
BLAKE2b-256 | 20ca8e529bfe132b886a40d32b3486d8d2ad973c231d00e8c87a1df9c0b1986c |
Hashes for watchfiles-0.15.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67d4c66e46a564059df4aeedab78f09cba0b697bf36cc77566b0a7015dfb7f5d |
|
MD5 | 06076b8354cbcee3c497eb2de27af9e6 |
|
BLAKE2b-256 | 6d98a28e9886b05178099e2f2666fc05c362421e7902a0c88817954618816b50 |