{"library":"pywatchman","title":"pywatchman","description":"pywatchman is a Python client library for Facebook's Watchman file watching service. It provides a simple interface to connect to and query the Watchman daemon to efficiently discover file system changes. The library is actively maintained with frequent development tags on GitHub, and new PyPI releases (currently 3.0.0) are made periodically.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pywatchman"],"cli":null},"imports":["import pywatchman\nclient = pywatchman.client()","from pywatchman import bser"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pywatchman\nimport os\n\ndef main():\n    try:\n        # Establish a connection to the Watchman daemon\n        client = pywatchman.client()\n        print(f\"Connected to Watchman: {client.query('get-sockname')['sockname']}\")\n\n        # Define the directory to watch (current directory for example)\n        watch_dir = os.getcwd()\n        print(f\"Attempting to watch directory: {watch_dir}\")\n\n        # Tell Watchman to start watching the directory\n        # This will return existing watch if already present\n        watch_result = client.query('watch', watch_dir)\n        print(f\"Watch established: {watch_result}\")\n\n        # Perform a query for Python files that have changed since the last clock\n        # The 'clock' value is automatically managed by Watchman\n        query_result = client.query(\n            'query', watch_dir, {\n                'expression': ['allof', ['type', 'f'], ['suffix', 'py']],\n                'fields': ['name', 'size', 'mtime_ms']\n            }\n        )\n        print(\"\\nRecently changed Python files:\")\n        for f in query_result.get('files', []):\n            print(f\" - {f['name']} (size: {f['size']} bytes, modified: {f['mtime_ms']}ms ago)\")\n\n    except pywatchman.Unavailable as e:\n        print(f\"Error: Watchman service is unavailable. Please ensure Watchman is installed and running. Details: {e}\")\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to connect to the Watchman daemon, establish a watch on a directory, and then query for recently changed Python files within that watched directory. It includes basic error handling for when the Watchman service is not available.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":null,"pypi_latest":"3.0.0","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.4,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.8,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pywatchman","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.7,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}