Invocation of sphinx-quickstart

The sphinx-quickstart script generates a Sphinx documentation set. It is called like this:

$ sphinx-quickstart [options] [projectdir]

where projectdir is the Sphinx documentation set directory in which you want to place. If you omit projectdir, files are generated into current directory by default.

The sphinx-quickstart script has several options:

-q, --quiet

Quiet mode that will skips interactive wizard to specify options. This option requires -p, -a and -v options.

-h, --help, --version

Display usage summary or Sphinx version.

Structure options


If specified, separate source and build directories.


Inside the root directory, two more directories will be created; “_templates” for custom HTML templates and “_static” for custom stylesheets and other static files. You can enter another prefix (such as ”.”) to replace the underscore.

Project basic options

-p PROJECT, --project=PROJECT

Project name will be set. (see project).

-a AUTHOR, --author=AUTHOR

Author names. (see copyright).


Version of project. (see version).

-r RELEASE, --release=RELEASE

Release of project. (see release).

-l LANGUAGE, --language=LANGUAGE

Document language. (see language).


Source file suffix. (see source_suffix).


Master document name. (see master_doc).


Use epub.

Extension options


Enable sphinx.ext.autodoc extension.


Enable sphinx.ext.doctest extension.


Enable sphinx.ext.intersphinx extension.


Enable sphinx.ext.todo extension.


Enable sphinx.ext.coverage extension.


Enable sphinx.ext.imgmath extension.


Enable sphinx.ext.mathjax extension.


Enable sphinx.ext.ifconfig extension.


Enable sphinx.ext.viewcode extension.


Enable arbitary extensions.

Makefile and Batchfile creation options

--use-make-mode, --no-use-make-mode

Makefile/make.bat uses (or not use) make-mode. Default is use.

Changed in version 1.5: make-mode is default.

--makefile, --no-makefile

Create (or not create) makefile.

--batchfile, --no-batchfile

Create (or not create) batchfile

New in version 1.3: Add various options for sphinx-quickstart invocation.

Project templating

-t, --templatedir=TEMPLATEDIR

Template directory for template files. You can modify the templates of sphinx project files generated by quickstart. Following Jinja2 template files are allowed:

  • master_doc.rst_t
  • conf.py_t
  • Makefile_t
  • Makefile.new_t
  • make.bat_t
  • make.bat.new_t

In detail, please refer the system template files Sphinx provides. (sphinx/templates/quickstart)


Define a template variable

New in version 1.5: Project templating options for sphinx-quickstart

Invocation of sphinx-build

The sphinx-build script builds a Sphinx documentation set. It is called like this:

$ sphinx-build [options] sourcedir builddir [filenames]

where sourcedir is the source directory, and builddir is the directory in which you want to place the built documentation. Most of the time, you don’t need to specify any filenames.

The sphinx-build script has several options:

-b buildername

The most important option: it selects a builder. The most common builders are:

Build HTML pages. This is the default builder.
Build HTML pages, but with a single directory per document. Makes for prettier URLs (no .html) if served from a webserver.
Build a single HTML with the whole content.
htmlhelp, qthelp, devhelp, epub
Build HTML files with additional information for building a documentation collection in one of these formats.
Build an Apple Help Book. Requires hiutil and codesign, which are not Open Source and presently only available on Mac OS X 10.6 and higher.
Build LaTeX sources that can be compiled to a PDF document using pdflatex.
Build manual pages in groff format for UNIX systems.
Build Texinfo files that can be processed into Info files using makeinfo.
Build plain text files.
Build gettext-style message catalogs (.pot files).
Run all doctests in the documentation, if the doctest extension is enabled.
Check the integrity of all external links.
Build Docutils-native XML files.
Build compact pretty-printed “pseudo-XML” files displaying the internal structure of the intermediate document trees.

See Available builders for a list of all builders shipped with Sphinx. Extensions can add their own builders.


If given, always write all output files. The default is to only write output files for new and changed source files. (This may not apply to all builders.)


Don’t use a saved environment (the structure caching all cross-references), but rebuild it completely. The default is to only read and parse source files that are new or have changed since the last run.

-t tag

Define the tag tag. This is relevant for only directives that only include their content if this tag is set.

New in version 0.6.

-d path

Since Sphinx has to read and parse all source files before it can write an output file, the parsed source files are cached as “doctree pickles”. Normally, these files are put in a directory called .doctrees under the build directory; with this option you can select a different cache directory (the doctrees can be shared between all builders).

-j N

Distribute the build over N processes in parallel, to make building on multiprocessor machines more effective. Note that not all parts and not all builders of Sphinx can be parallelized.

New in version 1.2: This option should be considered experimental.

-c path

Don’t look for the in the source directory, but use the given configuration directory instead. Note that various other files and paths given by configuration values are expected to be relative to the configuration directory, so they will have to be present at this location too.

