sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
539 stars 81 forks source link

2024.09.03 - Autobuild does not hot reload when changes happen #178

Open skimmedsquare opened 1 week ago

skimmedsquare commented 1 week ago

Summary

With the latest 2024.09.03 release, running make livehtml in the project directory starts up the server, however, pages do not successfully reload when changes are saved. Additionally, even force-reloading the page does not appear to get latest changes & the _build files are unmodified.

Using Python 3.9.6

Steps to Reproduce

  1. With the following requirements.txt
sphinx
sphinx-autobuild==2024.9.3
  1. Create a basic sphinx project & add the livehtml target mentioned in README.rst
  2. Run make livehtml
  3. Open default page @ 127.0.0.1:8000
  4. Edit & save project's index.rst

Relevant Output

(.venv) ➜  sphinx-test make livehtml
sphinx-autobuild "." "_build"
Running Sphinx v7.4.7
loading translations [en]... done
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
reading sources...
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

The HTML pages are in _build.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 152, in __call__
    await self.app(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/middleware.py", line 29, in __call__
    await self.app(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/starlette/routing.py", line 362, in handle
    await self.app(scope, receive, send)
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/server.py", line 72, in __call__
    [task.result() for task in done]
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/server.py", line 72, in <listcomp>
    [task.result() for task in done]
  File "/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/server.py", line 76, in watch_reloads
    await self.flag.wait()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
RuntimeError: Task <Task pending name='Task-24' coro=<RebuildServer.watch_reloads() running at /Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/server.py:76> cb=[_wait.<locals>._on_completion() at /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py:513]> got Future <Future pending> attached to a different loop
KyeRussell commented 1 week ago

Also seeing here, Python 3.9.18.

AA-Turner commented 1 day ago

There may be a problem with your installation:

/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020

...

RuntimeError: Task <Task pending name='Task-24' coro=<RebuildServer.watch_reloads() running at /Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild/server.py:76> cb=[_wait.<locals>._on_completion() at /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py:513]> got Future <Future pending> attached to a different loop

Can you try recreating your virtual environment, perhaps also with Python 3.12?

A