pythonpython-sphinxsphinx-apidoc

overwrite .rst files during Sphinx documentation


Let us say that we have a document structure that looks like the following

.
|____src
| |____abc.py
|____docs

Now we generate documentation with the command:

sphinx-apidoc -F -o docs src

This generates several files within the ./docs/ folder that, including a ./docs/abc.rst, which I can now build using a make html within the ./docs/ folder.

Now, after adding some additional function within ./src/abc.py I want to rebuild the documentation. I try the same things and Sphinx says that the rest file is already present and as a result, it doesn't get updates. I have to manually delete the relevant files before I can update the documentation.

Now the question is, how do I do the entire process without having to resort to deleting the .rst files.


Solution

  • sphinx-apidoc has a --force option for overwriting files.

    See http://www.sphinx-doc.org/en/stable/man/sphinx-apidoc.html#sphinx-apidoc-manual-page.