from livereload import Server, shell1from source.conf import html_static_path, templates_path23# -------------------------------------------------------------------------4# To use, just execute `python run_live_docs_server.py` in a terminal5# and a local server will run the docs in your browser, automatically6# refreshing/reloading the pages you're working on as they are modified.7# Extremely helpful to see the real output before it gets uploaded, and8# a much smoother experience than constantly running `make html` yourself.9# -------------------------------------------------------------------------1011if __name__ == "__main__":12# establish a local docs server13svr = Server()1415# command to rebuild the docs16refresh_docs = shell("make html")1718# watch for source file changes and trigger rebuild/refresh19svr.watch("*.rst", refresh_docs, delay=1)20svr.watch("*.md", refresh_docs, delay=1)21svr.watch("source/reference/*", refresh_docs, delay=1)22for path in html_static_path + templates_path:23svr.watch(f"source/{path}/*", refresh_docs, delay=1)2425# path from which to serve the docs26svr.serve(root="build/html")272829