Open peanutfun opened 10 months ago
I would say 'why not' so feel free to open a PR. More generally, it would be good if we could turn specific warnings into errors, but this would require to correctly add types/subtypes to the warnings (which is currently something we lack).
Is your feature request related to a problem? Please describe. Autodoc throws warnings when it cannot import modules it is supposed to document. If the overall Sphinx build succeeds, these modules are then simply missing from the generated documentation. The option
sphinx-build -W
, however, turns all warnings into errors. For a large Sphinx build with a lot of modules, it is unfeasible to have a build without warnings. Without the-W
option, I have to manually inspect each build to see if the modules could be imported and were documented as expected. I would like the option to turn autodoc warnings into errors, and more specifically only warnings about importing modules.Describe the solution you'd like A configuration option
autodoc_module_import_error
. If set toTrue
, module import errors likeWARNING: autodoc: failed to import module 'XYZ'
become errors that stop the Sphinx build.Describe alternatives you've considered
sphinx-build -W
would turn all warnings into errors. But large builds typically throw a lot of other warnings I want to ignore.autodoc_warningiserror
does the opposite of what I want. It gives the option to ignore the errors in casesphinx-build -W
was executed.