exclude_patterns not working?

144 views
Skip to first unread message

Carl Gay

unread,
May 15, 2022, 5:40:14 PM5/15/22
to sphinx-users
Hi, I'm trying to build docs for a set of libraries. I have a top-level directory containing the Sphinx Makefile and conf.py generated by sphinx-quickstart and then I have a "libraries" subdirectory in which I have git cloned several libraries. So the structure is like this:

./conf.py
./Makefile
./libraries/
./libraries/lib1/documentation/source/index.rst
./libraries/lib1/documentation/source/other.rst
./libraries/lib2/documentation/source/index.rst
./index.rst   # includes the above index.rst files

My problem is that the libraries may include git submodules that themselves contain documentation, and Sphinx is automatically including those .rst files. I get many warnings like these:

/home/cgay/dylan/workspaces/doc2/libraries/http/submodules/concurrency/documentation/source/index.rst:48: WARNING: Duplicate description of Dylan class concurrency:concurrency:<executor>, other instance in /home/cgay/dylan/workspaces/doc2/libraries/concurrency/documentation/source/index.rst

I've tried using exclude_patterns = ['**/submodules'] and variations on that idea, but I can't seem to make Sphinx ignore the submodules directory.  This seems pretty much exactly what is being done in the example in the Sphinx docs here to ignore **/.svn ... https://www.sphinx-doc.org/en/master/usage/configuration.html?highlight=exclude_pattern#confval-exclude_patterns

Any help appreciated. I'm using Sphinx 4.2.0.

Thanks.
-Carl

Carl Gay

unread,
May 15, 2022, 9:57:47 PM5/15/22
to sphinx-users
Sigh. With some debugging of the Sphinx code I found that exclude_patterns was already being set much further down in the conf.py file. Since this file is just loaded by Python I guess there's no way to really catch this case of user error and give a warning.

(Actually there is...have users call predefined functions that are part of Sphinx, e.g., SetExcludePatterns and/or AppendExcludePatterns, and have those functions do various sanity checks. )

At least this made me upgrade to 4.5.0. :-)

Reply all
Reply to author
Forward
0 new messages