Skip to content

Commit b4ed8cf

Browse files
authored
DOC: building page for nested methods doesn't work (#46806)
* fix single_doc for nested attributes * keep current behaviour for building pandas.Series * add check for --single to CI * dont check Series in --single (attributes dont necessarily build) * move location of if * move check to code-checks.yml * fix section title
1 parent 41942e1 commit b4ed8cf

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.github/workflows/code-checks.yml

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ jobs:
8080
id: build
8181
uses: ./.github/actions/build_pandas
8282

83+
- name: Check for no warnings when building single-page docs
84+
run: ci/code_checks.sh single-docs
85+
if: ${{ steps.build.outcome == 'success' }}
86+
8387
- name: Run checks on imported code
8488
run: ci/code_checks.sh code
8589
if: ${{ steps.build.outcome == 'success' }}

.github/workflows/docbuild-and-upload.yml

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
run: |
3838
source activate pandas-dev
3939
python web/pandas_web.py web/pandas --target-path=web/build
40+
4041
- name: Build documentation
4142
run: |
4243
source activate pandas-dev

ci/code_checks.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# $ ./ci/code_checks.sh doctests # run doctests
1313
# $ ./ci/code_checks.sh docstrings # validate docstring errors
1414
# $ ./ci/code_checks.sh typing # run static type analysis
15+
# $ ./ci/code_checks.sh single-docs # check single-page docs build warning-free
1516

16-
[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" ]] || \
17+
[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" || "$1" == "single-docs" ]] || \
1718
{ echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|typing]"; exit 9999; }
1819

1920
BASE_DIR="$(dirname $0)/.."
@@ -102,4 +103,11 @@ if [[ -z "$CHECK" || "$CHECK" == "typing" ]]; then
102103
fi
103104
fi
104105

106+
### SINGLE-PAGE DOCS ###
107+
if [[ -z "$CHECK" || "$CHECK" == "single-docs" ]]; then
108+
python doc/make.py --warnings-are-errors --single pandas.Series.value_counts
109+
python doc/make.py --warnings-are-errors --single pandas.Series.str.split
110+
python doc/make.py clean
111+
fi
112+
105113
exit $RET

doc/source/index.rst.template

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pandas documentation
2626
easy-to-use data structures and data analysis tools for the `Python <https://www.python.org/>`__
2727
programming language.
2828

29+
{% if not single_doc -%}
2930
.. panels::
3031
:card: + intro-card text-center
3132
:column: col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex
@@ -96,16 +97,22 @@ programming language.
9697
:text: To the development guide
9798
:classes: btn-block btn-secondary stretched-link
9899

99-
100+
{% endif %}
100101
{% if single_doc and single_doc.endswith('.rst') -%}
101102
.. toctree::
102103
:maxdepth: 3
103104
:titlesonly:
104105

105106
{{ single_doc[:-4] }}
107+
{% elif single_doc and single_doc.count('.') <= 1 %}
108+
.. autosummary::
109+
:toctree: reference/api/
110+
111+
{{ single_doc }}
106112
{% elif single_doc %}
107113
.. autosummary::
108114
:toctree: reference/api/
115+
:template: autosummary/accessor_method.rst
109116

110117
{{ single_doc }}
111118
{% else -%}

0 commit comments

Comments
 (0)