From d8caae65463f528c63ee2959b7570312f991b896 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 19 Jun 2025 17:16:33 -0400 Subject: [PATCH 1/2] [py] Skip devtools in API docs --- py/docs/source/index.rst | 2 +- py/generate_api_module_listing.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/py/docs/source/index.rst b/py/docs/source/index.rst index c61c77977796a..112a17f959936 100644 --- a/py/docs/source/index.rst +++ b/py/docs/source/index.rst @@ -23,7 +23,7 @@ The `selenium` package is used to automate web browser interaction from Python. | **API Docs**: | `api.html `_ | +-------------------+------------------------------------------------+ -Updated documentation published with each commit is available at: https://selenium-python-api-docs.readthedocs.io +Updated documentation published with each commit is available at: `readthedocs.io `_ ---- diff --git a/py/generate_api_module_listing.py b/py/generate_api_module_listing.py index b2168545bda3d..9547dddbe1595 100644 --- a/py/generate_api_module_listing.py +++ b/py/generate_api_module_listing.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. + # ----------------------------------------------------------------- # This script recursively scans the `selenium` package directory # to find all modules, then generates the `py/docs/source/api.rst` @@ -47,8 +48,8 @@ def find_modules(package_name): package_name = "selenium" output_file = os.path.join("docs", "source", "api.rst") print(f"generating module list for sphinx autodoc in: {output_file}\n") - modules = find_modules(package_name) - base_modules = [mod for mod in sorted(set(module.rsplit(".", 1)[0] for module in modules)) if mod != package_name] + modules = [module for module in find_modules(package_name) if ".devtools." not in module] + base_modules = [mod for mod in sorted({module.rsplit(".", 1)[0] for module in modules}) if mod != package_name] print("found sections:") for base_module in base_modules: print(f" {base_module}") From 20a59626f13795064d7a49a0c7f1f84b71bbe4af Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 19 Jun 2025 17:24:57 -0400 Subject: [PATCH 2/2] [py] Change comment to docstring --- py/generate_api_module_listing.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/py/generate_api_module_listing.py b/py/generate_api_module_listing.py index 9547dddbe1595..90408f823a86f 100644 --- a/py/generate_api_module_listing.py +++ b/py/generate_api_module_listing.py @@ -16,13 +16,12 @@ # under the License. -# ----------------------------------------------------------------- -# This script recursively scans the `selenium` package directory -# to find all modules, then generates the `py/docs/source/api.rst` -# file containing a listing of all modules in separate sections. -# The `api.rst` file is later used by `sphinx-autogen` to generate -# sphinx autodoc stub pages used in the Python API documentation. -# See `py/tox.ini` for how it is invoked. +"""This script recursively scans the `selenium` package directory +to find all modules, then generates the `py/docs/source/api.rst` +file containing a listing of all modules in separate sections. +The `api.rst` file is later used by `sphinx-autogen` to generate +sphinx autodoc stub pages used in the Python API documentation. +See `py/tox.ini` for how it is invoked.""" import os import site