Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Sphinx exclude patterns

I'm generating documentation with Sphinx for project with structure like this :

+ project
|
+- docs
|
+- tests
|
+- workflow -+- definitions -+- <some folders>
             | 
             +- <rest of the project>

I want to exclude tests, and workflow/definition from documentation.

I tried exclude pattern in docs/conf.py

exclude_patterns = ['**/workflow/definitions', 'workflow/definitions', '*workflow/definitions', 'workflow/definitions*', 'workflow/definitions/*', 'workflow/definitions/*.*']

But even though workflow/definitions are still automatically generated.

Could someone show me correct exclude pattern how to ignore 'definitions' folder ?

like image 805
jmt Avatar asked May 05 '17 09:05

jmt


People also ask

What is Intersphinx?

ext. intersphinx – Link to other projects' documentation. New in version 0.5. This extension can generate links to the documentation of objects in external projects, either explicitly through the external role, or as a fallback resolution for any other cross-reference.

What is Toctree Sphinx?

toctree is a Sphinx-defined directive in which you explicitly list documents whose TOCs will be listed out.

Does Sphinx support markdown?

To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.


2 Answers

exclude_patterns can be used to exclude source files (reStructuredText files) from processing by sphinx-build.

exclude_patterns has no effect when using sphinx-apidoc to generate reStructuredText files from Python modules (but you can tell sphinx-apidoc that certain pathnames should be excluded from the generation).

like image 70
mzjn Avatar answered Sep 22 '22 11:09

mzjn


Docs for exclude_patterns indicate that 'workflow/definitions' should ignore that directory, assuming that the source files all end with .rst.

You can configure the source file suffices as a list:

source_suffix = ['.rst', '.txt']
like image 45
Steve Piercy Avatar answered Sep 21 '22 11:09

Steve Piercy