{"id":422,"library":"watchfiles","title":"watchfiles","description":"A simple, modern, and high-performance file watching and code reloading library for Python, currently at version 1.1.1, with a release cadence of approximately every 3-4 months.","status":"active","version":"1.1.1","language":"python","source_language":"en","source_url":"https://github.com/samuelcolvin/watchfiles","tags":["file watching","code reloading","Python","Rust","watchfiles"],"install":[{"cmd":"pip install watchfiles","lang":"bash","label":"Install watchfiles"}],"dependencies":[{"reason":"Provides underlying file system notifications via the Notify Rust library.","package":"notify"}],"imports":[{"note":"Correct import path for the 'watch' function.","symbol":"watch","correct":"from watchfiles import watch"},{"note":"Correct import path for the 'awatch' function.","symbol":"awatch","correct":"from watchfiles import awatch"},{"note":"Correct import path for the 'run_process' function.","symbol":"run_process","correct":"from watchfiles import run_process"},{"note":"Correct import path for the 'arun_process' function.","symbol":"arun_process","correct":"from watchfiles import arun_process"}],"quickstart":{"code":"from watchfiles import watch\n\nfor changes in watch('./path/to/dir'):\n    print(changes)","lang":"python","description":"A simple script to monitor changes in a directory using the 'watch' function from watchfiles."},"warnings":[{"fix":"Rename imports from 'watchgod' to 'watchfiles'.","message":"The package was previously named 'watchgod'.","severity":"breaking","affected_versions":"All versions prior to 0.24.0"},{"fix":"Upgrade to Python 3.9 or later.","message":"Python 3.8 support was dropped in version 0.24.0.","severity":"deprecated","affected_versions":"0.24.0 and later"},{"fix":"Install the 'notify' Rust library as per the installation instructions.","message":"Ensure that the 'notify' Rust library is installed for optimal performance.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that the path passed to `watch()` exists and is accessible at runtime. You may need to create the directory/file or adjust the path.","message":"The `watch()` function expects a valid, existing file or directory path. Providing a non-existent path will result in a `FileNotFoundError`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T13:42:43.932Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"pip install watchfiles","cause":"The 'watchfiles' package is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'watchfiles'"},{"fix":"Use 'from watchfiles import run' and pass your target function via the 'target' argument, or use the 'watchfiles' CLI command directly.","cause":"The 'run_process' function is not directly exposed from the top-level 'watchfiles' module for public use; the primary public function for running a watcher is 'watchfiles.run', which also supports running a target function in a separate process.","error":"ImportError: cannot import name 'run_process' from 'watchfiles'"},{"fix":"Pass the path(s) as positional arguments, for example: 'watchfiles.run('.', target=my_function)'.","cause":"The 'paths' argument(s) for the 'watchfiles.run' function must be passed positionally, not as a keyword argument named 'target'. 'target' is used to specify the function to run in a separate process.","error":"TypeError: run() got an unexpected keyword argument 'target'"},{"fix":"Update your callback function signature to accept one argument, for example: 'def my_callback(changes: set):\\n    for change, path in changes:\\n        print(f'{change.name}: {path}')'","cause":"The callback function provided to 'watchfiles.run' must accept one argument, which will be a set of 'Change' tuples representing the detected file changes.","error":"TypeError: my_callback() takes 0 positional arguments but 1 was given"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":7.3,"disk_size":"21.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":7.3,"disk_size":"22M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.33,"mem_mb":8.6,"disk_size":"23.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.27,"mem_mb":8.6,"disk_size":"24M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.55,"mem_mb":10.1,"disk_size":"15.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.54,"mem_mb":10.1,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":7.1,"disk_size":"14.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":7.1,"disk_size":"15M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":7.3,"disk_size":"21.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":7.3,"disk_size":"21M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}