Author: Yaroslav Halchenko
        Andreas Tille (for the change)
Last-Update: Wed, 13 Feb 2019 08:43:05 +0100
Description: Use Debian packaged IPhythonSphinx extensions
 .
 Also drop matplotlib.sphinxext.only_directives which fail with
 python3-matplotlib and are not used

--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -35,14 +35,29 @@ extensions = ['sphinx.ext.autodoc',
               'sphinx.ext.autosummary',
               'sphinx.ext.inheritance_diagram',
               'matplotlib.sphinxext.plot_directive',
-              'matplotlib.sphinxext.only_directives',
-              'IPython.sphinxext.ipython_console_highlighting',
-              'IPython.sphinxext.ipython_directive',
+              #'matplotlib.sphinxext.only_directives',
+              #'IPython.sphinxext.ipython_console_highlighting',
+              #'IPython.sphinxext.ipython_directive',
               'github',  # for GitHub links,
               'numpydoc',  # numpydoc or napoleon, but not both
               # 'sphinx.ext.napoleon'
               ]
 
+try:
+    import IPython.sphinxext.ipython_console_highlighting as _
+    import IPython.sphinxext.ipython_directive as _
+    extensions += [
+        'IPython.sphinxext.ipython_console_highlighting',
+        'IPython.sphinxext.ipython_directive'
+        ]
+except:
+    # If systems have older IPython, just use shipped copies
+    extensions += [
+        'ipython_console_highlighting',
+        'ipython_directive'
+        ]
+
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -332,4 +347,4 @@ import numpy as np
 import scipy.stats as stats
 import matplotlib.pyplot as plt
 import pandas as pd
-"""
\ No newline at end of file
+"""
