How do I resolve the conflict between OptionParser and sphinx-build in a large project?

I have a large Python project with many external libraries that I don’t want to touch, and I want to generate documentation with sphinx. My problem is that whenever I execute "make html" I get this error:

... usage: sphinx-build [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: sphinx-build --help [cmd1 cmd2 ...] or: sphinx-build --help-commands or: sphinx-build cmd --help error: option -b not recognized make: *** [html] Fehler 1 

I already realized that this problem occurs when some directories that I want to document have OptionParser ( Can OptionParser conflict with sphinx? ). In fact, I have many scripts that use OptionParser in these directories and do not wrap it if __name__ == "__main__": ... My question is:

How can I create documentation without touching any of these scenarios?

Is there any way to exclude these files / paths? I already tried exclude_patterns in my conf.py, but that didn't work. I do not know why. Is there any way to catch this error?

Update

The problem was in the setup.py in the tree processed by autodoc .

+2
source share

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


All Articles