Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
skimmedsquare opened this issue Sep 5, 2024 · 4 comments · May be fixed by #182
Open

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

skimmedsquare opened this issue Sep 5, 2024 · 4 comments · May be fixed by #182

Comments

@skimmedsquare
Copy link

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
Copy link

Also seeing here, Python 3.9.18.

@AA-Turner
Copy link
Member

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

@skimmedsquare
Copy link
Author

Recreated the venv - happened to be using the Mac system python, however, even using 3.9.20 from pyenv still has errors.

(.venv) ➜  sphinx-test make livehtml
sphinx-autobuild "." "_build"
[sphinx-autobuild] Starting initial build
[sphinx-autobuild] > sphinx-build . _build
Running Sphinx v7.4.7
loading translations [en]... done
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/MarkupSafe-2.1.5.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/alabaster-0.7.16.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/click-8.1.7.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/imagesize-1.4.1.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx-7.4.7.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx/ext/autosummary/templates/autosummary/base.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx/ext/autosummary/templates/autosummary/class.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx/ext/autosummary/templates/autosummary/module.rst: WARNING: document isn't included in any toctree
/Users/seankim/Projects/sphinx-test/.venv/lib/python3.9/site-packages/sphinx_autobuild-2024.9.3.dist-info/LICENSE.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
copying assets...
copying static files... done
copying extra files... done
copying assets: done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 9 warnings.

The HTML pages are in _build.
[sphinx-autobuild] Serving on http://127.0.0.1:8000
[sphinx-autobuild] Waiting to detect changes...
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 "/Users/seankim/.pyenv/versions/3.9.20/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
RuntimeError: Task <Task pending name='Task-18' 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 /Users/seankim/.pyenv/versions/3.9.20/lib/python3.9/asyncio/tasks.py:509]> got Future <Future pending> attached to a different loop

I'll try with 3.12 and see if that works

@jdillard
Copy link
Contributor

jdillard commented Oct 2, 2024

I had the same issue on 3.9.19 and then tested on 3.10.13 and it caught changes, so seems to be a 3.9 issue.

@MtkN1 MtkN1 linked a pull request Oct 29, 2024 that will close this issue
MtkN1 added a commit to pybotters/pybotters that referenced this issue Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants