Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use sphinx-quickstart in non-interactive mode?

When I run sphinx-quickstart, it asks me a bunch of questions.

> Root path for the documentation [.]:
> Separate source and build directories (y/n) [n]:
> Name prefix for templates and static dir [_]:
> Project name: Foo
> Author name(s): Lone Learner
> Project version: 0.0.1
> Project release [0.0.1]:
> Project language [en]:
> Source file suffix [.rst]:
> Name of your master document (without suffix) [index]:
> Do you want to use the epub builder (y/n) [n]:
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/n) [n]: 
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]: 
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]: 
> coverage: checks for documentation coverage (y/n) [n]: 
> pngmath: include math, rendered as PNG images (y/n) [n]: 
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]: 
> ifconfig: conditional inclusion of content based on config values (y/n) [n]: 
> viewcode: include links to the source code of documented Python objects (y/n) [n]:
> Create Makefile? (y/n) [y]: 
> Create Windows command file? (y/n) [y]:

For most of these questions, I just present enter to accept the defaults.

Here are the only four questions for which I actually provide a manual answer.

> Project name: Foo
> Author name(s): Lone Learner
> Project version: 0.0.1
> autodoc: automatically insert docstrings from modules (y/n) [n]: y

Is there a way to tell sphinx-quickstart to use these four values and use the defaults for every other question. In other words, I want to use sphinx-quickstart in completely non-interactive mode. Is this possible?

like image 685
Lone Learner Avatar asked Dec 27 '15 18:12

Lone Learner


People also ask

How do you run a sphinx document?

Running the buildwhere sourcedir is the source directory, and builddir is the directory in which you want to place the built documentation. The -b option selects a builder; in this example Sphinx will build HTML files. Refer to the sphinx-build man page for all options that sphinx-build supports.


1 Answers

You can use sphinx-quickstart quiet mode with -q or --quiet option

This requires the following options :

  • -p (for project name)
  • -a (author)
  • -v (version)

and you can add --ext-autodoc to automatically insert docstrings

like image 177
Gerard Rozsavolgyi Avatar answered Oct 11 '22 14:10

Gerard Rozsavolgyi