diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..2ab48762 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "doc/scipy-sphinx-theme"] + path = doc/scipy-sphinx-theme + url = https://github.com/scipy/scipy-sphinx-theme diff --git a/.travis.yml b/.travis.yml index 77a3ec98..add28760 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,3 +20,7 @@ script: cd dist pip install numpydoc* -v - nosetests numpydoc + - | + cd ../doc + make html + make latexpdf diff --git a/README.rst b/README.rst index 9445cfe3..71748401 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,12 @@ .. image:: https://travis-ci.org/numpy/numpydoc.png?branch=master :target: https://travis-ci.org/numpy/numpydoc/ +.. |docs| image:: https://readthedocs.org/projects/numpydoc/badge/?version=latest + :alt: Documentation Status + :scale: 100% + :target: https://numpydoc.readthedocs.io/en/latest/?badge=latest + + ===================================== numpydoc -- Numpy's Sphinx extensions ===================================== @@ -13,45 +19,8 @@ The ``numpydoc`` extension provides support for the Numpy docstring format in Sphinx, and adds the code description directives ``np:function``, ``np-c:function``, etc. that support the Numpy docstring syntax. -See `A Guide to NumPy/SciPy Documentation `_ -for how to write docs that use this extension. - - -numpydoc -======== +See `numpydoc docstring guide `_ +for how to write docs that use this extension, and the `user guide `_ Numpydoc inserts a hook into Sphinx's autodoc that converts docstrings following the Numpy/Scipy format to a form palatable to Sphinx. - -Options -------- - -The following options can be set in conf.py: - -- ``numpydoc_use_plots``: bool - - Whether to produce ``plot::`` directives for Examples sections that - contain ``import matplotlib``. - -- ``numpydoc_show_class_members``: bool - - Whether to show all members of a class in the Methods and Attributes - sections automatically. - ``True`` by default. - -- ``numpydoc_show_inherited_class_members``: bool - - Whether to show all inherited members of a class in the Methods and Attributes - sections automatically. If it's false, inherited members won't shown. - ``True`` by default. - -- ``numpydoc_class_members_toctree``: bool - - Whether to create a Sphinx table of contents for the lists of class - methods and attributes. If a table of contents is made, Sphinx expects - each entry to have a separate page. - ``True`` by default. - -- ``numpydoc_edit_link``: bool (DEPRECATED -- edit your HTML template instead) - - Whether to insert an edit link after docstrings. diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 00000000..508376e4 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,184 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + -rm -rf auto_examples/ + -rm -rf generated/* + -rm -rf modules/generated/* + +html: + # These two lines make the build a bit more lengthy, and the + # the embedding of images more robust + rm -rf $(BUILDDIR)/html/_images + #rm -rf _build/doctrees/ + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/project-template.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/project-template.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/project-template" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/project-template" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 00000000..be3ed6f2 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,265 @@ +# -*- coding: utf-8 -*- +# +# project-template documentation build configuration file, created by +# sphinx-quickstart on Mon Jan 18 14:44:12 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import re + + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +# for example.py +sys.path.insert(0, os.path.abspath('.')) +# project root +sys.path.insert(0, os.path.abspath('..')) + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.pngmath', + 'sphinx.ext.todo', + 'numpydoc', + 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'numpydoc' +copyright = u'2017, numpydoc maintainers' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. + +import numpydoc +# version = .__version__ +# The full version, including alpha/beta/rc tags. +release = numpydoc.__version__ +version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', numpydoc.__version__) +version = re.sub(r'(\.dev\d+).*?$', r'\1', version) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build', 'scipy-sphinx-theme'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. + +themedir = os.path.join(os.path.dirname(__file__), 'scipy-sphinx-theme', '_theme') +if not os.path.isdir(themedir): + raise RuntimeError("Get the scipy-sphinx-theme first, " + "via git submodule init && git submodule update") + +html_theme = 'scipy' +html_theme_path = [themedir] + +if 'scipyorg' in tags: + # Build for the scipy.org website + html_theme_options = { + "edit_link": True, + "sidebar": "right", + "scipy_org_logo": True, + "rootlinks": [("http://scipy.org/", "Scipy.org"), + ("http://docs.scipy.org/", "Docs")] + } +else: + # Default build + html_theme_options = { + "edit_link": False, + "sidebar": "left", + "scipy_org_logo": False, + "rootlinks": [] + } + html_sidebars = {} + +html_title = "%s v%s Manual" % (project, version) +html_static_path = ['_static'] +html_last_updated_fmt = '%b %d, %Y' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'project-templatedoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # 'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', '.tex', u'numpydoc Documentation', + u'Numpydoc maintainers', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + 'python': ('http://docs.python.org/', None), + 'scikit-learn': ('http://scikit-learn.org/stable/', None), +} diff --git a/doc/example.py b/doc/example.py new file mode 100644 index 00000000..425c8928 --- /dev/null +++ b/doc/example.py @@ -0,0 +1,122 @@ +"""This is the docstring for the example.py module. Modules names should +have short, all-lowercase names. The module name may have underscores if +this improves readability. + +Every module should have a docstring at the very top of the file. The +module's docstring may extend over multiple lines. If your docstring does +extend over multiple lines, the closing three quotation marks must be on +a line by itself, preferably preceded by a blank line. + +""" +from __future__ import division, absolute_import, print_function + +import os # standard library imports first + +# Do NOT import using *, e.g. from numpy import * +# +# Import the module using +# +# import numpy +# +# instead or import individual functions as needed, e.g +# +# from numpy import array, zeros +# +# If you prefer the use of abbreviated module names, we suggest the +# convention used by NumPy itself:: + +import numpy as np +import matplotlib as mpl +import matplotlib.pyplot as plt + +# These abbreviated names are not to be used in docstrings; users must +# be able to paste and execute docstrings after importing only the +# numpy module itself, unabbreviated. + + +def foo(var1, var2, long_var_name='hi'): + r"""A one-line summary that does not use variable names or the + function name. + + Several sentences providing an extended description. Refer to + variables using back-ticks, e.g. `var`. + + Parameters + ---------- + var1 : array_like + Array_like means all those objects -- lists, nested lists, etc. -- + that can be converted to an array. We can also refer to + variables like `var1`. + var2 : int + The type above can either refer to an actual Python type + (e.g. ``int``), or describe the type of the variable in more + detail, e.g. ``(N,) ndarray`` or ``array_like``. + long_var_name : {'hi', 'ho'}, optional + Choices in brackets, default first when optional. + + Returns + ------- + type + Explanation of anonymous return value of type ``type``. + describe : type + Explanation of return value named `describe`. + out : type + Explanation of `out`. + + Other Parameters + ---------------- + only_seldom_used_keywords : type + Explanation + common_parameters_listed_above : type + Explanation + + Raises + ------ + BadException + Because you shouldn't have done that. + + See Also + -------- + otherfunc : relationship (optional) + newfunc : Relationship (optional), which could be fairly long, in which + case the line wraps here. + thirdfunc, fourthfunc, fifthfunc + + Notes + ----- + Notes about the implementation algorithm (if needed). + + This can have multiple paragraphs. + + You may include some math: + + .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n} + + And even use a greek symbol like :math:`omega` inline. + + References + ---------- + Cite the relevant literature, e.g. [1]_. You may also cite these + references in the notes section above. + + .. [1] O. McNoleg, "The integration of GIS, remote sensing, + expert systems and adaptive co-kriging for environmental habitat + modelling of the Highland Haggis using object-oriented, fuzzy-logic + and neural-network techniques," Computers & Geosciences, vol. 22, + pp. 585-588, 1996. + + Examples + -------- + These are written in doctest format, and should illustrate how to + use the function. + + >>> a = [1, 2, 3] + >>> print [x + 3 for x in a] + [4, 5, 6] + >>> print "a\n\nb" + a + b + + """ + + pass diff --git a/doc/example.rst b/doc/example.rst new file mode 100644 index 00000000..ae0f25d9 --- /dev/null +++ b/doc/example.rst @@ -0,0 +1,19 @@ + +.. _example: + +======= +Example +======= + +Source +====== + +.. literalinclude:: example.py + :caption: `example.py `_ + :language: python + +Rendered +======== + +.. automodule:: example + :members: diff --git a/doc/format.rst b/doc/format.rst new file mode 100644 index 00000000..b29bbaf4 --- /dev/null +++ b/doc/format.rst @@ -0,0 +1,628 @@ + +.. _format: + +======================== +numpydoc docstring guide +======================== + +.. Contents:: + +This document describes the syntax and best practices for docstrings used with +the numpydoc extension for `Sphinx `__. + +.. Note:: + + For an accompanying example, see :ref:`example.py`. + + Some features described in this document require a recent version of + ``numpydoc``. For example, the **Yields** section was added in + ``numpydoc`` 0.6. + +Overview +-------- +We mostly follow the standard Python style conventions as described here: + * `Style Guide for C Code `_ + * `Style Guide for Python Code `_ + * `Docstring Conventions `_ + +Additional PEPs of interest regarding documentation of code: + * `Docstring Processing Framework `_ + * `Docutils Design Specification `_ + +Use a code checker: + * `pylint `_ + * `pyflakes `_ + * `pep8.py `_ + * `flake8 `_ + * `vim-flake8 `_ plugin for + automatically checking syntax and style with flake8 + +Import conventions +------------------ +The following import conventions are used throughout the NumPy source +and documentation:: + + import numpy as np + import matplotlib as mpl + import matplotlib.pyplot as plt + +Do not abbreviate ``scipy``. There is no motivating use case to +abbreviate it in the real world, so we avoid it in the documentation +to avoid confusion. + +Docstring Standard +------------------ +A documentation string (docstring) is a string that describes a module, +function, class, or method definition. The docstring is a special attribute +of the object (``object.__doc__``) and, for consistency, is surrounded by +triple double quotes, i.e.:: + + """This is the form of a docstring. + + It can be spread over several lines. + + """ + +NumPy, SciPy_, and the scikits follow a common convention for +docstrings that provides for consistency, while also allowing our +toolchain to produce well-formatted reference guides. This document +describes the current community consensus for such a standard. If you +have suggestions for improvements, post them on the `numpy-discussion +list`_. + +Our docstring standard uses `re-structured text (reST) +`_ syntax and is rendered +using Sphinx_ (a pre-processor that understands the particular +documentation style we are using). While a rich set of +markup is available, we limit ourselves to a very basic subset, in +order to provide docstrings that are easy to read on text-only +terminals. + +A guiding principle is that human readers of the text are given +precedence over contorting docstrings so our tools produce nice +output. Rather than sacrificing the readability of the docstrings, we +have written pre-processors to assist Sphinx_ in its task. + +The length of docstring lines should be kept to 75 characters to +facilitate reading the docstrings in text terminals. + +Sections +-------- +The sections of the docstring are: + +1. **Short summary** + + A one-line summary that does not use variable names or the function + name, e.g. + + :: + + def add(a, b): + """The sum of two numbers. + + """ + + The function signature is normally found by introspection and + displayed by the help function. For some functions (notably those + written in C) the signature is not available, so we have to specify + it as the first line of the docstring:: + + """ + add(a, b) + + The sum of two numbers. + + """ + +2. **Deprecation warning** + + A section (use if applicable) to warn users that the object is deprecated. + Section contents should include: + + * In what NumPy version the object was deprecated, and when it will be + removed. + + * Reason for deprecation if this is useful information (e.g., object + is superseded, duplicates functionality found elsewhere, etc.). + + * New recommended way of obtaining the same functionality. + + This section should use the note Sphinx directive instead of an + underlined section header. + + :: + + .. note:: Deprecated in NumPy 1.6.0 + `ndobj_old` will be removed in NumPy 2.0.0, it is replaced by + `ndobj_new` because the latter works also with array subclasses. + +3. **Extended Summary** + + A few sentences giving an extended description. This section + should be used to clarify *functionality*, not to discuss + implementation detail or background theory, which should rather be + explored in the **Notes** section below. You may refer to the + parameters and the function name, but parameter descriptions still + belong in the **Parameters** section. + +4. **Parameters** + + Description of the function arguments, keywords and their + respective types. + + :: + + Parameters + ---------- + x : type + Description of parameter `x`. + y + Description of parameter `y` (with type not specified) + + Enclose variables in single backticks. The colon must be preceded + by a space, or omitted if the type is absent. + + For the parameter types, be as precise as possible. Below are a + few examples of parameters and their types. + + :: + + Parameters + ---------- + filename : str + copy : bool + dtype : data-type + iterable : iterable object + shape : int or tuple of int + files : list of str + + If it is not necessary to specify a keyword argument, use + ``optional``:: + + x : int, optional + + Optional keyword parameters have default values, which are + displayed as part of the function signature. They can also be + detailed in the description:: + + Description of parameter `x` (the default is -1, which implies summation + over all axes). + + When a parameter can only assume one of a fixed set of values, + those values can be listed in braces, with the default appearing first:: + + order : {'C', 'F', 'A'} + Description of `order`. + + When two or more input parameters have exactly the same type, shape and + description, they can be combined:: + + x1, x2 : array_like + Input arrays, description of `x1`, `x2`. + +5. **Returns** + + Explanation of the returned values and their types. Similar to the + **Parameters** section, except the name of each return value is optional. + The type of each return value is always required:: + + Returns + ------- + int + Description of anonymous integer return value. + + If both the name and type are specified, the **Returns** section takes the + same form as the **Parameters** section:: + + Returns + ------- + err_code : int + Non-zero value indicates error code, or zero on success. + err_msg : str or None + Human readable error message, or None on success. + +6. **Yields** + + Explanation of the yielded values and their types. This is relevant to + generators only. Similar to the **Returns** section in that the name of + each value is optional, but the type of each value is always required:: + + Yields + ------ + int + Description of the anonymous integer return value. + + If both the name and type are specified, the **Yields** section takes the + same form as the **Returns** section:: + + Yields + ------ + err_code : int + Non-zero value indicates error code, or zero on success. + err_msg : str or None + Human readable error message, or None on success. + + Support for the **Yields** section was added in `numpydoc + `_ version 0.6. + +7. **Other Parameters** + + An optional section used to describe infrequently used parameters. + It should only be used if a function has a large number of keyword + parameters, to prevent cluttering the **Parameters** section. + +8. **Raises** + + An optional section detailing which errors get raised and under + what conditions:: + + Raises + ------ + LinAlgException + If the matrix is not numerically invertible. + + This section should be used judiciously, i.e., only for errors + that are non-obvious or have a large chance of getting raised. + +9. **See Also** + + An optional section used to refer to related code. This section + can be very useful, but should be used judiciously. The goal is to + direct users to other functions they may not be aware of, or have + easy means of discovering (by looking at the module docstring, for + example). Routines whose docstrings further explain parameters + used by this function are good candidates. + + As an example, for ``numpy.mean`` we would have:: + + See Also + -------- + average : Weighted average + + When referring to functions in the same sub-module, no prefix is + needed, and the tree is searched upwards for a match. + + Prefix functions from other sub-modules appropriately. E.g., + whilst documenting the ``random`` module, refer to a function in + ``fft`` by + + :: + + fft.fft2 : 2-D fast discrete Fourier transform + + When referring to an entirely different module:: + + scipy.random.norm : Random variates, PDFs, etc. + + Functions may be listed without descriptions, and this is + preferable if the functionality is clear from the function name:: + + See Also + -------- + func_a : Function a with its description. + func_b, func_c_, func_d + func_e + +10. **Notes** + + An optional section that provides additional information about the + code, possibly including a discussion of the algorithm. This + section may include mathematical equations, written in + `LaTeX `_ format:: + + The FFT is a fast implementation of the discrete Fourier transform: + + .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n} + + Equations can also be typeset underneath the math directive:: + + The discrete-time Fourier time-convolution property states that + + .. math:: + + x(n) * y(n) \Leftrightarrow X(e^{j\omega } )Y(e^{j\omega } )\\ + another equation here + + Math can furthermore be used inline, i.e. + + :: + + The value of :math:`\omega` is larger than 5. + + Variable names are displayed in typewriter font, obtained by using + ``\mathtt{var}``:: + + We square the input parameter `alpha` to obtain + :math:`\mathtt{alpha}^2`. + + Note that LaTeX is not particularly easy to read, so use equations + sparingly. + + Images are allowed, but should not be central to the explanation; + users viewing the docstring as text must be able to comprehend its + meaning without resorting to an image viewer. These additional + illustrations are included using:: + + .. image:: filename + + where filename is a path relative to the reference guide source + directory. + +11. **References** + + References cited in the **notes** section may be listed here, + e.g. if you cited the article below using the text ``[1]_``, + include it as in the list as follows:: + + .. [1] O. McNoleg, "The integration of GIS, remote sensing, + expert systems and adaptive co-kriging for environmental habitat + modelling of the Highland Haggis using object-oriented, fuzzy-logic + and neural-network techniques," Computers & Geosciences, vol. 22, + pp. 585-588, 1996. + + which renders as + + .. [1] O. McNoleg, "The integration of GIS, remote sensing, + expert systems and adaptive co-kriging for environmental habitat + modelling of the Highland Haggis using object-oriented, fuzzy-logic + and neural-network techniques," Computers & Geosciences, vol. 22, + pp. 585-588, 1996. + + Referencing sources of a temporary nature, like web pages, is + discouraged. References are meant to augment the docstring, but + should not be required to understand it. References are numbered, starting + from one, in the order in which they are cited. + +12. **Examples** + + An optional section for examples, using the `doctest + `_ format. + This section is meant to illustrate usage, not to provide a + testing framework -- for that, use the ``tests/`` directory. + While optional, this section is very strongly encouraged. + + When multiple examples are provided, they should be separated by + blank lines. Comments explaining the examples should have blank + lines both above and below them:: + + >>> np.add(1, 2) + 3 + + Comment explaining the second example + + >>> np.add([1, 2], [3, 4]) + array([4, 6]) + + For tests with a result that is random or platform-dependent, mark the + output as such:: + + >>> import numpy.random + >>> np.random.rand(2) + array([ 0.35773152, 0.38568979]) #random + + You can run examples as doctests using:: + + >>> np.test(doctests=True) + >>> np.linalg.test(doctests=True) # for a single module + + In IPython it is also possible to run individual examples simply by + copy-pasting them in doctest mode:: + + In [1]: %doctest_mode + Exception reporting mode: Plain + Doctest mode is: ON + >>> %paste + import numpy.random + np.random.rand(2) + ## -- End pasted text -- + array([ 0.8519522 , 0.15492887]) + + + It is not necessary to use the doctest markup ```` to + indicate empty lines in the output. Note that the option to run + the examples through ``numpy.test`` is provided for checking if the + examples work, not for making the examples part of the testing framework. + + The examples may assume that ``import numpy as np`` is executed before + the example code in *numpy*. Additional examples may make use of + *matplotlib* for plotting, but should import it explicitly, e.g., + ``import matplotlib.pyplot as plt``. All other imports, including the + demonstrated function, must be explicit. + + +Documenting classes +------------------- + +Class docstring +``````````````` +Use the same sections as outlined above (all except ``Returns`` are +applicable). The constructor (``__init__``) should also be documented +here, the **Parameters** section of the docstring details the constructors +parameters. + +An **Attributes** section, located below the **Parameters** section, +may be used to describe non-method attributes of the class:: + + Attributes + ---------- + x : float + The X coordinate. + y : float + The Y coordinate. + +Attributes that are properties and have their own docstrings can be +simply listed by name:: + + Attributes + ---------- + real + imag + x : float + The X coordinate + y : float + The Y coordinate + +In general, it is not necessary to list class methods. Those that are +not part of the public API have names that start with an underscore. +In some cases, however, a class may have a great many methods, of +which only a few are relevant (e.g., subclasses of ndarray). Then, it +becomes useful to have an additional **Methods** section:: + + class Photo(ndarray): + """ + Array with associated photographic information. + + ... + + Attributes + ---------- + exposure : float + Exposure in seconds. + + Methods + ------- + colorspace(c='rgb') + Represent the photo in the given colorspace. + gamma(n=1.0) + Change the photo's gamma exposure. + + """ + +If it is necessary to explain a private method (use with care!), it can +be referred to in the **Extended Summary** or the **Notes** section. +Do not list private methods in the **methods** section. + +Note that `self` is *not* listed as the first parameter of methods. + +Method docstrings +````````````````` +Document these as you would any other function. Do not include +``self`` in the list of parameters. If a method has an equivalent function +(which is the case for many ndarray methods for example), the function +docstring should contain the detailed documentation, and the method docstring +should refer to it. Only put brief summary and **See Also** sections in the +method docstring. The method should use a **Returns** or **Yields** section, +as appropriate. + + +Documenting class instances +--------------------------- +Instances of classes that are part of the NumPy API (for example `np.r_` +`np,c_`, `np.index_exp`, etc.) may require some care. To give these +instances a useful docstring, we do the following: + +* Single instance: If only a single instance of a class is exposed, + document the class. Examples can use the instance name. + +* Multiple instances: If multiple instances are exposed, docstrings + for each instance are written and assigned to the instances' + ``__doc__`` attributes at run time. The class is documented as usual, and + the exposed instances can be mentioned in the **Notes** and **See Also** + sections. + + +Documenting generators +---------------------- +Generators should be documented just as functions are documented. The +only difference is that one should use the **Yields** section instead +of the **Returns** section. Support for the **Yields** section was added in +`numpydoc `_ version 0.6. + + +Documenting constants +--------------------- +Use the same sections as outlined for functions where applicable:: + + 1. summary + 2. extended summary (optional) + 3. see also (optional) + 4. references (optional) + 5. examples (optional) + +Docstrings for constants will not be visible in text terminals +(constants are of immutable type, so docstrings can not be assigned +to them like for for class instances), but will appear in the +documentation built with Sphinx. + + +Documenting modules +------------------- +Each module should have a docstring with at least a summary line. Other +sections are optional, and should be used in the same order as for documenting +functions when they are appropriate:: + + 1. summary + 2. extended summary + 3. routine listings + 4. see also + 5. notes + 6. references + 7. examples + +Routine listings are encouraged, especially for large modules, for which it is +hard to get a good overview of all functionality provided by looking at the +source file(s) or the ``__all__`` dict. + +Note that license and author info, while often included in source files, do not +belong in docstrings. + + +Other points to keep in mind +---------------------------- +* Equations : as discussed in the **Notes** section above, LaTeX formatting + should be kept to a minimum. Often it's possible to show equations as + Python code or pseudo-code instead, which is much more readable in a + terminal. For inline display use double backticks (like ``y = np.sin(x)``). + For display with blank lines above and below, use a double colon and indent + the code, like:: + + end of previous sentence:: + + y = np.sin(x) + +* Notes and Warnings : If there are points in the docstring that deserve + special emphasis, the reST directives for a note or warning can be used + in the vicinity of the context of the warning (inside a section). Syntax:: + + .. warning:: Warning text. + + .. note:: Note text. + + Use these sparingly, as they do not look very good in text terminals + and are not often necessary. One situation in which a warning can + be useful is for marking a known bug that is not yet fixed. + +* array_like : For functions that take arguments which can have not only + a type `ndarray`, but also types that can be converted to an ndarray + (i.e. scalar types, sequence types), those arguments can be documented + with type `array_like`. + +Common reST concepts +-------------------- +For paragraphs, indentation is significant and indicates indentation in the +output. New paragraphs are marked with a blank line. + +Use ``*italics*``, ``**bold**`` and ````monospace```` if needed in any +explanations +(but not for variable names and doctest code or multi-line code). +Variable, module, function, and class names should be written between +single back-ticks (```numpy```). + +A more extensive example of reST markup can be found in `this example +document `_; +the `quick reference +`_ is +useful while editing. + +Line spacing and indentation are significant and should be carefully +followed. + +Conclusion +---------- + +This document itself was written in ReStructuredText. +:ref:`An example ` of the format shown here is available. + +.. _SciPy: http://www.scipy.org +.. _numpy-discussion list: http://scipy.org/scipylib/mailing-lists.html +.. _Sphinx: http://sphinx.pocoo.org diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 00000000..3947901f --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,22 @@ +.. image:: https://travis-ci.org/numpy/numpydoc.png?branch=master + :target: https://travis-ci.org/numpy/numpydoc/ + +===================================== +numpydoc -- Numpy's Sphinx extensions +===================================== + +Numpy's documentation uses several custom extensions to Sphinx. These +are shipped in this ``numpydoc`` package, in case you want to make use +of them in third-party projects. + +The ``numpydoc`` extension provides support for the Numpy docstring format in +Sphinx, and adds the code description directives ``np:function``, +``np-c:function``, etc. that support the Numpy docstring syntax. + +Documentation +============= + +.. toctree:: + install + format + example diff --git a/doc/install.rst b/doc/install.rst new file mode 100644 index 00000000..2d3e1a08 --- /dev/null +++ b/doc/install.rst @@ -0,0 +1,44 @@ + +============ +Installation +============ + +The extension is available from: + +* `numpydoc on PyPI `_ +* `numpydoc on GitHub `_ + +'numpydoc' should be added to the ``extensions`` option in your Sphinx +``conf.py``. + + +Sphinx config options +===================== + +The following options can be set in your Sphinx ``conf.py``: + +numpydoc_use_plots : bool + Whether to produce ``plot::`` directives for Examples sections that + contain ``import matplotlib``. +numpydoc_show_class_members : bool + Whether to show all members of a class in the Methods and Attributes + sections automatically. + ``True`` by default. +numpydoc_show_inherited_class_members : bool + Whether to show all inherited members of a class in the Methods and Attributes + sections automatically. If it's false, inherited members won't shown. + ``True`` by default. +numpydoc_class_members_toctree : bool + Whether to create a Sphinx table of contents for the lists of class + methods and attributes. If a table of contents is made, Sphinx expects + each entry to have a separate page. + ``True`` by default. +numpydoc_citation_re : str + A regular expression matching citations which + should be mangled to avoid conflicts due to + duplication across the documentation. Defaults + to ``[\w-]+``. +numpydoc_edit_link : bool + .. deprecated: edit your HTML template instead + + Whether to insert an edit link after docstrings. diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..79c1e198 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,242 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\project-template.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\project-template.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/doc/scipy-sphinx-theme b/doc/scipy-sphinx-theme new file mode 160000 index 00000000..bc3b4b83 --- /dev/null +++ b/doc/scipy-sphinx-theme @@ -0,0 +1 @@ +Subproject commit bc3b4b8383d4cd676fe75b7ca8c3e11d6afa8d97 diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index 45883d00..3c7017bc 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -98,6 +98,12 @@ def __str__(self): class NumpyDocString(collections.Mapping): + """Parses a numpydoc string to an abstract representation + + Instances define a mapping from section title to structured data. + + """ + sections = { 'Signature': '', 'Summary': [''],