{"id":4848,"library":"watchgod","title":"Watchgod","description":"Watchgod is a Python library designed for simple file watching and code reloading. It was last released as version 0.8.2 in April 2022. This package is now considered inactive and has been superseded by `watchfiles`, which offers a more performant Rust-based backend for file system notifications. `watchgod` relies on file polling for change detection.","status":"renamed","version":"0.8.2","language":"en","source_language":"en","source_url":"https://github.com/samuelcolvin/watchfiles","tags":["file watching","code reload","developer tools","deprecated"],"install":[{"cmd":"pip install watchgod","lang":"bash","label":"Install last stable version"}],"dependencies":[],"imports":[{"symbol":"watch","correct":"from watchgod import watch"},{"symbol":"awatch","correct":"from watchgod import awatch"},{"symbol":"run_process","correct":"from watchgod import run_process"},{"symbol":"arun_process","correct":"from watchgod import arun_process"}],"quickstart":{"code":"import time\nfrom watchgod import watch\nimport os\n\ndef main():\n    # Create a dummy directory and file for demonstration\n    if not os.path.exists('watched_dir'):\n        os.makedirs('watched_dir')\n    with open('watched_dir/test.txt', 'w') as f:\n        f.write('initial content')\n    print(\"Watching './watched_dir' for changes (will run for 5 seconds)...\")\n\n    # The 'watch' function yields sets of changed files\n    # In a real application, you'd typically run this indefinitely\n    # or within a controlled loop.\n    # For this quickstart, we'll simulate a short watch period.\n    # Note: watchgod uses polling, so changes might not be immediate.\n    start_time = time.time()\n    for changes in watch('./watched_dir'):\n        print(f\"Detected changes: {changes}\")\n        if time.time() - start_time > 5: # Limit execution time for quickstart\n            break\n\n    print(\"Quickstart demonstration complete.\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to use `watchgod.watch` to detect file system changes in a specified directory. It creates a temporary directory and file, then watches it for a short period. For real-world use, you would typically run the `watch` loop indefinitely."},"warnings":[{"fix":"Migrate to `watchfiles`. Install with `pip install watchfiles`. Update import statements from `watchgod` to `watchfiles`. Be aware of potential API changes, especially regarding `watcher_cls` (replaced by `watch_filter`) and `target` arguments for `run_process` (now keyword-only). Refer to the `watchfiles` migration guide.","message":"This package (watchgod) has been renamed to `watchfiles` and is no longer actively developed. The `watchgod` package will only receive critical security fixes. Users are strongly encouraged to migrate to `watchfiles` for new projects and to update existing `watchgod` installations.","severity":"breaking","affected_versions":"<=0.8.2"},{"fix":"For high-performance, real-time file watching, use the `watchfiles` library, its successor, which utilizes a Rust-based backend for OS-native file system event handling.","message":"`watchgod` (version 0.8.2 and earlier) uses file polling to detect changes, which can be less efficient and may introduce a slight delay compared to OS-native file system notifications.","severity":"gotcha","affected_versions":"<=0.8.2"},{"fix":"Switch to `watchfiles` to ensure you receive ongoing feature development, performance improvements, and non-critical bug fixes.","message":"The `Development Status :: 7 - Inactive` classifier has been added to the `watchgod` PyPI project, indicating that the project is no longer under active development.","severity":"deprecated","affected_versions":"<=0.8.2"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}