• Stars
    star
    1,702
  • Rank 27,180 (Top 0.6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 25 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple, modern and fast file watching and code reload in python.

watchfiles

CI Coverage pypi CondaForge 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: 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

More Repositories

1

arq

Fast job queuing and RPC in python with asyncio and redis.
Python
1,989
star
2

python-devtools

Dev tools for python
Python
921
star
3

dirty-equals

Doing dirty (but extremely useful) things with equals.
Python
776
star
4

pytest-pretty

pytest plugin for pretty printing the test summary.
Python
400
star
5

rtoml

A fast TOML library for python implemented in rust.
Python
313
star
6

JuliaByExample

Examples of Julia
Julia
296
star
7

aioaws

Asyncio compatible SDK for aws services.
Python
168
star
8

dnserver

Simple development DNS server written in python
Python
139
star
9

jinjahtml-vscode

Syntax highlighting for jinja(2) html templates in vscode
JavaScript
135
star
10

smokeshow

create temporary websites
TypeScript
127
star
11

aicli

OpenAI powered AI CLI in just a few lines of code.
Python
114
star
12

buildpg

Query building for the postgresql prepared statements and asyncpg.
Python
79
star
13

nginx-pages

static site server using nginx with auto deploy via scp
Shell
67
star
14

aiohttp-vs-sanic-vs-japronto

Rough benchmarks of of aiohttp and sanic
Python
54
star
15

notbook

An argument that Jupyter Notebooks are flawed and the world needs a successor.
Python
52
star
16

pytest-speed

Modern benchmarking library for python with pytest integration.
Python
50
star
17

edge-mock

Tools for testing and developing CloudFlare worker apps.
TypeScript
50
star
18

Bokeh.jl

Bokeh Bindings for Julia
Jupyter Notebook
47
star
19

helpmanual.io

Python
43
star
20

foxglove

Python
33
star
21

xdelta3-python

Fast delta encoding in python using xdelta3
Python
30
star
22

list-python-dependencies

GitHub action to list all valid versions of dependency for a Python project
Python
29
star
23

mkdocs-run-code

TypeScript
28
star
24

nosht

Open Source Event Ticketing Platform, deployed at
Python
28
star
25

sasstastic

Fantastic SASS and SCSS compilation for python
Python
26
star
26

aiohttp-toolbox

Tools for aiohttp
Python
23
star
27

harrier

A better static site generator.
Python
21
star
28

cloudflare-proxy

proxy requests using cloudflare worker, useful for webhooks fired to slow endpoints
JavaScript
19
star
29

grablib

Static asset management in python
Python
19
star
30

cloudflare-worker-speed-test

Rust
14
star
31

edgerender

Render at the edge
TypeScript
13
star
32

coverage-badge

TypeScript
11
star
33

async-redis

Asynchronous Python redis client
Python
10
star
34

JellyFish.jl

approximate and phonetic matching of strings
Julia
10
star
35

aiohttp_runserver

Moved to
Python
10
star
36

yatl

Yet Another Template Language
TypeScript
9
star
37

django-handsontable

Django app to implement handsontable (jquery-handsontable). Uses django-rest-framework.
JavaScript
8
star
38

land-registry-price-paid-data

Land registry house price data converted to Python Pandas DataFrame
Python
8
star
39

email-forward

Docker container for email forwarding with python
Python
8
star
40

check-python-version

Check the release tag matches the library version before deploy.
Python
7
star
41

pytest-toolbox

Numerous useful plugins for pytest.
Python
7
star
42

pytest-cloudflare-worker

pytest plugin for testing cloudflare workers
Python
6
star
43

quick-strings

Rust
6
star
44

em2

Python
5
star
45

cfpypi

Private python package index using cloudflare workers
JavaScript
5
star
46

init-desktop

Python
5
star
47

donkey-make

Make for the 21st century
Rust
4
star
48

gistviewer

tool for viewing HTML file in gists
JavaScript
4
star
49

label-and-assign

GitHub action to switch labels and assignees on pull requests using comments.
Python
4
star
50

edgerender-rust

Work in progress
Rust
4
star
51

django-db-viewer

Django site for view contents of mysql, sqlite and mongdb databases and filtering the results
Python
4
star
52

password-locker

Make passwords available only when you need them (mostly for CI)
TypeScript
4
star
53

wrangler-typescript-errors

TypeScript
4
star
54

logfire_django_demo

Python
4
star
55

python-IR-demodulation

Python infrared remote control deamon.
Python
3
star
56

donkey-simple-old

Super simple site manager that provides a front end to generate static websites
Python
3
star
57

logfire-python

logfire client for python
Python
3
star
58

coverage-prepare

Convert rust coverage data to HTML reports, LCOV files or terminal tables
Rust
3
star
59

githubproxy

Proxy for GitHub that adds "Content-Type" and "Access-Control-Allow-Origin" headers.
TypeScript
3
star
60

pydantic-sandbox

me fiddling with issue templates etc for pydantic, IGNORE THIS REPO
Python
3
star
61

tensorflow-gpu-py36

Python
2
star
62

django-importexport

django app to export and import data to and from excel (and possibly other formats in the future
Python
2
star
63

keypress

press keys from the command line
Rust
2
star
64

rust-bench

some benchmarks of rust code
Rust
2
star
65

django-crud

CRUD controllers for django: Create, Retrieve, Update, Delete, List
Python
1
star
66

ci-donkey

Simple Continuous Integration system based on Django and Docker
Python
1
star
67

django-skeletal-display

django app consisting of simple display module
JavaScript
1
star
68

python-file-watcher

Python
1
star
69

csv-labels

Python
1
star
70

httpi

Rust
1
star
71

tictoc.rs

Rust
1
star
72

donkey

Like "make" but for the 21st century.
Python
1
star
73

uJSON.jl

JSON library for Julia using ultraJSON
Julia
1
star
74

testing-projects

1
star
75

TestPac.jl

Test is a demonstratoin Package, see https://github.com/samuelcolvin/julia-slideshow
Julia
1
star
76

covid-19-calcs

Jupyter Notebook
1
star
77

print-debug

Python
1
star
78

bash

unofficial mirror of bash from http://savannah.gnu.org/projects/bash/
C
1
star
79

donkey-simple

Experiment
JavaScript
1
star
80

django-websockets

Experimental websocket support for django
Python
1
star
81

alpine-nginx

Docker image of stripped down nginx server using alpine. image < 15mb
Nginx
1
star
82

pdfapi

PDF API using docker
Python
1
star
83

codeshow

very simple flask app to display just code from gists
Python
1
star
84

django-sales-estimates

Django Sales Estimates Base System
Python
1
star
85

reactstrap-toolbox

JavaScript
1
star
86

Night-Shadow

Chrome Web App: World Clock that shows an image of the world in night and day. It also displays your location and the location of your clocks.
JavaScript
1
star
87

HotDjango

Django app for displaying data - like the admin interface, but pretty and for displaying as well as editing data
Python
1
star