New in version 0.3.


Don’t look for a configuration file; only take options via the -D option.

New in version 0.5.

-D setting=value

Override a configuration value set in the file. The value must be a number, string, list or dictionary value.

For lists, you can separate elements with a comma like this: -D html_theme_path=path1,path2.

For dictionary values, supply the setting name and key like this: -D latex_elements.docclass=scrartcl.

For boolean values, use 0 or 1 as the value.

Changed in version 0.6: The value can now be a dictionary value.

Changed in version 1.3: The value can now also be a list value.

-A name=value

Make the name assigned to value in the HTML templates.

New in version 0.5.


Run in nit-picky mode. Currently, this generates warnings for all missing references. See the config value nitpick_ignore for a way to exclude some references as “known missing”.


Do not emit colored output.


Increase verbosity (loglevel). This option can be given up to three times to get more debug logging output. It implies -T.

New in version 1.2.


Do not output anything on standard output, only write warnings and errors to standard error.


Do not output anything on standard output, also suppress warnings. Only errors are written to standard error.

-w file

Write warnings (and errors) to the given file, in addition to standard error.


Turn warnings into errors. This means that the build stops at the first warning and sphinx-build exits with exit status 1.


Display the full traceback when an unhandled exception occurs. Otherwise, only a summary is displayed and the traceback information is saved to a file for further analysis.

New in version 1.2.


(Useful for debugging only.) Run the Python debugger, pdb, if an unhandled exception occurs while building.

-h, --help, --version

Display usage summary or Sphinx version.

New in version 1.2.

You can also give one or more filenames on the command line after the source and build directories. Sphinx will then try to build only these output files (and their dependencies).

Makefile options

The Makefile and make.bat files created by sphinx-quickstart usually run sphinx-build only with the -b and -d options. However, they support the following variables to customize behavior:


The value for latex_paper_size.


The command to use instead of sphinx-build.


The build directory to use instead of the one chosen in sphinx-quickstart.


Additional options for sphinx-build.

Deprecation Warnings

If any deprecation warning like RemovedInSphinxXXXWarning are displayed when building a user’s document, some Sphinx extension is using deprecated features. In that case, please report it to author of the extension.

To disable the deprecation warnings, please set PYTHONWARNINGS= environment variable to your environment. For example:

  • PYTHONWARNINGS= make html (Linux/Mac)
  • export PYTHONWARNINGS= and do make html (Linux/Mac)
  • set PYTHONWARNINGS= and do make html (Windows)
  • modify your Makefile/make.bat and set the environment variable

Invocation of sphinx-apidoc

The sphinx-apidoc generates completely automatic API documentation for a Python package. It is called like this:

$ sphinx-apidoc [options] -o outputdir packagedir [pathnames]

where packagedir is the path to the package to document, and outputdir is the directory where the generated sources are placed. Any pathnames given are paths to be excluded ignored during generation.


sphinx-apidoc generates reST files that use sphinx.ext.autodoc to document all found modules. If any modules have side effects on import, these will be executed by autodoc when sphinx-build is run.

If you document scripts (as opposed to library modules), make sure their main routine is protected by a if __name__ == '__main__' condition.

The sphinx-apidoc script has several options:

-o outputdir

Gives the directory in which to place the generated output.

-f, --force

Normally, sphinx-apidoc does not overwrite any files. Use this option to force the overwrite of all files that it generates.

-n, --dry-run

With this option given, no files will be written at all.

-s suffix

This option selects the file name suffix of output files. By default, this is rst.

-d maxdepth

This sets the maximum depth of the table of contents, if one is generated.

-l, --follow-links

This option makes sphinx-apidoc follow symbolic links when recursing the filesystem to discover packages and modules. You may need it if you want to generate documentation from a source directory managed by collective.recipe.omelette. By default, symbolic links are skipped.

New in version 1.2.

-T, --no-toc

This prevents the generation of a table-of-contents file modules.rst. This has no effect when --full is given.

-F, --full

This option makes sphinx-apidoc create a full Sphinx project, using the same mechanism as sphinx-quickstart. Most configuration values are set to default values, but you can influence the most important ones using the following options.


By default sphinx-apidoc processes sys.path searching for modules only. Python 3.3 introduced PEP 420 implicit namespaces that allow module path structures such as foo/bar/ or foo/bar/baz/ (notice that bar and foo are namespaces, not modules).

Specifying this option interprets paths recursively according to PEP-0420.


This option makes sphinx-apidoc put module documentation before submodule documentation.


Append module_path to sys.path.

-H project

Sets the project name to put in generated files (see project).

-A author

Sets the author name(s) to put in generated files (see copyright).

-V version

Sets the project version to put in generated files (see version).

-R release

Sets the project release to put in generated files (see release).