From 3db7df44b6c73e7aea16dc887845b66edfe357de Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 16 Jul 2026 13:23:48 -0400 Subject: [PATCH 1/3] [py] Include generated code when publishing API docs to RtD --- py/docs/.readthedocs.yaml | 46 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/py/docs/.readthedocs.yaml b/py/docs/.readthedocs.yaml index f42dd933bb524..d9653a9de3935 100644 --- a/py/docs/.readthedocs.yaml +++ b/py/docs/.readthedocs.yaml @@ -11,11 +11,45 @@ build: os: ubuntu-24.04 tools: python: "3.12" + commands: - - pip install -r py/requirements_lock.txt - - cd py && python3 generate_api_module_listing.py && cd - - PYTHONPATH=py sphinx-autogen -o $READTHEDOCS_OUTPUT/html py/docs/source/api.rst - - PYTHONPATH=py sphinx-build -b html -d build/docs/doctrees py/docs/source $READTHEDOCS_OUTPUT/html + - | + set -euo pipefail + + REPO_DIR="$(pwd)" + PACKAGE="selenium" + VERSION="$( + curl -fsSL "https://test.pypi.org/pypi/${PACKAGE}/json" | + sed -n 's/.*"version":"\([^"]*\)".*/\1/p' | + head -n1 + )" + URL="$( + curl -fsSL "https://test.pypi.org/pypi/${PACKAGE}/${VERSION}/json" | + sed -n 's/.*"url":"\([^"]*\.tar\.gz\)".*/\1/p' | + head -n1 + )" + SDIST="$(basename "${URL}")" + + # install dependencies + pip install -r "${REPO_DIR}/py/requirements_lock.txt" + + # fetch latest nightly sdist tarball from TestPyPI + curl -fsSLOJ "${URL}" + + # overlay packaged/generated code from the sdist into the repo checkout + tar -xzf "${SDIST}" + cp -a "${SDIST%.tar.gz}/selenium/." "${REPO_DIR}/py/${PACKAGE}/" + + # remove extracted sdist contents + rm -rf "${SDIST%.tar.gz}" "${SDIST}" + + # generate new .rst with API modules + cd "${REPO_DIR}/py" && python3 "generate_api_module_listing.py" && cd .. + + export PYTHONPATH="${REPO_DIR}/py:${PYTHONPATH:-}" + + # generate doc stubs + sphinx-autogen -o "${READTHEDOCS_OUTPUT}/html" "py/docs/source/api.rst" -sphinx: - configuration: py/docs/source/conf.py + # build docs + sphinx-build -b html -d build/docs/doctrees py/docs/source ${READTHEDOCS_OUTPUT}/html From 8257e2ea506701b538177fe94901f6627f4fc577 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 17 Jul 2026 10:46:58 -0400 Subject: [PATCH 2/3] make version parsing more tolerant --- py/docs/.readthedocs.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/py/docs/.readthedocs.yaml b/py/docs/.readthedocs.yaml index d9653a9de3935..564dcd20c4a03 100644 --- a/py/docs/.readthedocs.yaml +++ b/py/docs/.readthedocs.yaml @@ -20,12 +20,13 @@ build: PACKAGE="selenium" VERSION="$( curl -fsSL "https://test.pypi.org/pypi/${PACKAGE}/json" | - sed -n 's/.*"version":"\([^"]*\)".*/\1/p' | + sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1 )" + URL="$( curl -fsSL "https://test.pypi.org/pypi/${PACKAGE}/${VERSION}/json" | - sed -n 's/.*"url":"\([^"]*\.tar\.gz\)".*/\1/p' | + sed -n 's/.*"url"[[:space:]]*:[[:space:]]*"\([^"]*\.tar\.gz\)".*/\1/p' | head -n1 )" SDIST="$(basename "${URL}")" From 416b1234f8f3c6a65fcbf4a5df5cb28e7195b61c Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 17 Jul 2026 10:49:42 -0400 Subject: [PATCH 3/3] use stable download name --- py/docs/.readthedocs.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/py/docs/.readthedocs.yaml b/py/docs/.readthedocs.yaml index 564dcd20c4a03..c3655d0eff3e3 100644 --- a/py/docs/.readthedocs.yaml +++ b/py/docs/.readthedocs.yaml @@ -23,7 +23,6 @@ build: sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1 )" - URL="$( curl -fsSL "https://test.pypi.org/pypi/${PACKAGE}/${VERSION}/json" | sed -n 's/.*"url"[[:space:]]*:[[:space:]]*"\([^"]*\.tar\.gz\)".*/\1/p' | @@ -35,7 +34,7 @@ build: pip install -r "${REPO_DIR}/py/requirements_lock.txt" # fetch latest nightly sdist tarball from TestPyPI - curl -fsSLOJ "${URL}" + curl -fsSL -o "${SDIST}" "${URL}" # overlay packaged/generated code from the sdist into the repo checkout tar -xzf "${SDIST}"