Sphinx Documentation and Auto-Pass

I create my sphinx document for a django project as follows:

sphinx-apidoc app -o docs/source/app --force 

Now it includes all southern migrations that I do not want to have in my documentation. Now I tried to exclude them as follows:

 conf.py: def skip_migrations(app, what, name, obj, skip, options): return skip or (what == 'module' and name.find('Migration') != -1)\ or str(obj).find('migrations') != -1 def setup(app): app.connect('autodoc-skip-member', skip_migrations) 

Now they are no longer documented, but are still listed in the modules. How can I exclude them?

+6
source share
2 answers

You can exclude the first files created for migration by adding them to exclude_pattern in the conf.py file:

 exclude_patterns = ["**/*.migrations.rst",] 
+3
source

Just don't create .rst files with sphinx-apidoc in the first place:

 sphinx-apidoc app -o docs/source/app --force */migrations/* 

Templates added after the module name are understood as excluded paths.

0
source

Source: https://habr.com/ru/post/944509/


All Articles