From 62f356d072de6680b7dcae072af84cc7b5326452 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 29 Dec 2016 22:58:49 +0100 Subject: [PATCH 1/6] DOC/BLD: only use mpl.use once to prevent warnings --- doc/sphinxext/ipython_sphinxext/ipython_directive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sphinxext/ipython_sphinxext/ipython_directive.py b/doc/sphinxext/ipython_sphinxext/ipython_directive.py index b8b0935cd5b96..49fbacba99592 100644 --- a/doc/sphinxext/ipython_sphinxext/ipython_directive.py +++ b/doc/sphinxext/ipython_sphinxext/ipython_directive.py @@ -786,7 +786,7 @@ def setup(self): # EmbeddedSphinxShell is created, its interactive shell member # is the same for each instance. - if mplbackend: + if mplbackend and 'matplotlib.backends' not in sys.modules: import matplotlib # Repeated calls to use() will not hurt us since `mplbackend` # is the same each time. From 7f2ef53a603865676aec0ef2cc838161dd7f080e Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 29 Dec 2016 23:03:39 +0100 Subject: [PATCH 2/6] DOC/BLD: make the custom accessor documenters py3 compat - give lower priority (eg if both MethodDocumenter and AccessorMethodDocumenter have priority 1, in python 3 one of both is randomly chosen, also for normal methods (because the can_document_member method cannot distinguish both) - adapt templates (module and objname were differently split between py2 and py3) --- doc/_templates/autosummary/accessor.rst | 2 +- doc/_templates/autosummary/accessor_attribute.rst | 2 +- doc/_templates/autosummary/accessor_callable.rst | 2 +- doc/_templates/autosummary/accessor_method.rst | 2 +- doc/source/conf.py | 5 +++++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/_templates/autosummary/accessor.rst b/doc/_templates/autosummary/accessor.rst index 1401121fb51c6..af5e10316e738 100644 --- a/doc/_templates/autosummary/accessor.rst +++ b/doc/_templates/autosummary/accessor.rst @@ -3,4 +3,4 @@ .. currentmodule:: {{ module.split('.')[0] }} -.. automethod:: {{ [module.split('.')[1], objname]|join('.') }} +.. automethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/doc/_templates/autosummary/accessor_attribute.rst b/doc/_templates/autosummary/accessor_attribute.rst index a2f0eb5e068c4..b5ad65d6a736f 100644 --- a/doc/_templates/autosummary/accessor_attribute.rst +++ b/doc/_templates/autosummary/accessor_attribute.rst @@ -3,4 +3,4 @@ .. currentmodule:: {{ module.split('.')[0] }} -.. autoaccessorattribute:: {{ [module.split('.')[1], objname]|join('.') }} +.. autoaccessorattribute:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/doc/_templates/autosummary/accessor_callable.rst b/doc/_templates/autosummary/accessor_callable.rst index 6f45e0fd01e16..7a3301814f5f4 100644 --- a/doc/_templates/autosummary/accessor_callable.rst +++ b/doc/_templates/autosummary/accessor_callable.rst @@ -3,4 +3,4 @@ .. currentmodule:: {{ module.split('.')[0] }} -.. autoaccessorcallable:: {{ [module.split('.')[1], objname]|join('.') }}.__call__ +.. autoaccessorcallable:: {{ (module.split('.')[1:] + [objname]) | join('.') }}.__call__ diff --git a/doc/_templates/autosummary/accessor_method.rst b/doc/_templates/autosummary/accessor_method.rst index 43dfc3b813120..aefbba6ef1bbc 100644 --- a/doc/_templates/autosummary/accessor_method.rst +++ b/doc/_templates/autosummary/accessor_method.rst @@ -3,4 +3,4 @@ .. currentmodule:: {{ module.split('.')[0] }} -.. autoaccessormethod:: {{ [module.split('.')[1], objname]|join('.') }} +.. autoaccessormethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/doc/source/conf.py b/doc/source/conf.py index 4f679f3f728bf..ea3138c765536 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -381,12 +381,17 @@ class AccessorAttributeDocumenter(AccessorLevelDocumenter, AttributeDocumenter): objtype = 'accessorattribute' directivetype = 'attribute' + # lower than AttributeDocumenter so this is not chosen for normal attributes + priority = 0.6 class AccessorMethodDocumenter(AccessorLevelDocumenter, MethodDocumenter): objtype = 'accessormethod' directivetype = 'method' + # lower than MethodDocumenter so this is not chosen for normal methods + priority = 0.6 + class AccessorCallableDocumenter(AccessorLevelDocumenter, MethodDocumenter): """ From 630274fb5de3dd0c0587dfe325c0ed170521f2a0 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 29 Dec 2016 23:09:21 +0100 Subject: [PATCH 3/6] DOC/BLD: add specific AccessorDocumenter to prevent warning 'error while formatting arguments' during doc build --- doc/_templates/autosummary/accessor.rst | 2 +- doc/source/conf.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/_templates/autosummary/accessor.rst b/doc/_templates/autosummary/accessor.rst index af5e10316e738..4ba745cd6fdba 100644 --- a/doc/_templates/autosummary/accessor.rst +++ b/doc/_templates/autosummary/accessor.rst @@ -3,4 +3,4 @@ .. currentmodule:: {{ module.split('.')[0] }} -.. automethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }} +.. autoaccessor:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/doc/source/conf.py b/doc/source/conf.py index ea3138c765536..1e82dfca87d17 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -326,6 +326,23 @@ from sphinx.ext.autosummary import Autosummary +class AccessorDocumenter(MethodDocumenter): + """ + Specialized Documenter subclass for accessors. + """ + + objtype = 'accessor' + directivetype = 'method' + + # lower than MethodDocumenter so this is not chosen for normal methods + priority = 0.6 + + def format_signature(self): + # this method gives an error/warning for the accessors, therefore + # overriding it (accessor has no arguments) + return '' + + class AccessorLevelDocumenter(Documenter): """ Specialized Documenter subclass for objects on accessor level (methods, @@ -488,6 +505,7 @@ def remove_flags_docstring(app, what, name, obj, options, lines): def setup(app): app.connect("autodoc-process-docstring", remove_flags_docstring) + app.add_autodocumenter(AccessorDocumenter) app.add_autodocumenter(AccessorAttributeDocumenter) app.add_autodocumenter(AccessorMethodDocumenter) app.add_autodocumenter(AccessorCallableDocumenter) From a9329199477cc8ae8bf425f238e72d7f3b3822c3 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 29 Dec 2016 23:19:39 +0100 Subject: [PATCH 4/6] DOC/BLD: switch travis dev doc building to python 3.5 --- .travis.yml | 8 ++++---- ...7_DOC_BUILD.build => requirements-3.5_DOC_BUILD.build} | 0 ...s-2.7_DOC_BUILD.run => requirements-3.5_DOC_BUILD.run} | 0 ...nts-2.7_DOC_BUILD.sh => requirements-3.5_DOC_BUILD.sh} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename ci/{requirements-2.7_DOC_BUILD.build => requirements-3.5_DOC_BUILD.build} (100%) rename ci/{requirements-2.7_DOC_BUILD.run => requirements-3.5_DOC_BUILD.run} (100%) rename ci/{requirements-2.7_DOC_BUILD.sh => requirements-3.5_DOC_BUILD.sh} (100%) diff --git a/.travis.yml b/.travis.yml index becb347c3700f..b2a1a8a63cfe6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -182,9 +182,9 @@ matrix: - CACHE_NAME="35_ascii" - USE_CACHE=true # In allow_failures - - python: 2.7 + - python: 3.5 env: - - PYTHON_VERSION=2.7 + - PYTHON_VERSION=3.5 - JOB_NAME: "doc_build" - FULL_DEPS=true - DOC_BUILD=true @@ -275,9 +275,9 @@ matrix: - LOCALE_OVERRIDE="C" - CACHE_NAME="35_ascii" - USE_CACHE=true - - python: 2.7 + - python: 3.5 env: - - PYTHON_VERSION=2.7 + - PYTHON_VERSION=3.5 - JOB_NAME: "doc_build" - FULL_DEPS=true - DOC_BUILD=true diff --git a/ci/requirements-2.7_DOC_BUILD.build b/ci/requirements-3.5_DOC_BUILD.build similarity index 100% rename from ci/requirements-2.7_DOC_BUILD.build rename to ci/requirements-3.5_DOC_BUILD.build diff --git a/ci/requirements-2.7_DOC_BUILD.run b/ci/requirements-3.5_DOC_BUILD.run similarity index 100% rename from ci/requirements-2.7_DOC_BUILD.run rename to ci/requirements-3.5_DOC_BUILD.run diff --git a/ci/requirements-2.7_DOC_BUILD.sh b/ci/requirements-3.5_DOC_BUILD.sh similarity index 100% rename from ci/requirements-2.7_DOC_BUILD.sh rename to ci/requirements-3.5_DOC_BUILD.sh From 0cdf1d116f92dc94ad582f930ea3ff3599846cde Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 30 Dec 2016 10:21:58 +0100 Subject: [PATCH 5/6] fix dateutil specification --- ci/requirements-3.5_DOC_BUILD.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-3.5_DOC_BUILD.build b/ci/requirements-3.5_DOC_BUILD.build index faf1e3559f7f1..9558cf00ddf5c 100644 --- a/ci/requirements-3.5_DOC_BUILD.build +++ b/ci/requirements-3.5_DOC_BUILD.build @@ -1,4 +1,4 @@ -dateutil +python-dateutil pytz numpy cython From a4bbe01fd66958d23ae0d0fd964ab7beb92757ec Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 30 Dec 2016 15:12:24 +0100 Subject: [PATCH 6/6] fix beatifulsoup package name for python 3 --- ci/requirements-3.5_DOC_BUILD.run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-3.5_DOC_BUILD.run b/ci/requirements-3.5_DOC_BUILD.run index 9da8e76bc7e22..644a16f51f4b6 100644 --- a/ci/requirements-3.5_DOC_BUILD.run +++ b/ci/requirements-3.5_DOC_BUILD.run @@ -7,7 +7,7 @@ notebook matplotlib scipy lxml -beautiful-soup +beautifulsoup4 html5lib pytables openpyxl=1.8.5