make NotImplemented a more verbose
[PyX.git] / manual / conf.py
blob712466c12263e4faf17d9f443f303a1c2919f0a2
1 # -*- coding: utf-8 -*-
3 # PyX documentation build configuration file, created by
4 # sphinx-quickstart on Thu May 19 17:32:57 2011.
6 # This file is execfile()d with the current directory set to its containing dir.
8 # Note that not all possible configuration values are present in this
9 # autogenerated file.
11 # All configuration values have a default; values that are commented out
12 # serve to show the default.
14 import sys, os
15 sys.path.insert(0, '../pyx')
16 sys.path.insert(0, '..')
17 import pyx.version
19 # If extensions (or modules to document with autodoc) are in another directory,
20 # add these directories to sys.path here. If the directory is relative to the
21 # documentation root, use os.path.abspath to make it absolute, like shown here.
22 #sys.path.insert(0, os.path.abspath('.'))
24 # -- General configuration -----------------------------------------------------
26 # If your documentation needs a minimal Sphinx version, state it here.
27 #needs_sphinx = '1.0'
29 # Add any Sphinx extension module names here, as strings. They can be extensions
30 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
31 extensions = ['sphinx.ext.mathjax', 'sphinx.ext.todo', 'sphinx.ext.autodoc']
33 # Add any paths that contain templates here, relative to this directory.
34 templates_path = ['_templates']
36 # The suffix of source filenames.
37 source_suffix = '.rst'
39 # The encoding of source files.
40 #source_encoding = 'utf-8-sig'
42 # The master toctree document.
43 master_doc = 'manual'
45 # General information about the project.
46 project = 'PyX'
47 copyright = pyx.version.date.split('/')[0] + ', Jörg Lehmann, Michael Schindler, André Wobst'
49 # The version info for the project you're documenting, acts as replacement for
50 # |version| and |release|, also used in various other places throughout the
51 # built documents.
53 # The short X.Y version.
54 version = '.'.join(pyx.version.version.split('.')[:1])
55 # The full version, including alpha/beta/rc tags.
56 release = pyx.version.version
58 # The language for content autogenerated by Sphinx. Refer to documentation
59 # for a list of supported languages.
60 #language = None
62 # There are two options for replacing |today|: either, you set today to some
63 # non-false value, then it is used:
64 today = pyx.version.date
65 # Else, today_fmt is used as the format for a strftime call.
66 #today_fmt = '%B %d, %Y'
68 # List of patterns, relative to source directory, that match files and
69 # directories to ignore when looking for source files.
70 exclude_patterns = ['_build']
72 # The reST default role (used for this markup: `text`) to use for all documents.
73 #default_role = None
75 # If true, '()' will be appended to :func: etc. cross-reference text.
76 #add_function_parentheses = True
78 # If true, the current module name will be prepended to all description
79 # unit titles (such as .. function::).
80 #add_module_names = True
82 # If true, sectionauthor and moduleauthor directives will be shown in the
83 # output. They are ignored by default.
84 #show_authors = False
86 # The name of the Pygments (syntax highlighting) style to use.
87 pygments_style = 'sphinx'
89 # A list of ignored prefixes for module index sorting.
90 #modindex_common_prefix = []
93 # -- Options for HTML output ---------------------------------------------------
95 # The theme to use for HTML and HTML Help pages. See the documentation for
96 # a list of builtin themes.
97 html_theme = 'pyx'
99 # Theme options are theme-specific and customize the look and feel of a theme
100 # further. For a list of options available for each theme, see the
101 # documentation.
102 html_theme_options = {'sidebarwidth': 200}
104 # Add any paths that contain custom themes here, relative to this directory.
105 html_theme_path = ['theme']
107 # The name for this set of Sphinx documents. If None, it defaults to
108 # "<project> v<release> documentation".
109 html_title = 'PyX %s Manual' % release
111 # A shorter title for the navigation bar. Default is the same as html_title.
112 #html_short_title = None
114 # The name of an image file (relative to this directory) to place at the top
115 # of the sidebar.
116 #html_logo = None
118 # The name of an image file (within the static path) to use as favicon of the
119 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
120 # pixels large.
121 #html_favicon = None
123 # Add any paths that contain custom static files (such as style sheets) here,
124 # relative to this directory. They are copied after the builtin static files,
125 # so a file named "default.css" will overwrite the builtin "default.css".
126 html_static_path = []
128 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
129 # using the given strftime format.
130 #html_last_updated_fmt = '%b %d, %Y'
132 # If true, SmartyPants will be used to convert quotes and dashes to
133 # typographically correct entities.
134 #html_use_smartypants = True
136 # Custom sidebar templates, maps document names to template names.
137 #html_sidebars = {}
138 html_sidebars = {
139 '**': ['localtoc.html', 'sourcelink.html', 'searchbox.html']
142 # Additional templates that should be rendered to pages, maps page names to
143 # template names.
144 #html_additional_pages = {}
146 # If false, no module index is generated.
147 #html_domain_indices = True
149 # If false, no index is generated.
150 #html_use_index = True
152 # If true, the index is split into individual pages for each letter.
153 #html_split_index = False
155 # If true, links to the reST sources are added to the pages.
156 #html_show_sourcelink = True
158 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
159 #html_show_sphinx = True
161 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
162 #html_show_copyright = True
164 # If true, an OpenSearch description file will be output, and all pages will
165 # contain a <link> tag referring to it. The value of this option must be the
166 # base URL from which the finished HTML is served.
167 #html_use_opensearch = ''
169 # This is the file name suffix for HTML files (e.g. ".xhtml").
170 #html_file_suffix = None
172 # Output file base name for HTML help builder.
173 htmlhelp_basename = 'PyXdoc'
175 todo_include_todos = True
178 # -- Options for LaTeX output --------------------------------------------------
180 # The paper size ('letter' or 'a4').
181 latex_paper_size = 'a4'
183 # The font size ('10pt', '11pt' or '12pt').
184 #latex_font_size = '10pt'
186 # Grouping the document tree into LaTeX files. List of tuples
187 # (source start file, target name, title, author, documentclass [howto/manual]).
188 latex_documents = [
189 ('manual', 'manual.tex', 'PyX Manual',
190 'Jörg Lehmann, Michael Schindler, André Wobst', 'manual'),
193 # The name of an image file (relative to this directory) to place at the top of
194 # the title page.
195 #latex_logo = None
197 # For "manual" documents, if this is true, then toplevel headings are parts,
198 # not chapters.
199 #latex_use_parts = False
201 # If true, show page references after internal links.
202 #latex_show_pagerefs = False
204 # If true, show URL addresses after external links.
205 #latex_show_urls = False
207 # Additional stuff for the LaTeX preamble.
208 latex_preamble = r'''
209 \hypersetup{pdftitle={PyX Manual},
210 pdfauthor={Joerg Lehmann <joergl@users.sourceforge.net>, Michael Schindler <m-schindler@users.sourceforge.net>, Andre Wobst <wobsta@users.sourceforge.net>},
211 pdfsubject={PyX Manual},
212 pdfkeywords={PyX, graphics, manual}}
215 # Documents to append as an appendix to all manuals.
216 #latex_appendices = []
218 # If false, no module index is generated.
219 #latex_domain_indices = True
222 # -- Options for manual page output --------------------------------------------
224 # One entry per manual page. List of tuples
225 # (source start file, name, description, authors, manual section).
226 man_pages = [
227 ('manual', 'pyx', 'PyX Manual',
228 ['Jörg Lehmann, Michael Schindler, André Wobst'], 1)
231 # -- Other options ------------------------------------------------------------
233 mathjax_path = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default'
234 todo_include_todos = True
235 autoclass_content = 'both'
236 autodoc_member_order = 'bysource'
239 # -- unprocessed function signature extractor ----------------------------------
240 # This feature is not robust. It does not parse the code properly, removes
241 # comments and whitespace doubtfully, requires '):' without space for
242 # termination, etc.
244 import inspect
246 def function_signature_lines(lines):
247 # extract the lines of the function definition removing comments
248 # and stripping spaces
249 for line in lines:
250 code = line.split("#", 1)[0].strip()
251 yield code
252 if code.endswith("):"):
253 break
255 def unprocessed_function_signature(app, what, name, obj, options, sig, retann):
256 # extract the unprocessed signature from the source
257 if what not in ["class", "method", "staticmethod", "function"]:
258 return
259 if what == "class":
260 # get the constructor (code copied from autodoc)
261 obj = getattr(obj, "__init__", None)
262 if obj is None or obj is object.__init__ or not \
263 (inspect.ismethod(obj) or inspect.isfunction(obj)):
264 return
265 elif hasattr(obj, '__wrapped__'):
266 obj = obj.__wrapped__
267 src, line = inspect.findsource(obj)
268 code = " ".join(function_signature_lines(src[line:])).split("(", 1)[1][:-2]
269 if code.startswith("self, "):
270 code = code[6:]
271 elif code == "self":
272 code = ""
273 return "({})".format(code), retann
275 def remove_default_constructor_docstring(app, what, name, obj, options, lines):
276 # remove default constructor docstring, i.e. when no own constructor is defined
277 for i, line in enumerate(lines):
278 lines[i] = line.replace("x.__init__(...) initializes x; see help(type(x)) for signature", "")
280 def setup(app):
281 app.connect('autodoc-process-signature', unprocessed_function_signature)
282 app.connect('autodoc-process-docstring', remove_default_constructor_docstring)
285 # -- monkey patch safe_repr for function signatures ----------------------------
287 import re
288 import sphinx.util.inspect
290 old_safe_repr = sphinx.util.inspect.safe_repr
291 function_pattern = re.compile(r"<function (\S+) at 0x[0-9a-f]+>")
292 sphinx.util.inspect.safe_repr = lambda obj: re.sub(function_pattern, r"\1",
293 old_safe_repr(obj))