From 7f4bbd9d2467e41010b65aecf668cd7a25f84ea3 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 23 Dec 2020 12:45:12 +0100 Subject: [PATCH 1/2] Add autodoc-process-docstring event for aliases --- doc/source/conf.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 15e7a13ff5b72..951a6d4043786 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -687,6 +687,30 @@ def process_class_docstrings(app, what, name, obj, options, lines): lines[:] = joined.split("\n") +_BUSINED_ALIASES = [ + "pandas.tseries.offsets." + name + for name in [ + "BDay", + "CDay", + "BMonthEnd", + "BMonthBegin", + "CBMonthEnd", + "CBMonthBegin", + ] +] + + +def process_business_alias_docstrings(app, what, name, obj, options, lines): + """ + Starting with sphinx 3.4, the "autodoc-process-docstring" event also + gets called for alias classes. This results in numpydoc adding the + methods/attributes to the docstring, which we don't want (+ this + causes warnings with sphinx). + """ + if name in _BUSINED_ALIASES: + lines[:] = [] + + suppress_warnings = [ # We "overwrite" autosummary with our PandasAutosummary, but # still want the regular autosummary setup to run. So we just @@ -716,6 +740,7 @@ def setup(app): app.connect("source-read", rstjinja) app.connect("autodoc-process-docstring", remove_flags_docstring) app.connect("autodoc-process-docstring", process_class_docstrings) + app.connect("autodoc-process-docstring", process_business_alias_docstrings) app.add_autodocumenter(AccessorDocumenter) app.add_autodocumenter(AccessorAttributeDocumenter) app.add_autodocumenter(AccessorMethodDocumenter) From 7ac8a61afe013d766f36b593becb794c9622caff Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 23 Dec 2020 12:46:09 +0100 Subject: [PATCH 2/2] unpin sphinx --- environment.yml | 2 +- requirements-dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index a23e7906a42a0..600a20b153ed3 100644 --- a/environment.yml +++ b/environment.yml @@ -31,7 +31,7 @@ dependencies: # documentation - gitpython # obtain contributors from git for whatsnew - gitdb - - sphinx=3.3.1 + - sphinx # documentation (jupyter notebooks) - nbconvert>=5.4.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index 084952fbdf5ef..d45e87b1785b0 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -17,7 +17,7 @@ pycodestyle pyupgrade gitpython gitdb -sphinx==3.3.1 +sphinx nbconvert>=5.4.1 nbsphinx pandoc