Skip to content

Commit 29c2016

Browse files
committed
updates to README
1 parent ed48224 commit 29c2016

File tree

3 files changed

+60
-542
lines changed

3 files changed

+60
-542
lines changed

python/README.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Install the packages for the example by running the following:
7474
python -m pip install -r requirements.txt
7575
```
7676

77-
This installs all of the packages listed in the `requirements.txt` file in the current
77+
This installs all the packages listed in the `requirements.txt` file in the current
7878
folder.
7979

8080
### Run the code
@@ -90,6 +90,44 @@ Some examples require command line arguments. In these cases, you can run the ex
9090
with a `-h` flag to get help. Each example has a README.md that describes additional
9191
specifics about how to run the example and any other prerequisites.
9292

93+
## Linting and formatting
94+
We rely on [pylint](https://pylint.pycqa.org/en/latest/) and [black](https://black.readthedocs.io/en/stable/) to keep this code consistently formatted and styled.
95+
To contribute Python code to this project, please refer to the following installation and usage steps.
96+
97+
### Using Pylint
98+
We run Pylint using [a custom configuration file](.github/linters/.python-lint) against any changed file or directory. See the [Python Github Action workflow](../.github/workflows/python.yml) for details.
99+
100+
To invoke Pylint yourself, first install it with `pip install pylint`.
101+
102+
Next, run:
103+
104+
```bash
105+
pylint --rcfile=.github/linters/.python-lint path/to/python/file_or_directory
106+
```
107+
108+
To lint all Python files in the current directory and its subdirectories, run:
109+
110+
```bash
111+
pylint --rcfile=.github/linters/.python-lint .
112+
```
113+
114+
### Using Black
115+
We run Black against any changed file or directory. See the [Python Github Action workflow](../.github/workflows/python.yml) for details.
116+
117+
To invoke Black yourself, first install it with `pip install black`.
118+
119+
Next, run:
120+
121+
```bash
122+
black path/to/python/file_or_directory
123+
```
124+
125+
To format all Python files in the current directory and its subdirectories, run:
126+
127+
```bash
128+
black .
129+
```
130+
93131
## Tests
94132

95133
All tests use Pytest, and you can find them in the `test` folder for each example.

0 commit comments

Comments
 (0)