# watchfiles

- Page: https://shared.btbytes.com/p/watchfiles
- Date: 2023-04-26
- Tags: nix, python, rust

[Watchfiles](https://github.com/samuelcolvin/watchfiles) is a file watching and code reload in python, written in [rust](https://shared.btbytes.com/p/rust).

Usage:
```python
# pip install watchfiles
from watchfiles import watch

for changes in watch('./path/to/dir'):
    print(changes)
```

Also supports `async` via `awatch`:

```python
import asyncio
from watchfiles import awatch

async def main():
    async for changes in awatch('/path/to/dir'):
        print(changes)

asyncio.run(main())
```


## Alternatives

- [entr](https://github.com/eradman/entr)
