sphinx-build¶
概要¶
sphinx-build [options] <sourcedir> <outputdir> [filenames ...]
説明¶
sphinx-build generates documentation from the files in
<sourcedir>
and places it in the <outputdir>
.
sphinx-build は設定を <sourcedir>/conf.py
から探します。 sphinx-quickstart(1) は conf.py
を含む、生成されたテンプレートファイルに使われます。
sphinx-build can create documentation in different formats. A format is selected by specifying the builder name on the command line; it defaults to HTML. Builders can also perform other tasks related to documentation processing. For a list of available builders, refer to Builders.
デフォルトでは更新されたファイルだけがビルドされます。個々のファイルを指定すると、その選択されたファイルだけが出力されます。
オプション¶
- -M buildername¶
Select a builder, using the make-mode. See Builders for a list of all of Sphinx's built-in builders. Extensions can add their own builders.
重要
Sphinx only recognizes the
-M
option if it is used first, along with the source and output directories, before any other options are passed. For example:sphinx-build -M html ./source ./build --fail-on-warning
The make-mode provides the same build functionality as a default Makefile or Make.bat, and provides the following additional build pipelines:
- latexpdf
Build LaTeX files and run them through pdflatex, or as per
latex_engine
setting. Iflanguage
is set to'ja'
, will use automatically the platex/dvipdfmx latex to PDF pipeline.- info
Build Texinfo files and run them through makeinfo.
注釈
The default output directory locations when using make-mode differ from the defaults when using
-b
.doctrees are saved to
<outputdir>/doctrees
output files are saved to
<outputdir>/<builder name>
Added in version 1.2.1.
- -b buildername, --builder buildername¶
Selects a builder.
See Builders for a list of all of Sphinx's built-in builders. Extensions can add their own builders.
バージョン 7.3 で変更: Add
--builder
long option.
- -a, --write-all¶
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.)
注釈
This option does not re-read source files. To read and re-process every file, use
--fresh-env
instead.バージョン 7.3 で変更: Add
--write-all
long option.
- -E, --fresh-env¶
保存されている 環境 を使用しないで、完全に再構築する場合に利用します。環境にはクロスリファレンスの構造を保持しています。デフォルトでは新規に作成されたり、最後に実行してから変更のあったソースファイルだけを読み込んで、パースします。
バージョン 7.3 で変更: Add
--fresh-env
long option.
- -t tag, --tag tag¶
Define the tag tag. This is relevant for
only
directives that include their content only if certain tags are set. See including content based on tags for further detail.Added in version 0.6.
バージョン 7.3 で変更: Add
--tag
long option.
- -d path, --doctree-dir path¶
Sphinxは出力ファイルに書き込む前に、すべてのソースファイルを読み込みパースしなければならないため、パースされたソースファイルは "doctree pickle"としてキャッシュされます。通常は、これらのファイルはビルドディレクトリの下の
.doctrees
と呼ばれるディレクトリに置かれます。このオプションを指定すると、キャッシュディレクトリを違う場所に設定できます(doctreeはすべてのビルダーで共有されます)。バージョン 7.3 で変更: Add
--doctree-dir
long option.
- -j N, --jobs N¶
Distribute the build over N processes in parallel, to make building on multiprocessor machines more effective. This feature only works on systems supporting "fork". Windows is not supported. Note that not all parts and not all builders of Sphinx can be parallelized. If
auto
argument is given, Sphinx uses the number of CPUs as N. Defaults to 1.Added in version 1.2: このオプションが 実験的 な機能であることに注意して下さい。
バージョン 1.7 で変更: Support
auto
argument.バージョン 6.2 で変更: Add
--jobs
long option.
- -c path, --conf-dir path¶
ソースディレクトリ以下の
conf.py
ではなく、オプションで指定されたコンフィグレーションディレクトリ以下の設定ファイルを利用するようにします。ただし、さまざまな他のファイル、パスなど、設定値で与えられたものに関しては、コンフィグレーションディレクトリからの相対パスで探索されることになるため、その状況になってもファイルがきちんと読めるようにしておく必要があります。Added in version 0.3.
バージョン 7.3 で変更: Add
--conf-dir
long option.
- -C, --isolated¶
Don't look for a configuration file; only take options via the
--define
option.Added in version 0.5.
バージョン 7.3 で変更: Add
--isolated
long option.
- -D setting=value, --define setting=value¶
conf.py
ファイルで設定されたコンフィグを上書きします。この値は数値、文字列、リスト、もしくはディクショナリ型である必要があります。リストについては、コンマ区切りで次のように要素を分けることができます:
-D html_theme_path=path1,path2
.ディクショナリ型の値については、名前とキーを次のように与えます:
-D latex_elements.docclass=scrartcl
.boolean型の値には、
0
もしくは1
を使って下さい。バージョン 0.6 で変更: 値に辞書型を指定出来るようになりました。
バージョン 1.3 で変更: 値にリスト型を指定出来るようになりました。
バージョン 7.3 で変更: Add
--define
long option.
- -A name=value, --html-define name=value¶
HTMLテンプレートの中の name を value に設定します。
Added in version 0.5.
バージョン 7.3 で変更: Add
--html-define
long option.
- -n, --nitpicky¶
Run in nitpicky 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".バージョン 7.3 で変更: Add
--nitpicky
long option.
- -N, --no-color¶
カラー出力をしません。
バージョン 1.6 で変更: Add
--no-color
long option.
- --color¶
Emit colored output. Auto-detected by default.
Added in version 1.6.
- -v, --verbose¶
Increase verbosity (log-level). This option can be given up to three times to get more debug logging output. It implies
-T
.Added in version 1.2.
バージョン 7.3 で変更: Add
--verbose
long option.
- -q, --quiet¶
標準出力に何も出力しないようになります。警告やエラーのみが標準エラー出力に書き出されます。
バージョン 7.3 で変更: Add
--quiet
long option.
- -Q, --silent¶
標準出力に何も出力しないようになります。警告も抑制されます。エラーのみが標準エラー出力に書き出されます。
バージョン 7.3 で変更: Add
--silent
long option.
- -w file, --warning-file file¶
警告とエラーを指定されたファイルに書き出されます。なお、標準エラー出力にも同時に出力されます。
バージョン 7.3 で変更: ANSI control sequences are stripped when writing to file.
バージョン 7.3 で変更: Add
--warning-file
long option.
- -W, --fail-on-warning¶
Turn warnings into errors. This means that sphinx-build exits with exit status 1 if any warnings are generated during the build.
バージョン 7.3 で変更: Add
--fail-on-warning
long option.バージョン 8.1 で変更: sphinx-build no longer exits on the first warning, but instead runs the entire build and exits with exit status 1 if any warnings were generated. This behaviour was previously enabled with
--keep-going
.
- --keep-going¶
From Sphinx 8.1,
--keep-going
is always enabled. Previously, it was only applicable whilst using--fail-on-warning
, which by default exited sphinx-build on the first warning. Using--keep-going
runs !sphinx-build to completion and exits with exit status 1 if errors are encountered.Added in version 1.8.
バージョン 8.1 で変更: sphinx-build no longer exits on the first warning, meaning that in effect
--fail-on-warning
is always enabled. The option is retained for compatibility, but may be removed at some later date.
- -T, --show-traceback¶
捕捉されない例外が発生した時、完全なトレースバックを表示します。このオプションがない場合、要約だけが表示され、トレースバックの情報は今後の解析のためにファイルとして保存されます。
Added in version 1.2.
バージョン 7.3 で変更: Add
--show-traceback
long option.
- -P, --pdb¶
(Sphinx自体のデバッグをする人用) キャッチされない例外がビルド中に発生したら、Pythonデバッガの
pdb
を実行します。バージョン 7.3 で変更: Add
--pdb
long option.
- --exception-on-warning¶
Raise an exception when a warning is emitted during the build. This can be useful in combination with
--pdb
to debug warnings.Added in version 8.1.
- -h, --help, --version¶
簡単な使い方やSphinxのバージョンを表示します。
Added 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).
Environment Variables¶
The sphinx-build refers following environment variables:
- MAKE
A path to make command. A command name is also allowed. sphinx-build uses it to invoke sub-build process on make-mode.
Makefile Options
sphinx-quickstart によって作成された Makefile
と make.bat
は通常、 sphinx-build を -b
および -d
オプションだけで実行します。しかし、次のような変数を設定することで、動作をカスタマイズできます。
- PAPER
This sets the
'papersize'
key oflatex_elements
: i.e.PAPER=a4
sets it to'a4paper'
andPAPER=letter
to'letterpaper'
.注釈
Usage of this environment variable got broken at Sphinx 1.5 as
a4
orletter
ended up as option to LaTeX document in place of the neededa4paper
, resp.letterpaper
. Fixed at 1.7.7.
- SPHINXBUILD
sphinx-build
の代わりに用いるコマンドです。
- BUILDDIR
sphinx-quickstart で選択した以外のビルドディレクトリを使用します。
- SPHINXOPTS
Additional options for sphinx-build. These options can also be set via the shortcut variable O (capital 'o').
- NO_COLOR
When set (regardless of value), sphinx-build will not use color in terminal output.
NO_COLOR
takes precedence overFORCE_COLOR
. See no-color.org for other libraries supporting this community standard.Added in version 4.5.0.
- FORCE_COLOR
When set (regardless of value), sphinx-build will use color in terminal output.
NO_COLOR
takes precedence overFORCE_COLOR
.Added in version 4.5.0.
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=
として、make html
を実行する(Linux/Mac)set PYTHONWARNINGS=
としてmake html
を実行する(Windows)modify your Makefile/make.bat and set the environment variable
参考¶
sphinx-quickstart(1)