Search code examples
pythonpython-sphinxread-the-docs

How to remove doctest flag when readthedocs build?


I've published my Python package and hosted the documentation on readthedocs.

I want to know how to remove doctest flags (e.g. doctest: +ELLIPSIS) from the documentation:

https://camphr.readthedocs.io/en/doc-doctest/

When I built the document in my local machine (make html), the flags was properly removed.


Solution

  • I found a solution.

    Read-the-docs installs sphinx<2 by default, which has a bug for doctest flag (please see the @mzjn comment). Thus I prepared readthedocs.yml:

    ...
    python:
      install:
        - requirements: docs/requirements.txt
    

    and prepared docs/requirements.txt as follows:

    sphinx>=2.2
    

    Now readthedocs installs sphinx>=2.2 and everything works well.