source: orange/docs/reference/rst/conf.py @ 10881:f22adc7ab645

Revision 10881:f22adc7ab645, 10.0 KB checked in by mitar, 2 years ago (diff)

Use current version in documentation.

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