source: orange/docs/conf.py @ 11046:3fe036b7f838

Revision 11046:3fe036b7f838, 10.6 KB checked in by Ales Erjavec <ales.erjavec@…>, 16 months ago (diff)

Fixed widget catalog documentation to properly include and link to old static files.

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