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

Clean up autosummary usage #54457

Merged
merged 2 commits into from
Aug 18, 2023
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
51 changes: 25 additions & 26 deletions doc/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
{% extends "!autosummary/class.rst" %}
{{ fullname | escape | underline}}

{% block methods %}
{% if methods %}
.. currentmodule:: {{ module }}

..
HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
.. autosummary::
:toctree:
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__'] %}
{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
.. autoclass:: {{ objname }}

{% endif %}
{% endblock %}
{% block methods %}

{% block attributes %}
{% if attributes %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

..
HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
.. autosummary::
:toctree:
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in attributes %}
{% if item in members and not item.startswith('_') %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}
{% endblock %}

{% if methods %}
.. rubric:: {{ _('Methods') }}

{% endif %}
{% endblock %}
.. autosummary::
{% for item in methods %}
{% if item in members and (not item.startswith('_') or item in ['__call__']) %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}
{% endblock %}
3 changes: 2 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
# to ensure that include files (partial pages) aren't built, exclude them
# https://github.com/sphinx-doc/sphinx/issues/1965#issuecomment-124732907
"**/includes/**",
"**/api/pandas.Series.dt.rst",
]
try:
import nbconvert
Expand Down Expand Up @@ -130,6 +129,8 @@
autodoc_typehints = "none"

# numpydoc
numpydoc_show_class_members = False
numpydoc_show_inherited_class_members = False
numpydoc_attributes_as_param_list = False

# matplotlib plot directive
Expand Down
29 changes: 13 additions & 16 deletions doc/source/reference/series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ pandas provides dtype-specific methods under various accessors.
These are separate namespaces within :class:`Series` that only apply
to specific data types.

.. autosummary::
:toctree: api/
:nosignatures:
:template: autosummary/accessor.rst

Series.str
Series.cat
Series.dt
Series.sparse
DataFrame.sparse
Index.str


=========================== =================================
Data Type Accessor
=========================== =================================
Expand Down Expand Up @@ -458,22 +471,6 @@ strings and apply several methods to it. These can be accessed like
Series.str.isdecimal
Series.str.get_dummies

..
The following is needed to ensure the generated pages are created with the
correct template (otherwise they would be created in the Series/Index class page)

..
.. autosummary::
:toctree: api/
:template: autosummary/accessor.rst

Series.str
Series.cat
Series.dt
Series.sparse
DataFrame.sparse
Index.str

.. _api.series.cat:

Categorical accessor
Expand Down