@@ -31,18 +31,22 @@ The contents are as follows:
3131
3232* [ pycodestyle] ( #pycodestyle )
3333 * [ Installing pycodestyle] ( #installing-pycodestyle )
34+ * [ Verify pycodestyle version] ( #verify-pycodestyle-version )
3435 * [ Running pycodestyle] ( #running-pycodestyle )
3536* [ pylint] ( #pylint )
3637 * [ Installing pylint] ( #installing-pylint )
38+ * [ Verify pylint version] ( #verify-pylint-version )
3739 * [ Running pylint] ( #running-pylint )
3840 * [ Running pyreverse] ( #running-pyreverse )
3941* [ An example of using ` pylint ` and ` pycodestyle ` ] ( #an-example-of-using-pylint-and-pycodestyle )
4042* [ pydocstyle] ( #pydocstyle )
4143 * [ Installing pydocstyle] ( #installing-pydocstyle )
44+ * [ Verify pydocstyle version] ( #verify-pydocstyle-version )
4245 * [ Running pydocstyle] ( #running-pydocstyle )
4346* [ An example of using ` pydocstyle ` ] ( #an-example-of-using-pydocstyle )
4447* [ Black] ( #black )
4548 * [ Installing Black] ( #installing-black )
49+ * [ Verify Black version] ( #verify-black-version )
4650 * [ Running Black] ( #running-black )
4751* [ To Do] ( #to-do )
4852
@@ -60,7 +64,13 @@ improve.
6064
6165Run the following command:
6266
63- $ pip install --user pycodestyle
67+ $ pip3 install --user pycodestyle
68+
69+ #### Verify pycodestyle version
70+
71+ Verify the version as follows:
72+
73+ $ pycodestyle --version
6474
6575#### Running pycodestyle
6676
@@ -86,7 +96,13 @@ For anyone preparing to migrate code from Python 2 to Python 3, `pylint` will hi
8696
8797Run the following command:
8898
89- $ pip install --user -r requirements-pylint.txt
99+ $ pip3 install --user pylint
100+
101+ #### Verify pycodestyle version
102+
103+ Verify the version as follows:
104+
105+ $ pylint --version
90106
91107#### Running pylint
92108
@@ -104,8 +120,8 @@ In the example above, we are ignoring snake_case naming style - say to conform t
104120` benchmark ` or ` pytest ` coding conventions. We could also achieve the same result
105121 by annotating all of our offending code blocks as follows:
106122
107- ``` python
108- # !/usr/bin/env python
123+ ``` python3
124+ # !/usr/bin/env python3
109125
110126# pylint: disable=C0103
111127
@@ -140,12 +156,27 @@ Run `pyreverse` as follows:
140156
141157[ The default output format is ` dot ` , here we are specifying the graphic format ` png ` .]
142158
159+ For ` cpuinfo ` this looks as follows:
160+
161+ ``` bash
162+ $ cd ~ /.local/lib/python3.6/site-packages/cpuinfo
163+ $ pyreverse -f PUB_ONLY -o png -p cpuinfo * .py
164+ parsing cpuinfo.py...
165+ parsing __init__.py...
166+ parsing __main__.py...
167+ $
168+ ```
169+
170+ And the result looks as follows:
171+
172+ ![ cpuinfo] ( images/packages_cpuinfo.png )
173+
143174## An example of using ` pylint ` and ` pycodestyle `
144175
145176Here we will use a quick test case:
146177
147178``` bash
148- $ python bad-python.py
179+ $ python3 bad-python.py
149180This code does not follow ' pylint' file naming conventions!
150181This code does not follow ' pycodestyle' coding conventions!
151182$
@@ -164,15 +195,14 @@ And:
164195
165196``` bash
166197$ pylint * .py
167- No config file found, using default configuration
168198************* Module bad-python
169- C: 12, 0 : Trailing newlines (trailing-newlines)
170- C: 1, 0 : Module name " bad-python" doesn' t conform to snake_case naming style (invalid-name)
171- W: 7, 0 : String statement has no effect (pointless-string-statement)
172- W: 10, 0 : String statement has no effect (pointless-string-statement)
199+ bad-python.py:12:0: C0305 : Trailing newlines (trailing-newlines)
200+ bad-python.py:1:0: C0103 : Module name " bad-python" doesn' t conform to snake_case naming style (invalid-name)
201+ bad-python.py:7:0: W0105 : String statement has no effect (pointless-string-statement)
202+ bad-python.py:10:0: W0105 : String statement has no effect (pointless-string-statement)
173203
174- ---------------------------------------------------------------------
175- Your code has been rated at 0.00/10 (previous run: -10 .00/10, +10 .00)
204+ ------------------------------------------------------------------
205+ Your code has been rated at 0.00/10 (previous run: 0 .00/10, +0 .00)
176206
177207$
178208```
@@ -181,11 +211,10 @@ Or (disabling checks for snake_case naming):
181211
182212```bash
183213$ pylint --disable=C0103 *.py
184- No config file found, using default configuration
185214************* Module bad-python
186- C: 12, 0 : Trailing newlines (trailing-newlines)
187- W: 7, 0 : String statement has no effect (pointless-string-statement)
188- W: 10, 0 : String statement has no effect (pointless-string-statement)
215+ bad-python.py:12:0: C0305 : Trailing newlines (trailing-newlines)
216+ bad-python.py:7:0: W0105 : String statement has no effect (pointless-string-statement)
217+ bad-python.py:10:0: W0105 : String statement has no effect (pointless-string-statement)
189218
190219------------------------------------------------------------------
191220Your code has been rated at 2.50/10 (previous run: 0.00/10, +2.50)
@@ -203,6 +232,12 @@ Run the following command:
203232
204233 $ pip install --user pydocstyle
205234
235+ #### Verify pydocstyle version
236+
237+ Verify the version as follows:
238+
239+ $ pydocstyle --version
240+
206241#### Running pydocstyle
207242
208243Run `pydocstyle` as follows:
@@ -224,7 +259,7 @@ Again, we will use our test case:
224259
225260` ` ` bash
226261$ pydocstyle * .py
227- bad-python.py:1 at module level:
262+ bad-python.py:3 at module level:
228263 D200: One-line docstring should fit on one line with quotes (found 3)
229264$
230265` ` `
@@ -240,7 +275,7 @@ While not strictly a linter, having well-formatted code will save everyone a lot
240275Note that ` black` requires __Python 3.6__ or greater. Verify the version of ` python` as follows:
241276
242277` ` ` bash
243- $ python -V
278+ $ python3 -V
244279...
245280$
246281` ` `
269304
270305Run the following command:
271306
272- $ pip install --user black
307+ $ pip3 install --user black
273308
274309If using docker, this looks as follows:
275310
@@ -306,6 +341,12 @@ Successfully installed appdirs-1.4.3 attrs-19.3.0 black-19.10b0 click-7.0 pathsp
306341root@7ebc68fc6b42:/app#
307342` ` `
308343
344+ # ### Verify Black version
345+
346+ Verify the version as follows:
347+
348+ $ black --version
349+
309350# ### Running Black
310351
311352Run ` Black` as follows:
@@ -356,3 +397,4 @@ root@325bb7a3d2a3:/app#
356397- [x] Add notes on disabling specific ` pylint` rules
357398- [x] Add notes on disabling specific ` pylint` rules for a single line of code
358399- [x] Add notes on Black (code formatter)
400+ - [x] Update for recent Python 3 (__3.6.9__)
0 commit comments