Skip to content

DOC/CI: fix class alias docstrings for sphinx 3.4 + unpin sphinx #38657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pycodestyle
pyupgrade
gitpython
gitdb
sphinx==3.3.1
sphinx
nbconvert>=5.4.1
nbsphinx
pandoc
Expand Down