Debian Codegraph @

docs/conf.py

raw
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 import os
5 import re
6 import sys
7 from datetime import date
8
9 # If extensions (or modules to document with autodoc) are in another directory,
10 # add these directories to sys.path here. If the directory is relative to the
11 # documentation root, use os.path.abspath to make it absolute, like shown here.
12 sys.path.insert(0, os.path.abspath('..'))
13 os.environ['RUNTIME_ENV'] = 'TESTSUITE'
14 os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
15 try:
16 import django
17 import sphinx_rtd_theme
18
19 use_sphinx_rtd_theme = True
20 if hasattr(django, "setup"):
21 django.setup()
22
23 except ImportError:
24 use_sphinx_rtd_theme = os.environ.get('READTHEDOCS', False)
25
26
27 def get_version(package):
28 """
29 Return package version as listed in `__version__` in `init.py`.
30 """
31 init_py = open(os.path.join(package, '__init__.py')).read()
32 return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
33
34
35 # -- General configuration ------------------------------------------------
36
37 # If your documentation needs a minimal Sphinx version, state it here.
38 #
39 # needs_sphinx = '1.0'
40
41 # Add any Sphinx extension module names here, as strings. They can be
42 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43 # ones.
44 extensions = ['sphinx.ext.autodoc',
45 'sphinx.ext.intersphinx',
46 'sphinx.ext.extlinks',
47 'sphinx.ext.todo',
48 'sphinx.ext.viewcode']
49
50 # Add any paths that contain templates here, relative to this directory.
51 templates_path = ['_templates']
52
53 # The suffix(es) of source filenames.
54 # You can specify multiple suffix as a list of string:
55 #
56 # source_suffix = ['.rst', '.md']
57 source_suffix = '.rst'
58
59 # The master toctree document.
60 master_doc = 'index'
61
62 # General information about the project.
63 project = 'drf_haystack'
64 copyright = '%d, Rolf Håvard Blindheim' % date.today().year
65 author = 'Rolf Håvard Blindheim'
66
67 # The version info for the project you're documenting, acts as replacement for
68 # |version| and |release|, also used in various other places throughout the
69 # built documents.
70 #
71 # The full version, including alpha/beta/rc tags.
72 version = release = get_version(os.path.join('..', 'drf_haystack'))
73
74 # The language for content autogenerated by Sphinx. Refer to documentation
75 # for a list of supported languages.
76 #
77 # This is also used if you do content translation via gettext catalogs.
78 # Usually you set "language" from the command line for these cases.
79 language = None
80
81 # List of patterns, relative to source directory, that match files and
82 # directories to ignore when looking for source files.
83 # This patterns also effect to html_static_path and html_extra_path
84 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
85
86 # The name of the Pygments (syntax highlighting) style to use.
87 pygments_style = 'sphinx'
88
89 # If true, `todo` and `todoList` produce output, else they produce nothing.
90 todo_include_todos = True
91
92
93 # -- Options for HTML output ----------------------------------------------
94
95 # The theme to use for HTML and HTML Help pages. See the documentation for
96 # a list of builtin themes.
97 #
98 html_theme = 'sphinx_rtd_theme' if use_sphinx_rtd_theme else 'alabaster'
99
100 # Theme options are theme-specific and customize the look and feel of a theme
101 # further. For a list of options available for each theme, see the
102 # documentation.
103 #
104 # html_theme_options = {}
105
106 # Add any paths that contain custom static files (such as style sheets) here,
107 # relative to this directory. They are copied after the builtin static files,
108 # so a file named "default.css" will overwrite the builtin "default.css".
109 html_static_path = ['_static']
110
111
112 # -- Options for HTMLHelp output ------------------------------------------
113
114 # Output file base name for HTML help builder.
115 htmlhelp_basename = 'drfhaystackdoc'
116
117
118 # -- Options for LaTeX output ---------------------------------------------
119
120 latex_elements = {
121 # The paper size ('letterpaper' or 'a4paper').
122 'papersize': 'a4paper',
123
124 # The font size ('10pt', '11pt' or '12pt').
125 'pointsize': '11pt',
126
127 # Additional stuff for the LaTeX preamble.
128 #
129 # 'preamble': '',
130
131 # Latex figure (float) alignment
132 #
133 # 'figure_align': 'htbp',
134 }
135
136 # Grouping the document tree into LaTeX files. List of tuples
137 # (source start file, target name, title,
138 # author, documentclass [howto, manual, or own class]).
139 latex_documents = [
140 ('index', 'drf-haystack.tex', 'drf-haystack documentation',
141 'Inonit', 'manual'),
142 ]
143
144
145 # -- Options for manual page output ---------------------------------------
146
147 # One entry per manual page. List of tuples
148 # (source start file, name, description, authors, manual section).
149 man_pages = [
150 ('index', 'drf-haystack', 'drf-haystack documentation',
151 ['Inonit'], 1)
152 ]
153
154
155 # -- Options for Texinfo output -------------------------------------------
156
157 # Grouping the document tree into Texinfo files. List of tuples
158 # (source start file, target name, title, author,
159 # dir menu entry, description, category)
160 texinfo_documents = [
161 ('index', 'drf-haystack', 'drf-haystack documentation',
162 'Inonit', 'drf-haystack', 'Haystack for Django REST Framework',
163 'Miscellaneous'),
164 ]
165
166 # Example configuration for intersphinx: refer to the Python standard library.
167 intersphinx_mapping = {
168 'http://docs.python.org/': None,
169 'django': ('https://django.readthedocs.io/en/latest/', None),
170 'haystack': ('https://django-haystack.readthedocs.io/en/latest/', None)
171 }
172
173 # Configurations for extlinks
174 extlinks = {
175 'drf-pr': ('https://github.com/rhblind/drf-haystack/pull/%s', 'PR#'),
176 'drf-issue': ('https://github.com/rhblind/drf-haystack/issues/%s', '#'),
177 'haystack-issue': ('https://github.com/django-haystack/django-haystack/issues/%s', '#')
178 }