From fca91529f2925813a4a6698b2b3a2e444da69971 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Tue, 19 Apr 2022 21:59:15 +0100 Subject: [PATCH 1/7] fix single_doc for nested attributes --- doc/source/index.rst.template | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index 3b440122c2b97..88f19669425a3 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -103,9 +103,15 @@ programming language. :titlesonly: {{ single_doc[:-4] }} +{% elif single_doc and single_doc.count('.') == 1 %} +.. autosummary:: + :toctree: reference/api/ + + {{ single_doc }} {% elif single_doc %} .. autosummary:: :toctree: reference/api/ + :template: autosummary/accessor_method.rst {{ single_doc }} {% else -%} From 19494b4ca8c394a6c9989dd9a121c9953c3afa9e Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 20 Apr 2022 07:34:24 +0100 Subject: [PATCH 2/7] keep current behaviour for building pandas.Series --- doc/source/index.rst.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index 88f19669425a3..ce78c89a03afd 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -103,7 +103,7 @@ programming language. :titlesonly: {{ single_doc[:-4] }} -{% elif single_doc and single_doc.count('.') == 1 %} +{% elif single_doc and single_doc.count('.') <= 1 %} .. autosummary:: :toctree: reference/api/ From dcfbc1f7563fa34cd21ede16c76d14864f2fcab0 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 24 Apr 2022 11:41:54 +0100 Subject: [PATCH 3/7] add check for --single to CI --- .github/workflows/docbuild-and-upload.yml | 9 +++++++++ doc/source/index.rst.template | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index bba9f62a0eca6..515f1796b8425 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -37,6 +37,15 @@ jobs: run: | source activate pandas-dev python web/pandas_web.py web/pandas --target-path=web/build + + - name: Check building docs with --single works + run: | + source activate pandas-dev + doc/make.py --warnings-are-errors --single pandas.Series + doc/make.py --warnings-are-errors --single pandas.Series.value_counts + doc/make.py --warnings-are-errors --single pandas.Series.str.split + doc/make.py clean + - name: Build documentation run: | source activate pandas-dev diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index ce78c89a03afd..0688c1c9f23e3 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -33,6 +33,7 @@ programming language. --- :img-top: _static/index_getting_started.svg +{% if not single_doc -%} Getting started ^^^^^^^^^^^^^^^ @@ -96,7 +97,7 @@ programming language. :text: To the development guide :classes: btn-block btn-secondary stretched-link - +{% endif %} {% if single_doc and single_doc.endswith('.rst') -%} .. toctree:: :maxdepth: 3 From 77a92951c89eb0bc5b8a7a87af7c05256e7bc77c Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 24 Apr 2022 12:20:19 +0100 Subject: [PATCH 4/7] dont check Series in --single (attributes dont necessarily build) --- .github/workflows/docbuild-and-upload.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index 515f1796b8425..fa0a4c50d00bf 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -41,7 +41,6 @@ jobs: - name: Check building docs with --single works run: | source activate pandas-dev - doc/make.py --warnings-are-errors --single pandas.Series doc/make.py --warnings-are-errors --single pandas.Series.value_counts doc/make.py --warnings-are-errors --single pandas.Series.str.split doc/make.py clean From 28c6728eea7a7971bc2d470b11795def5f5a24bb Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 24 Apr 2022 13:56:00 +0100 Subject: [PATCH 5/7] move location of if --- doc/source/index.rst.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index 0688c1c9f23e3..022ff9edc1518 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -26,6 +26,7 @@ pandas documentation easy-to-use data structures and data analysis tools for the `Python `__ programming language. +{% if not single_doc -%} .. panels:: :card: + intro-card text-center :column: col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex @@ -33,7 +34,6 @@ programming language. --- :img-top: _static/index_getting_started.svg -{% if not single_doc -%} Getting started ^^^^^^^^^^^^^^^ From 820e984d13812c72c1594094df9b8d98517629e9 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sat, 30 Apr 2022 15:22:33 +0100 Subject: [PATCH 6/7] move check to code-checks.yml --- .github/workflows/code-checks.yml | 4 ++++ .github/workflows/docbuild-and-upload.yml | 7 ------- ci/code_checks.sh | 10 +++++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index a5fd72e343c16..6ce5a89d8fbbf 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -80,6 +80,10 @@ jobs: id: build uses: ./.github/actions/build_pandas + - name: Run checks on imported code + run: ci/code_checks.sh single-docs + if: ${{ steps.build.outcome == 'success' }} + - name: Run checks on imported code run: ci/code_checks.sh code if: ${{ steps.build.outcome == 'success' }} diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index fa0a4c50d00bf..8c2c86dc693a9 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -38,13 +38,6 @@ jobs: source activate pandas-dev python web/pandas_web.py web/pandas --target-path=web/build - - name: Check building docs with --single works - run: | - source activate pandas-dev - doc/make.py --warnings-are-errors --single pandas.Series.value_counts - doc/make.py --warnings-are-errors --single pandas.Series.str.split - doc/make.py clean - - name: Build documentation run: | source activate pandas-dev diff --git a/ci/code_checks.sh b/ci/code_checks.sh index c6d9698882f4d..8cc7ada5ce4b2 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -12,8 +12,9 @@ # $ ./ci/code_checks.sh doctests # run doctests # $ ./ci/code_checks.sh docstrings # validate docstring errors # $ ./ci/code_checks.sh typing # run static type analysis +# $ ./ci/code_checks.sh single-docs # check building docs with ``--single`` works -[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" ]] || \ +[[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" || "$1" == "single-docs" ]] || \ { echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|typing]"; exit 9999; } BASE_DIR="$(dirname $0)/.." @@ -102,4 +103,11 @@ if [[ -z "$CHECK" || "$CHECK" == "typing" ]]; then fi fi +### SINGLE-PAGE DOCS ### +if [[ -z "$CHECK" || "$CHECK" == "single-docs" ]]; then + python doc/make.py --warnings-are-errors --single pandas.Series.value_counts + python doc/make.py --warnings-are-errors --single pandas.Series.str.split + python doc/make.py clean +fi + exit $RET From 490f794929bc8b1cb3cf412cb2e219bdf5cad26b Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sat, 30 Apr 2022 15:38:00 +0100 Subject: [PATCH 7/7] fix section title --- .github/workflows/code-checks.yml | 2 +- ci/code_checks.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 6ce5a89d8fbbf..a27ed42c984bf 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -80,7 +80,7 @@ jobs: id: build uses: ./.github/actions/build_pandas - - name: Run checks on imported code + - name: Check for no warnings when building single-page docs run: ci/code_checks.sh single-docs if: ${{ steps.build.outcome == 'success' }} diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 8cc7ada5ce4b2..d7e685f8d055f 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -12,7 +12,7 @@ # $ ./ci/code_checks.sh doctests # run doctests # $ ./ci/code_checks.sh docstrings # validate docstring errors # $ ./ci/code_checks.sh typing # run static type analysis -# $ ./ci/code_checks.sh single-docs # check building docs with ``--single`` works +# $ ./ci/code_checks.sh single-docs # check single-page docs build warning-free [[ -z "$1" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "typing" || "$1" == "single-docs" ]] || \ { echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|typing]"; exit 9999; }