From 52a315ef6f1a421251c103d109bcf3ab7eea04ca Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 14 Mar 2025 18:41:20 -0400 Subject: [PATCH 1/3] Update README to fix/expand Python development instructions --- README.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5ba50ed90968d..c59bd15b17398 100644 --- a/README.md +++ b/README.md @@ -210,16 +210,47 @@ To automatically update and pin new dependencies, run: ### Python -You can run Python code locally by updating generated files in the python directory using: +#### Linting + +We follow the [PEP8 Style Guide for Python Code](https://peps.python.org/pep-0008) (except we use a 120 character line length). +This is checked and enforced with several linting tools, including +[black](https://pypi.org/project/black), +[docformatter](https://pypi.org/project/docformatter), +[flake8](https://flake8.pycqa.org), +and [isort](https://pycqa.github.io/isort). + +To run all of the linting tools: ```shell -./go py:update +./go py:lint ``` -To install Selenium locally based on a specific commit, you can use: +You need `tox` installed to run the linting tools (`pip install tox`). + +#### Local Installation + +To run Python code locally without building/installing the package, you must first install the dependencies: +```shell +pip install -r py/requirements.txt +``` + +Then, you can update the generated files: +```shell +./go py:local_dev +``` + +Then, you can import the selenium package directly from source from the `py` directory. + +To build the selenium package (wheel) and and install it locally: ```shell ./go py:install ``` +This will attempt to install into the global Python `site-packages` directory, +which might not be writable. To avoid this, you should create and activate a +[virtual environment](https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments) +before installing. + + ### Ruby Instead of using `irb`, you can create an interactive REPL with all gems loaded using: `bazel run //rb:console` From e99ca292caa7769ce2cbebe858ffc942920308a6 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 14 Mar 2025 18:45:04 -0400 Subject: [PATCH 2/3] Update wording in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c59bd15b17398..2606e0226328c 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ To run Python code locally without building/installing the package, you must fir pip install -r py/requirements.txt ``` -Then, you can update the generated files: +Then, update the generated files: ```shell ./go py:local_dev ``` From fb707ca53ef22186728baea6b10a225a49e77e83 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 14 Mar 2025 18:47:58 -0400 Subject: [PATCH 3/3] Update wording in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2606e0226328c..9a8eb21c2b0dc 100644 --- a/README.md +++ b/README.md @@ -233,14 +233,14 @@ To run Python code locally without building/installing the package, you must fir pip install -r py/requirements.txt ``` -Then, update the generated files: +Then, build the generated files and copy them into your local source tree: ```shell ./go py:local_dev ``` -Then, you can import the selenium package directly from source from the `py` directory. +After that, you can import the selenium package directly from source from the `py` directory. -To build the selenium package (wheel) and and install it locally: +Instead of running from source, you can build and install the selenium package (wheel) locally: ```shell ./go py:install ```