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
523 stars 75 forks source link

Can't use `--ignore` with `doc/_build/jupyter_execute/*.ipynb` to prevent infinite loop #117

Open NickleDave opened 2 years ago

NickleDave commented 2 years ago

Describe the bug

context Hi, thanks for developing this very useful tool.

I'm having a bit of an issue where I've added MyST-NB to a project and this causes an infinite build loop, because notebooks are detected as a change, e.g.:

[sphinx-autobuild] Detected change: /home/pimienta/Documents/repos/coding/vocal/crowsetta/doc/_build/jupyter_execute/index.ipynb

expectation

To try and fix this, I use the --ignore option, like so:

sphinx-autobuild --ignore doc/_build/jupyter_execute/*.ipynb doc doc/_build/html

bug But instead I now get:

__main__.py: error: cannot find files ['doc/_build/html']
Command exited with exit code: 2
The server will continue serving the build folder, but the contents being served are no longer in sync with the documentation sources. Please fix the cause of the error above or press Ctrl+C to stop the server.

My interpretation of this error is that somehow the glob I'm writing for --ignore is causing sphinx-autobuild to not see the doc/_build/html folder? It definitely still exists.

$ ls doc/_build/html
api             _downloads  genindex.html  howto-user-format.html  index.html  notebooks    py-modindex.html  scripts      searchindex.js  _static
CHANGELOG.html  formats     howto.html     _images                 _modules    objects.inv  reports           search.html  _sources        tutorial.html

Please let me know if there's some mistake I'm making here

Reproduce the bug

Not sure I can write a MRE for this one.

List your environment

$ pip freeze
alabaster==0.7.12
anyio==3.6.1
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.5
attrs==21.4.0
audioread==2.1.9
Babel==2.10.1
backcall==0.2.0
beautifulsoup4==4.11.1
birdsong-recognition-dataset==0.3.2
bleach==5.0.0
certifi==2022.5.18.1
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.4
commonmark==0.9.1
coverage==6.4
-e git+ssh://git@github.com/vocalpy/crowsetta.git@09512fcf17ddb59e5871756d98ff5adc5e40eac4#egg=crowsetta
cryptography==37.0.2
debugpy==1.6.0
decorator==5.1.1
defusedxml==0.7.1
docutils==0.17.1
entrypoints==0.4
evfuncs==0.3.5
executing==0.8.3
fastjsonschema==2.15.3
flit==3.7.1
flit_core==3.7.1
greenlet==1.1.2
idna==3.3
imagesize==1.3.0
importlib-metadata==4.11.4
importlib-resources==5.7.1
iniconfig==1.1.1
ipykernel==6.13.0
ipython==8.4.0
ipython-genutils==0.2.0
jedi==0.18.1
jeepney==0.8.0
Jinja2==3.1.2
joblib==1.1.0
json5==0.9.8
jsonschema==4.5.1
jupyter-cache==0.5.0
jupyter-client==7.3.1
jupyter-core==4.10.0
jupyter-server==1.17.0
jupyterlab==3.4.2
jupyterlab-pygments==0.2.2
jupyterlab-server==2.14.0
jupytext==1.13.8
keyring==23.5.1
librosa==0.9.1
livereload==2.6.3
llvmlite==0.38.1
markdown-it-py==2.1.0
MarkupSafe==2.1.1
matplotlib-inline==0.1.3
mdit-py-plugins==0.3.0
mdurl==0.1.1
mistune==0.8.4
mypy-extensions==0.4.3
myst-nb==0.15.0
myst-parser==0.17.2
nbclassic==0.3.7
nbclient==0.5.13
nbconvert==6.5.0
nbformat==5.4.0
nest-asyncio==1.5.5
notebook==6.4.11
notebook-shim==0.1.0
numba==0.55.2
numpy==1.22.4
packaging==21.3
pandas==1.4.2
pandera==0.11.0
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
pkginfo==1.8.2
pluggy==1.0.0
pooch==1.6.0
prometheus-client==0.14.1
prompt-toolkit==3.0.29
psutil==5.9.1
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
pyarrow==8.0.0
pycparser==2.21
pydantic==1.9.1
pydata-sphinx-theme==0.8.1
Pygments==2.12.0
pyparsing==3.0.9
pyprojroot==0.2.0
pyrsistent==0.18.1
pytest==7.1.2
pytest-cov==3.0.0
python-dateutil==2.8.2
pytz==2022.1
PyYAML==6.0
pyzmq==23.0.0
readme-renderer==35.0
requests==2.27.1
requests-toolbelt==0.9.1
resampy==0.2.2
rfc3986==2.0.0
rich==12.4.4
scikit-learn==1.1.1
scipy==1.8.1
SecretStorage==3.3.2
Send2Trash==1.8.0
six==1.16.0
sniffio==1.2.0
snowballstemmer==2.2.0
SoundFile==0.10.3.post1
soupsieve==2.3.2.post1
Sphinx==4.5.0
sphinx-autobuild==2021.3.14
sphinx-book-theme==0.3.2
sphinx-copybutton==0.5.0
sphinx-tabs==3.3.1
sphinx-togglebutton==0.3.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxext-opengraph==0.6.3
SQLAlchemy==1.4.36
stack-data==0.2.0
tabulate==0.8.9
terminado==0.15.0
threadpoolctl==3.1.0
tinycss2==1.1.1
toml==0.10.2
tomli==2.0.1
tomli_w==1.0.0
tornado==6.1
traitlets==5.2.1.post0
twine==4.0.0
typing-inspect==0.7.1
typing_extensions==4.2.0
urllib3==1.26.9
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.3.2
wrapt==1.14.1
zipp==3.8.0
welcome[bot] commented 2 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

Morikko commented 1 year ago

Maybe * is interpreted by the terminal. As echo ~/* would list everything in your home.

In your case, sphinx-autobuild --ignore doc/_build/jupyter_execute/*.ipynb doc doc/_build/html could become sphinx-autobuild --ignore doc/_build/jupyter_execute/file1.ipynb doc/_build/jupyter_execute/file2.ipynb doc doc/_build/html.

As a result it would change the positional arguments:

positional arguments:
  sourcedir             source directory
  outdir                output directory for built documentation
  filenames             specific files to rebuild on each run (default: None)

And doc/_build/html is used as filenames.

To avoid that, you can wrap it in ' so that the terminal won't interpret it: sphinx-autobuild --ignore 'doc/_build/jupyter_execute/*.ipynb' doc doc/_build/html.