Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore some modules in autodoc

I'm trying to use autodoc for selected modules only. I've created a file which includes:

.. automodule:: some.specific.module
   :members:

And it gets generated correctly. Unfortunately autodoc keeps trying to parse other files too (and fails because of import errors). I know I can mock out some modules, but I want a better solution - stop sphinx from looking at them to begin with.

How can I make sure only the requested module is loaded, and not (for example) test.other.module.

like image 643
viraptor Avatar asked Dec 22 '15 05:12

viraptor


1 Answers

So it turned out to be a stupid mistake. Since some tools generate a scaffold for api documentation sources, those files were left laying around and triggered bad imports.

How this was found:

  • sphinx has multiple levels of debug logging which do not normally get activated
  • you can see which lines trigger imports by debug output like
 [autodoc] /path/to/the/doc.rst:158: input:
 .. automodule:: app.module.name
    :members:
like image 74
viraptor Avatar answered Oct 23 '22 18:10

viraptor