@@ -210,16 +210,47 @@ To automatically update and pin new dependencies, run:
210
210
211
211
### Python
212
212
213
- You can run Python code locally by updating generated files in the python directory using:
213
+ #### Linting
214
+
215
+ We follow the [ PEP8 Style Guide for Python Code] ( https://peps.python.org/pep-0008 ) (except we use a 120 character line length).
216
+ This is checked and enforced with several linting tools, including
217
+ [ black] ( https://pypi.org/project/black ) ,
218
+ [ docformatter] ( https://pypi.org/project/docformatter ) ,
219
+ [ flake8] ( https://flake8.pycqa.org ) ,
220
+ and [ isort] ( https://pycqa.github.io/isort ) .
221
+
222
+ To run all of the linting tools:
214
223
``` shell
215
- ./go py:update
224
+ ./go py:lint
216
225
```
217
226
218
- To install Selenium locally based on a specific commit, you can use:
227
+ You need ` tox ` installed to run the linting tools (` pip install tox ` ).
228
+
229
+ #### Local Installation
230
+
231
+ To run Python code locally without building/installing the package, you must first install the dependencies:
232
+ ``` shell
233
+ pip install -r py/requirements.txt
234
+ ```
235
+
236
+ Then, build the generated files and copy them into your local source tree:
237
+ ``` shell
238
+ ./go py:local_dev
239
+ ```
240
+
241
+ After that, you can import the selenium package directly from source from the ` py ` directory.
242
+
243
+ Instead of running from source, you can build and install the selenium package (wheel) locally:
219
244
``` shell
220
245
./go py:install
221
246
```
222
247
248
+ This will attempt to install into the global Python ` site-packages ` directory,
249
+ which might not be writable. To avoid this, you should create and activate a
250
+ [ virtual environment] ( https://packaging.python.org/en/latest/tutorials/installing-packages/#creating-virtual-environments )
251
+ before installing.
252
+
253
+
223
254
### Ruby
224
255
225
256
Instead of using ` irb ` , you can create an interactive REPL with all gems loaded using: ` bazel run //rb:console `
0 commit comments