Python Sphinx exclude patterns

2020-04-02 08:18发布

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 ?

2条回答
放我归山
2楼-- · 2020-04-02 08:32

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']
查看更多
不美不萌又怎样
3楼-- · 2020-04-02 08:39

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).

查看更多
登录 后发表回答