Skip to content
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

API doc pages generation with autosummary broken for pandas with 1.7b #4531

Closed
jorisvandenbossche opened this issue Jan 31, 2018 · 3 comments

Comments

@jorisvandenbossche
Copy link
Contributor

Problem

The API pages in the pandas documentation that are generated by autosummary pages are no longer building correctly

The reason seems to be that in the docstring pages generated by autosummary, all occurences of .. automethod:: Series.abs are changed in .. autodata:: abs, which then fails to fetch the docstrings, resulting in empty pages.

See also #4230 (comment)

Procedure to reproduce the problem

I made a test repo with a small subset of our docs: https://github.com/jorisvandenbossche/pandas-test-docs. This should be easier to test out.

Error logs / results

So trying to look through the log output of sphinx 1.7.
I see the following (when reading the source of generated/pandas.Series):

[autodoc] from pandas import Series.abs
[autodoc] => <module 'pandas' from '/home/joris/miniconda3/envs/sphinx-test/lib/python3.6/site-packages/pandas/__init__.py'>
[autodoc] getattr(_, 'Series')
[autodoc] => <class 'pandas.core.series.Series'>
[autodoc] getattr(_, 'abs')
[autodoc] => <function NDFrame.abs at 0x7fa3d669e598>
[app] emitting event: 'autodoc-process-docstring'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7fa3d669e598>, {}, ['Return an object wit

It clearly mentions 'method' in that last line, but, it writes a file with autodata, resulting in an error in the next step when reading the generated (in the above step) file 'generated/pandas.Series.abs':

reading sources... [  1%] generated/pandas.Series.abs
[app] emitting event: 'env-purge-doc'(<sphinx.environment.BuildEnvironment object at 0x7fa3c796c160>, 'generated/pandas.Series.abs')
[app] emitting event: 'source-read'('generated/pandas.Series.abs', ['pandas.Series.abs\n=================\n\n.. currentmodule:: pandas.
[autodoc] /home/joris/scipy/pandas-test-docs/source/generated/pandas.Series.abs.rst:6: input:
.. autodata:: abs
[autodoc] from pandas.Series import abs
autodoc: failed to import data 'abs' from module 'pandas.Series'; the following exception was raised:
No module named 'pandas.Series'
[app] emitting event: 'doctree-read'(<document: <section "pandas.series.abs"...>>,)

As a comparison, the equivalent bits of the log file for sphinx 1.5.6:

[autodoc] from pandas import Series.abs
[autodoc] import pandas
[autodoc] => <module 'pandas' from '/home/joris/miniconda3/envs/sphinx-test/lib/python3.6/site-packages/pandas/__init__.py'>
[autodoc] getattr(_, 'Series')
[autodoc] => <class 'pandas.core.series.Series'>
[autodoc] getattr(_, 'abs')
[autodoc] => <function NDFrame.abs at 0x7f1a4ab169d8>
[app] emitting event: 'autodoc-process-signature'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7f1a4ab169d8>, {}, '()', None)
[app] emitting event: 'autodoc-process-docstring'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7f1a4ab169d8>, {}, ['Return an object wit
[app] emitting event: 'autodoc-process-docstring'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7f1a4ab169d8>, {}, ['', 'Return an object
reading sources... [  1%] generated/pandas.Series.abs
[app] emitting event: 'env-purge-doc'(<sphinx.environment.BuildEnvironment object at 0x7f1a3d415d30>, 'generated/pandas.Series.abs')
[app] emitting event: 'source-read'('generated/pandas.Series.abs', ['pandas\\.Series\\.abs\n===================\n\n.. currentmodule:: p
[autodoc] /home/joris/scipy/pandas-test-docs/source/generated/pandas.Series.abs.rst:6: input:
.. automethod:: Series.abs
[autodoc] from pandas import Series.abs
[autodoc] import pandas
[autodoc] => <module 'pandas' from '/home/joris/miniconda3/envs/sphinx-test/lib/python3.6/site-packages/pandas/__init__.py'>
[autodoc] getattr(_, 'Series')
[autodoc] => <class 'pandas.core.series.Series'>
[autodoc] getattr(_, 'abs')
[autodoc] => <function NDFrame.abs at 0x7f1a4ab169d8>
[app] emitting event: 'autodoc-process-signature'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7f1a4ab169d8>, {}, '()', None)
[app] emitting event: 'autodoc-process-docstring'('method', 'pandas.Series.abs', <function NDFrame.abs at 0x7f1a4ab169d8>, {}, ['Return an object wit
[autodoc] output:

.. py:method:: Series.abs()
   :module: pandas

[... docstring]
   ..
       !! processed by numpydoc !!
[app] emitting event: 'doctree-read'(<document: <section "pandas.series.abs"...>>,)
@tk0miya
Copy link
Member

tk0miya commented Feb 1, 2018

Thank you for reporting. I'll take a look later!

@tk0miya
Copy link
Member

tk0miya commented Feb 2, 2018

I just make #4536 to fix this. Please try it out.

tk0miya added a commit that referenced this issue Feb 3, 2018
Fix #4531: autosummary: methods are treated as attributes
@tk0miya
Copy link
Member

tk0miya commented Feb 3, 2018

Fixed by #4536. Closed.

@tk0miya tk0miya closed this as completed Feb 3, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants