Skip to main content

Simple, modern and high performance file watching and code reload in python.

Project description

watchfiles

CI Coverage pypi license

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: manylinux-x86_64, musllinux-x86_64 & manylinux-i686
  • 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.

For more information, see the CLI docs.

Or run

watchfiles --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

watchfiles-0.13.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distributions

watchfiles-0.13-cp310-cp310-win_amd64.whl (208.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

watchfiles-0.13-cp310-cp310-win32.whl (201.3 kB view hashes)

Uploaded CPython 3.10 Windows x86

watchfiles-0.13-cp310-cp310-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

watchfiles-0.13-cp310-cp310-manylinux_2_24_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64

watchfiles-0.13-cp310-cp310-manylinux_2_24_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.24+ i686

watchfiles-0.13-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

watchfiles-0.13-cp310-cp310-macosx_11_0_arm64.whl (299.9 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

watchfiles-0.13-cp310-cp310-macosx_10_9_x86_64.whl (309.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

watchfiles-0.13-cp39-cp39-win_amd64.whl (208.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

watchfiles-0.13-cp39-cp39-win32.whl (201.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

watchfiles-0.13-cp39-cp39-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

watchfiles-0.13-cp39-cp39-manylinux_2_24_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

watchfiles-0.13-cp39-cp39-manylinux_2_24_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ i686

watchfiles-0.13-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

watchfiles-0.13-cp39-cp39-macosx_11_0_arm64.whl (299.9 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

watchfiles-0.13-cp39-cp39-macosx_10_9_x86_64.whl (309.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

watchfiles-0.13-cp38-cp38-win_amd64.whl (208.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

watchfiles-0.13-cp38-cp38-win32.whl (201.0 kB view hashes)

Uploaded CPython 3.8 Windows x86

watchfiles-0.13-cp38-cp38-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

watchfiles-0.13-cp38-cp38-manylinux_2_24_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

watchfiles-0.13-cp38-cp38-manylinux_2_24_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ i686

watchfiles-0.13-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

watchfiles-0.13-cp38-cp38-macosx_11_0_arm64.whl (299.4 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

watchfiles-0.13-cp38-cp38-macosx_10_9_x86_64.whl (309.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

watchfiles-0.13-cp37-cp37m-win_amd64.whl (208.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

watchfiles-0.13-cp37-cp37m-win32.whl (201.0 kB view hashes)

Uploaded CPython 3.7m Windows x86

watchfiles-0.13-cp37-cp37m-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

watchfiles-0.13-cp37-cp37m-manylinux_2_24_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

watchfiles-0.13-cp37-cp37m-manylinux_2_24_i686.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ i686

watchfiles-0.13-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

watchfiles-0.13-cp37-cp37m-macosx_10_9_x86_64.whl (309.2 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page