14
14
15
15
import os
16
16
import sys
17
-
18
17
import sphinx_rtd_theme
18
+ from sklearn .externals .six import u
19
19
20
20
# If extensions (or modules to document with autodoc) are in another directory,
21
21
# add these directories to sys.path here. If the directory is relative to the
22
22
# documentation root, use os.path.abspath to make it absolute, like shown here.
23
- # sys.path.insert(0, os.path.abspath('.'))
24
-
25
- # -- General configuration ---------------------------------------------------
26
-
27
- # Try to override the matplotlib configuration as early as possible
28
- try :
29
- import gen_rst
30
- except :
31
- pass
32
- # -- General configuration ------------------------------------------------
33
-
34
-
35
- # If extensions (or modules to document with autodoc) are in another
36
- # directory, add these directories to sys.path here. If the directory
37
- # is relative to the documentation root, use os.path.abspath to make it
38
- # absolute, like shown here.
39
23
sys .path .insert (0 , os .path .abspath ('sphinxext' ))
40
-
41
24
from github_link import make_linkcode_resolve
25
+ import sphinx_gallery
26
+
27
+ # -- General configuration ------------------------------------------------
42
28
43
29
# If your documentation needs a minimal Sphinx version, state it here.
44
30
# needs_sphinx = '1.0'
47
33
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
48
34
# ones.
49
35
extensions = [
50
- 'sphinx.ext.autodoc' , 'sphinx.ext.doctest' , 'sphinx.ext.intersphinx' ,
51
- 'sphinx.ext.todo' , 'sphinx.ext.imgmath' , 'sphinx.ext.ifconfig' ,
52
- 'sphinx.ext.viewcode' , 'sphinx_gallery.gen_gallery' ,
53
- 'sphinx.ext.autosummary' , 'numpydoc' , 'sphinx.ext.intersphinx' ,
54
- 'sphinx_issues' , 'sphinx.ext.linkcode'
36
+ 'sphinx.ext.autodoc' ,
37
+ 'sphinx.ext.autosummary' ,
38
+ 'sphinx.ext.doctest' ,
39
+ 'sphinx.ext.intersphinx' ,
40
+ 'sphinx.ext.linkcode' ,
41
+ 'sphinx.ext.viewcode' ,
42
+ 'numpydoc' ,
43
+ 'sphinx_issues' ,
44
+ 'sphinx_gallery.gen_gallery' ,
55
45
]
56
46
57
- autosummary_generate = True
47
+ # this is needed for some reason...
48
+ # see https://github.com/numpy/numpydoc/issues/69
58
49
numpydoc_show_class_members = False
59
50
60
- autodoc_default_flags = ['members' , 'inherited-members' ]
51
+ # pngmath / imgmath compatibility layer for different sphinx versions
52
+ import sphinx
53
+ from distutils .version import LooseVersion
54
+ if LooseVersion (sphinx .__version__ ) < LooseVersion ('1.4' ):
55
+ extensions .append ('sphinx.ext.pngmath' )
56
+ else :
57
+ extensions .append ('sphinx.ext.imgmath' )
61
58
62
- sphinx_gallery_conf = {
63
- # path to your examples scripts
64
- 'examples_dirs' : '../examples' ,
65
- # path where to save gallery generated examples
66
- 'gallery_dirs' : 'auto_examples' ,
67
- # to make references clickable
68
- 'doc_module' : 'imblearn' ,
69
- 'backreferences_dir' : os .path .join ('generated' ),
70
- 'reference_url' : {
71
- 'imblearn' : None ,
72
- 'sklearn' : None ,
73
- 'matplotlib' : None ,
74
- 'numpy' : None ,
75
- 'scipy' : None
76
- }
77
- }
59
+ autodoc_default_flags = ['members' , 'inherited-members' ]
78
60
79
61
# Add any paths that contain templates here, relative to this directory.
80
62
templates_path = ['_templates' ]
88
70
# The encoding of source files.
89
71
# source_encoding = 'utf-8-sig'
90
72
91
- # Generate the plots for the gallery
73
+ # Generate the plot for the gallery
92
74
plot_gallery = True
93
75
94
76
# The master toctree document.
95
77
master_doc = 'index'
96
78
97
79
# General information about the project.
98
- project = u'imbalanced-learn'
99
- copyright = u'2016, G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas'
80
+ project = u ( 'imbalanced-learn' )
81
+ copyright = u ( '2016 - 2017 , G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas' )
100
82
101
83
# The version info for the project you're documenting, acts as replacement for
102
84
# |version| and |release|, also used in various other places throughout the
120
102
121
103
# List of patterns, relative to source directory, that match files and
122
104
# directories to ignore when looking for source files.
123
- exclude_patterns = ['_build' ]
105
+ exclude_patterns = ['_build' , '_templates' ]
124
106
125
107
# The reST default role (used for this markup: `text`) to use for all
126
108
# documents.
250
232
# (source start file, target name, title,
251
233
# author, documentclass [howto, manual, or own class]).
252
234
latex_documents = [
253
- ('index' , 'imbalanced-learn.tex' , u'imbalanced-learn Documentation' ,
254
- u'G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas' , 'manual' ),
235
+ ('index' , 'imbalanced-learn.tex' , u ( 'imbalanced-learn Documentation' ) ,
236
+ u ( 'G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas' ) , 'manual' ),
255
237
]
256
238
257
239
# The name of an image file (relative to this directory) to place at the top of
271
253
# Documents to append as an appendix to all manuals.
272
254
# latex_appendices = []
273
255
256
+ # intersphinx configuration
257
+ intersphinx_mapping = {
258
+ 'python' : ('https://docs.python.org/{.major}' .format (
259
+ sys .version_info ), None ),
260
+ 'numpy' : ('https://docs.scipy.org/doc/numpy/' , None ),
261
+ 'scipy' : ('https://docs.scipy.org/doc/scipy/reference' , None ),
262
+ 'matplotlib' : ('https://matplotlib.org/' , None ),
263
+ 'sklearn' : ('http://scikit-learn.org/stable' , None )
264
+ }
265
+
266
+ # sphinx-gallery configuration
267
+ sphinx_gallery_conf = {
268
+ 'doc_module' : 'imblearn' ,
269
+ 'backreferences_dir' : os .path .join ('generated' ),
270
+ 'reference_url' : {
271
+ 'imblearn' : None }
272
+ }
273
+
274
+ # -- Options for manual page output ---------------------------------------
275
+
274
276
# If false, no module index is generated.
275
277
# latex_domain_indices = True
276
278
277
- # -- Options for manual page output ---------------------------------------
278
279
279
280
# One entry per manual page. List of tuples
280
281
# (source start file, name, description, authors, manual section).
296
297
]
297
298
298
299
299
- def generate_example_rst (app , what , name , obj , options , lines ):
300
- # generate empty examples files, so that we don't get
301
- # inclusion errors if there are no examples for a class / module
302
- examples_path = os .path .join (app .srcdir , "generated" ,
303
- "%s.examples" % name )
304
- if not os .path .exists (examples_path ):
305
- # touch file
306
- open (examples_path , 'w' ).close ()
300
+ # def generate_example_rst(app, what, name, obj, options, lines):
301
+ # # generate empty examples files, so that we don't get
302
+ # # inclusion errors if there are no examples for a class / module
303
+ # examples_path = os.path.join(app.srcdir, "generated",
304
+ # "%s.examples" % name)
305
+ # if not os.path.exists(examples_path):
306
+ # # touch file
307
+ # open(examples_path, 'w').close()
307
308
308
309
309
310
# Config for sphinx_issues
@@ -315,7 +316,7 @@ def generate_example_rst(app, what, name, obj, options, lines):
315
316
316
317
def setup (app ):
317
318
app .add_javascript ('js/copybutton.js' )
318
- app .connect ('autodoc-process-docstring' , generate_example_rst )
319
+ # app.connect('autodoc-process-docstring', generate_example_rst)
319
320
320
321
321
322
# Documents to append as an appendix to all manuals.
@@ -330,9 +331,6 @@ def setup(app):
330
331
# If true, do not generate a @detailmenu in the "Top" node's menu.
331
332
# texinfo_no_detailmenu = False
332
333
333
- # Example configuration for intersphinx: refer to the Python standard library.
334
- intersphinx_mapping = {'http://docs.python.org/' : None }
335
-
336
334
# The following is used by sphinx.ext.linkcode to provide links to github
337
335
linkcode_resolve = make_linkcode_resolve ('imblearn' ,
338
336
u'https://github.com/scikit-learn-contrib/'
0 commit comments