summaryrefslogtreecommitdiff
path: root/doc/tutorial.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tutorial.rst')
-rw-r--r--doc/tutorial.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/tutorial.rst b/doc/tutorial.rst
index 8e949d4c..cae4c8db 100644
--- a/doc/tutorial.rst
+++ b/doc/tutorial.rst
@@ -245,6 +245,15 @@ autodoc needs to import your modules in order to extract the docstrings.
Therefore, you must add the appropriate path to :py:data:`sys.path` in your
:file:`conf.py`.
+.. warning::
+
+ :mod:`~sphinx.ext.autodoc` **imports** the modules to be documented. 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.
+
|more| See :mod:`sphinx.ext.autodoc` for the complete description of the
features of autodoc.