summaryrefslogtreecommitdiff
path: root/doc/invocation.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-03-05 07:45:45 +0100
committerGeorg Brandl <georg@python.org>2014-03-05 07:45:45 +0100
commitef269e262539b273c5bbbf0ab51726e26ef7c615 (patch)
tree87d170b57e025d259e6fb1b434f6886545516ce8 /doc/invocation.rst
parent30799b02fa7b5c4c4269775b90bd59de4d46f802 (diff)
downloadsphinx-ef269e262539b273c5bbbf0ab51726e26ef7c615.tar.gz
Add warnings that autodoc imports the modules.
Diffstat (limited to 'doc/invocation.rst')
-rw-r--r--doc/invocation.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/invocation.rst b/doc/invocation.rst
index 338728b6..654921be 100644
--- a/doc/invocation.rst
+++ b/doc/invocation.rst
@@ -238,6 +238,16 @@ 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.
+.. warning::
+
+ ``sphinx-apidoc`` generates reST files that use :mod:`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 :program:`sphinx-apidoc` script has several options:
.. program:: sphinx-apidoc