How to turn warnings into errors when building sphinx documentation with setuptools?

后端 未结 3 1498
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 15:45

I am using setuptools to build my sphinx documentation of a python project (python setup.py build_sphinx).

As found on, e.g., this site, I have configured t

3条回答
  •  庸人自扰
    2021-02-19 16:31

    If instead, like me, you're using make to build your html docs with Sphinx, then you can do this to turn warnings into errors and cause make to fail:

    make html SPHINXOPTS="-W"
    

    This will cause the build to fail immediately when a warning is encountered. If you add --keep-going then the docs build will still fail but it will run to completion so you can see all the warnings. And -n will invoke the 'nit-picky' option to check for broken links. So I find this useful when building the docs in my CI framework:

    make html SPHINXOPTS="-W --keep-going -n"
    

    See here for a list of options.

提交回复
热议问题