newBike
newBike

Reputation: 15022

How to custom the configuration of sphinx-quickstart

When I run sphinx-quickstart

It's so annoying to me to show those options

Can I have a default configuration ? without check those options one by one?

Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]:
> 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]:

Upvotes: 2

Views: 693

Answers (3)

user15226715
user15226715

Reputation: 63

As of today the amount of questions was drastically reduced (see this issue) and you can pass the required answers directly as options (see sphinx documentation).

An example would be:

sphinx-quickstart --sep --project="project_1" --author="Harry Potter" --release="1.0" --language="en" docs_directory

Upvotes: 0

cbrun
cbrun

Reputation: 11

I use a custom script (a custom quickstart) to pass default configuration to generate function :

# -*- coding: utf-8 -*-

import re
import sys

from sphinx.quickstart import generate, do_prompt
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    d= {
        'path': '.',
        'sep': True,
        'dot': '_',
        'author': 'C. Brun',
        'version': '1.0',
        'release': '1.0',
        'suffix': '.rst',
        'master': 'index',
        'epub': False,
        'ext_autodoc': False,
        'ext_doctest': False,
        'ext_intersphinx': False,
        'ext_todo': False,
        'ext_coverage': False,
        'ext_pngmath': False,
        'ext_mathiax': False,
        'ext_ifconfig': True,
        'ext_todo': True,
        'ext_viewcode': False,
        'makefile': True,
        'batchfile': False,
    }
    if 'project' not in d:
        print '''
            Nom du projet
        '''
        do_prompt(d, 'project', 'Project Name')
    generate(d) 

Upvotes: 1

wswld
wswld

Reputation: 1238

Basically, what you should consider is to write your own script, that would put everything the way you want it and would not ask you any questions along the way. sphinx-quickstart is a general purpose utility, that should allow for some level of customization. It is also driven towards beginner users, who aren't familiar with the project structure, if you know where to put everything, you can live without sphinx-quickstart. In projects I work on I usually end up creating my own Python/Bash scripts for most actions (init, build, deploy, etc). Hope it helps.

Upvotes: 0

Related Questions