melissawm / sphinx-tags

A tiny Sphinx extension that implements blog-style tags for documentation.
https://sphinx-tags.readthedocs.io/en/latest/
MIT License
44 stars 11 forks source link

Sphinx autobuild keeps reloading automatically without any changes if I include "sphinx_tags" in extensions in conf.py #93

Closed fervand1 closed 7 months ago

fervand1 commented 7 months ago

I tried adding basic tags to my documentation, also having sphinx autobuild running in my terminal but it goes in never ending loop. Is this a known issue?

Python version 3.12, sphinx_tags 0.3.1

Following are the extensions added in my conf.py

extensions = [
    "myst_parser",
    "sphinx.ext.extlinks",
    "sphinx.ext.intersphinx",
    "sphinx_markdown_tables",
    "sphinxcontrib.images",
    "sphinx_design",
    "sphinx_tags",
]

Tags related config

tags_create_tags = True
tags_output_dir = "_tags"
tags_overview_title = "Tags"
tags_extension = ["md", "rst"]

NOTE: If I just do sphinx build and load the static page manually in browser, all works well. I see the tags too

fervand1 commented 7 months ago

It keeps detecting changes in following directory, when I myself didn't do a change and keeps rebuilding the page. Following is the log I see in terminal

[sphinx-autobuild] Detected change: D:\my_docs\_tags\tagindex.md

fervand1 commented 7 months ago

Update: It works fine after I set ignore flag for tags dir

"sphinx-autobuild . _build/html --ignore **/_tags/*"

melissawm commented 7 months ago

Not a known issue, thanks for reporting! I'm not too familiar with the autorebuild option but will try to take a look.

JWCook commented 7 months ago

Looks like you already found the solution, but yes, this is known behavior when using sphinx-autobuild in combination with any extensions that generate additional source files during the build. It's definitely caught me by surprise a couple times! Another common extension you'd need to add ignore patterns for is sphinx-apidoc.

By default sphinx-autobuild watches everything in your docs dir (except the build dir), so: New build -> files created/updated by extension -> change detected by sphinx-autobuild -> new build -> etc.

I can add a note about that to our docs.

fervand1 commented 7 months ago

Thanks for quick response @melissawm @JWCook

@JWCook Thanks for the explanation. A note will definitely benefit the end user, and yes it was not straight forward to figure that out. I initially thought "sphinx-tags" was not compatible anymore with current version of sphinx or other extensions I had in the config and uninstalled it (without realizing build was working fine) but thought of giving it a try again yesterday.