{"id":4612,"library":"livereload","title":"Python LiveReload","description":"Python LiveReload is a tool for web developers that automatically reloads webpages in the browser when file changes are detected. It provides a WSGI-compatible server and a command-line utility, focusing on simple, real-time feedback during development. The current version is 2.7.1, with a release cadence that includes bug fixes and minor enhancements.","status":"active","version":"2.7.1","language":"en","source_language":"en","source_url":"https://github.com/lepture/python-livereload","tags":["web-development","frontend","development-server","live-reload","wsgi"],"install":[{"cmd":"pip install livereload","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Recommended for performance on Linux for file watching.","package":"pyinotify","optional":true}],"imports":[{"symbol":"Server","correct":"from livereload import Server"},{"symbol":"shell","correct":"from livereload import shell"}],"quickstart":{"code":"import os\nfrom livereload import Server, shell\n\n# Create a dummy index.html for demonstration\nwith open('index.html', 'w') as f:\n    f.write('<!DOCTYPE html>\\n<html><head><title>LiveReload Test</title></head><body><h1>Hello, LiveReload!</h1></body></html>')\n\nserver = Server()\nserver.watch('*.html')\nserver.serve(open_url_delay=1)\n","lang":"python","description":"This quickstart creates a simple HTML file, then starts a LiveReload server that watches for changes to any `.html` files in the current directory. It will automatically open a browser tab to `http://localhost:5500` and reload it when files change."},"warnings":[{"fix":"Rewrite your watch rules using the Python API `server.watch()` within a Python script instead of a `Guardfile`.","message":"The `Guardfile` configuration method was removed in version 2.0.0. Older setups relying on a `Guardfile` will no longer work.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use the `delay` parameter in `server.watch(filepath, func=None, delay=None)` to debounce reloads, or specify more granular file patterns to watch.","message":"When watching a large number of files, or during a build process that generates many files, `livereload` can trigger excessive reloads and high CPU usage.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that `livereload`'s server and your application's `IOLoop` (if any) are properly managed. Version 2.7.1 includes a fix for IOLoop stopping, but complex `Tornado` integrations may still require careful handling.","message":"`livereload` internally uses `Tornado`'s IOLoop. Improper integration with existing `Tornado` applications or other async loops can lead to issues, especially around the loop's lifecycle.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Create a Python script (e.g., `serve.py`) that imports `Server` and `shell` and defines your watch rules programmatically, then run it with `python serve.py`.","message":"While a command-line interface (`livereload` command) is available, it's recommended to use the Python API for more advanced or custom watching scenarios, especially since the removal of `Guardfile`.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Configure your reverse proxy to correctly handle WebSocket connections and ensure that the `Host` and `X-Forwarded-Proto` headers are passed through, or specify `liveport` explicitly if needed.","message":"When running behind a reverse proxy, particularly with HTTPS, the `livereload.js` client might attempt to connect via `ws://` instead of `wss://`, leading to connection errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}