From 075a069ea5bb27160118f0e0d268d6220bb4c49e Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Mon, 12 Jan 2026 17:31:37 +0000 Subject: [PATCH 1/8] Add idle help check to CI --- .github/workflows/build.yml | 15 ++++++- .github/workflows/reusable-docs.yml | 6 +++ .github/workflows/reusable-idle-help-doc.yml | 45 ++++++++++++++++++++ Doc/Makefile | 5 +++ Lib/idlelib/help.html | 8 +++- Lib/idlelib/help.py | 37 ---------------- Tools/build/generate_idle_help.py | 41 ++++++++++++++++++ 7 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/reusable-idle-help-doc.yml create mode 100644 Tools/build/generate_idle_help.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6769cdd4531a0c..225526aeec686f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,11 @@ jobs: if: fromJSON(needs.build-context.outputs.run-docs) uses: ./.github/workflows/reusable-docs.yml + check-idle-help-doc: + name: "Check if IDLE's help.html is up to date" + needs: check-docs + uses: ./.github/workflows/reusable-idle-help-doc.yml + check-autoconf-regen: name: 'Check if Autoconf files are up to date' # Don't use ubuntu-latest but a specific version to make the job @@ -711,8 +716,16 @@ jobs: build-ubuntu-ssltests-openssl, test-hypothesis, cifuzz, + check-idle-help-doc, allowed-skips: >- - ${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }} + ${{ + !fromJSON(needs.build-context.outputs.run-docs) + && ' + check-docs, + check-idle-help-doc, + ' + || '' + }} ${{ needs.build-context.outputs.run-tests != 'true' && ' diff --git a/.github/workflows/reusable-docs.yml b/.github/workflows/reusable-docs.yml index 65154aae4c41d5..d855d2c3288fb9 100644 --- a/.github/workflows/reusable-docs.yml +++ b/.github/workflows/reusable-docs.yml @@ -75,6 +75,12 @@ jobs: --fail-if-regression \ --fail-if-improved \ --fail-if-new-news-nit + - name: 'Upload built idle.html' + uses: actions/upload-artifact@v4 + with: + name: idle-html + path: Doc/build/html/library/idle.html + retention-days: 1 # Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release doctest: diff --git a/.github/workflows/reusable-idle-help-doc.yml b/.github/workflows/reusable-idle-help-doc.yml new file mode 100644 index 00000000000000..9f1ecdb2fb64ed --- /dev/null +++ b/.github/workflows/reusable-idle-help-doc.yml @@ -0,0 +1,45 @@ +name: Reusable check if IDLE's help.html is up to date + +on: + workflow_call: + +permissions: + contents: read + +env: + FORCE_COLOR: 1 + +jobs: + check-idle-doc-sync: + name: 'Check IDLE help.html sync' + runs-on: ubuntu-latest + timeout-minutes: 10 # XXX run and possibly lower! + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: 'Download built idle.html' + uses: actions/download-artifact@v4 + with: + name: idle-html + path: Doc/build/html/library + - name: 'Set up Python' + uses: actions/setup-python@v5 + with: + python-version: '3' + - name: 'Regenerate Lib/idlelib/help.html' + run: python Tools/build/generate_idle_help.py + working-directory: Doc + - name: 'Check for changes' + run: | + git add -u + changes=$(git status --porcelain) + # Check for changes in regenerated files + if test -n "$changes"; then + echo "Generated files not up to date." + echo "Perhaps you forgot to run make idlehelp ;)" + echo "$changes" + echo "" + git diff --staged || true + exit 1 + fi diff --git a/Doc/Makefile b/Doc/Makefile index 4d605980a62904..477d7eeabd503a 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -46,6 +46,7 @@ help: @echo " coverage to check documentation coverage for library and C API" @echo " doctest to run doctests in the documentation" @echo " pydoc-topics to regenerate the pydoc topics file" + @echo " idlehelp to regenerate Lib/idlelib/help.html" @echo " dist to create a \"dist\" directory with archived docs for download" @echo " check to run a check for frequent markup errors" @@ -143,6 +144,10 @@ pydoc-topics: build "cp build/pydoc-topics/topics.py ../Lib/pydoc_data/topics.py" \ "&& cp build/pydoc-topics/module_docs.py ../Lib/pydoc_data/module_docs.py" +.PHONY: idlehelp +idlehelp: html + $(PYTHON) ../Tools/build/generate_idle_help.py + .PHONY: gettext gettext: BUILDER = gettext gettext: override SPHINXOPTS := --doctree-dir build/doctrees-gettext $(SPHINXOPTS) diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index fc618ab727d1fb..9eb18d8f39b7c6 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -16,6 +16,12 @@ of global and local namespaces

  • configuration, browsers, and other dialogs

  • +

    The IDLE application is implemented in the idlelib package.

    +

    This is an optional module. +If it is missing from your copy of CPython, +look for documentation from your distributor (that is, +whoever provided Python to you). +If you are the distributor, see Requirements for optional modules.