source: orange/docs/conf.py @ 11028:009ba5a75e30

Revision 11028:009ba5a75e30, 10.0 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 17 months ago (diff)

Added a common documentation index.

Line 
1# -*- coding: utf-8 -*-
2#
3# reference documentation build configuration file, created by
4# sphinx-quickstart on Wed Nov 17 12:52:23 2010.
5#
6# This file is execfile()d with the current directory set to its containing dir.
7#
8# Note that not all possible configuration values are present in this
9# autogenerated file.
10#
11# All configuration values have a default; values that are commented out
12# serve to show the default.
13
14import imp, inspect, sys, os
15
16#rewrite formatargs function with different defaults
17PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
18
19sys.path.insert(0, PATH)
20import myinspect
21import sphinx.ext.autodoc
22import numpydoc
23sphinx.ext.autodoc.inspect = myinspect
24numpydoc.docscrape.inspect = myinspect
25
26module_setup = imp.load_source('module_setup', os.path.join(PATH, '..', 'setup.py'))
27VERSION = module_setup.VERSION
28AUTHOR = module_setup.AUTHOR
29NAME = module_setup.NAME
30
31TITLE = "%s Documentation v%s" % (NAME, VERSION)
32
33#disable deprecation decorators for the documentation
34os.environ["orange_no_deprecated_members"] = "1"
35
36# If extensions (or modules to document with autodoc) are in another directory,
37# add these directories to sys.path here. If the directory is relative to the
38# documentation root, use os.path.abspath to make it absolute, like shown here.
39sys.path.append(os.path.abspath(os.path.join(PATH, "..")))
40import Orange
41
42# -- General configuration -----------------------------------------------------
43
44# Add any Sphinx extension module names here, as strings. They can be extensions
45# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
46extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'numpydoc']
47
48
49# Numpydoc generates autosummary directives for all undocumented members. Orange documentation only includes documented
50# member, so _str_member_list is modified to return [] where a list of undocumented members is originally returned.
51numpydoc.docscrape_sphinx.SphinxDocString._str_member_list # if numpydoc changes, this line will cause an error
52numpydoc.docscrape_sphinx.SphinxDocString._str_member_list = lambda x, y : []
53
54
55# Add any paths that contain templates here, relative to this directory.
56templates_path = ['_templates']
57
58# The suffix of source filenames.
59source_suffix = '.rst'
60
61# The encoding of source files.
62#source_encoding = 'utf-8'
63
64# The master toctree document.
65master_doc = 'index'
66
67# General information about the project.
68project = TITLE
69copyright = AUTHOR
70
71# The version info for the project you're documenting, acts as replacement for
72# |version| and |release|, also used in various other places throughout the
73# built documents.
74#
75# The short X.Y version.
76version = VERSION
77# The full version, including alpha/beta/rc tags.
78release = VERSION
79
80# The language for content autogenerated by Sphinx. Refer to documentation
81# for a list of supported languages.
82#language = None
83
84# There are two options for replacing |today|: either, you set today to some
85# non-false value, then it is used:
86#today = ''
87# Else, today_fmt is used as the format for a strftime call.
88#today_fmt = '%B %d, %Y'
89
90# List of documents that shouldn't be included in the build.
91#unused_docs = []
92
93# List of directories, relative to source directory, that shouldn't be searched
94# for source files.
95exclude_trees = ['build', 'sphinx-ext']
96
97# The reST default role (used for this markup: `text`) to use for all documents.
98#default_role = None
99
100# If true, '()' will be appended to :func: etc. cross-reference text.
101#add_function_parentheses = True
102
103# If true, the current module name will be prepended to all description
104# unit titles (such as .. function::).
105#add_module_names = True
106
107# If true, sectionauthor and moduleauthor directives will be shown in the
108# output. They are ignored by default.
109#show_authors = False
110
111# The name of the Pygments (syntax highlighting) style to use.
112pygments_style = 'sphinx'
113
114# A list of ignored prefixes for module index sorting.
115#modindex_common_prefix = []
116
117
118# -- Options for HTML output ---------------------------------------------------
119
120# The theme to use for HTML and HTML Help pages.  Major themes that come with
121# Sphinx are currently 'default' and 'sphinxdoc'.
122html_theme = 'orange_theme'
123
124# Theme options are theme-specific and customize the look and feel of a theme
125# further.  For a list of options available for each theme, see the
126# documentation.
127html_theme_options = {"collapsiblesidebar": "false"}
128
129if html_theme == "orange_theme":
130    html_theme_options.update({"orangeheaderfooter": "false"})
131
132# Add any paths that contain custom themes here, relative to this directory.
133html_theme_path = [os.path.join(PATH, "sphinx-ext", "themes")]
134
135# The name for this set of Sphinx documents.  If None, it defaults to
136# "<project> v<release> documentation".
137html_title = TITLE
138
139# A shorter title for the navigation bar.  Default is the same as html_title.
140#html_short_title = None
141
142# The name of an image file (relative to this directory) to place at the top
143# of the sidebar.
144#html_logo = None
145
146# The name of an image file (within the static path) to use as favicon of the
147# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
148# pixels large.
149#html_favicon = None
150
151# Add any paths that contain custom static files (such as style sheets) here,
152# relative to this directory. They are copied after the builtin static files,
153# so a file named "default.css" will overwrite the builtin "default.css".
154html_static_path = []
155
156# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
157# using the given strftime format.
158#html_last_updated_fmt = '%b %d, %Y'
159
160# If true, SmartyPants will be used to convert quotes and dashes to
161# typographically correct entities.
162#html_use_smartypants = True
163
164# Custom sidebar templates, maps document names to template names.
165#html_sidebars = {}
166
167# Additional templates that should be rendered to pages, maps page names to
168# template names.
169#html_additional_pages = {}
170
171# If false, no module index is generated.
172#html_use_modindex = True
173
174# If false, no index is generated.
175#html_use_index = True
176
177# If true, the index is split into individual pages for each letter.
178#html_split_index = False
179
180# If true, links to the reST sources are added to the pages.
181#html_show_sourcelink = True
182
183# If true, an OpenSearch description file will be output, and all pages will
184# contain a <link> tag referring to it.  The value of this option must be the
185# base URL from which the finished HTML is served.
186#html_use_opensearch = ''
187
188# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
189#html_file_suffix = ''
190
191# Output file base name for HTML help builder.
192htmlhelp_basename = 'referencedoc'
193
194
195# -- Options for LaTeX output --------------------------------------------------
196
197# The paper size ('letter' or 'a4').
198#latex_paper_size = 'letter'
199
200# The font size ('10pt', '11pt' or '12pt').
201#latex_font_size = '10pt'
202
203# Grouping the document tree into LaTeX files. List of tuples
204# (source start file, target name, title, author, documentclass [howto/manual]).
205latex_documents = [
206  ('index', 'reference.tex', TITLE,
207   AUTHOR, 'manual'),
208]
209
210# The name of an image file (relative to this directory) to place at the top of
211# the title page.
212#latex_logo = None
213
214# For "manual" documents, if this is true, then toplevel headings are parts,
215# not chapters.
216#latex_use_parts = False
217
218# Additional stuff for the LaTeX preamble.
219#latex_preamble = ''
220
221# Documents to append as an appendix to all manuals.
222#latex_appendices = []
223
224# If false, no module index is generated.
225#latex_use_modindex = True
226
227# -- Options for Epub output ---------------------------------------------------
228
229# Bibliographic Dublin Core info.
230epub_title = TITLE
231epub_author = AUTHOR
232epub_publisher = AUTHOR
233epub_copyright = AUTHOR
234
235# The language of the text. It defaults to the language option
236# or en if the language is not set.
237epub_language = 'en'
238
239# The scheme of the identifier. Typical schemes are ISBN or URL.
240#epub_scheme = ''
241
242# The unique identifier of the text. This can be a ISBN number
243# or the project homepage.
244#epub_identifier = ''
245
246# A unique identification for the text.
247#epub_uid = ''
248
249# HTML files that should be inserted before the pages created by sphinx.
250# The format is a list of tuples containing the path and title.
251#epub_pre_files = []
252
253# HTML files that should be inserted after the pages created by sphinx.
254# The format is a list of tuples containing the path and title.
255#epub_post_files = []
256
257# A list of files that should not be packed into the epub file.
258epub_exclude_files = ["index.html", "genindex.html", "py-modindex.html", "search.html"]
259
260# The depth of the table of contents in toc.ncx.
261#epub_tocdepth = 3
262
263# Allow duplicate toc entries.
264#epub_tocdup = True
265
266# Example configuration for intersphinx: refer to the Python standard library.
267intersphinx_mapping = {'http://docs.python.org/': None}
268
269import types
270from sphinx.ext import autodoc
271
272def maybe_skip_member(app, what, name, obj, skip, options):
273    #print app, what, name, obj, skip, options
274
275    #allow class methods that begin with __ and end with __
276    if isinstance(obj, types.MethodType) \
277        and not isinstance(options.members, list) \
278        and name.startswith("__") \
279        and name.endswith("__") \
280        and (obj.__doc__ != None or options.get("undoc-members", False)):
281            return False
282
283class SingletonDocumenter(autodoc.ModuleLevelDocumenter):
284    """
285    Specialized Documenter subclass for singleton items.
286    """
287    objtype = 'singleton'
288    directivetype = 'data'
289
290    member_order = 40
291
292    @classmethod
293    def can_document_member(cls, member, membername, isattr, parent):
294        return isinstance(parent, autodoc.ModuleDocumenter) and isattr
295
296    def document_members(self, all_members=False):
297        pass
298
299    def add_content(self, more_content, no_docstring=False):
300        self.add_line(u'Singleton instance of :py:class:`~%s`.' % (self.object.__class__.__name__,), '<autodoc>')
301
302def setup(app):
303    app.connect('autodoc-skip-member', maybe_skip_member)
304    app.add_autodocumenter(SingletonDocumenter)
Note: See TracBrowser for help on using the repository browser.