Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit e6c9148

Browse files
committed
Final formatting changes. Looking good.
Just missing a TLDR for Python.
1 parent 6e65450 commit e6c9148

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

python/README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Python Coding Style 🐍
22

33
We follow [PEP8](http://www.python.org/dev/peps/pep-0008/) with an additional
4-
standard for import ordering:
4+
standard for ordering imports:
55

66
```python
7-
# Standard libraries ordered alphabetically.
7+
# First, standard libraries ordered alphabetically.
88
import abc
99
import urlparse
1010

11-
# Third party libraries.
11+
# Second, third-party libraries.
1212
import requests
1313

14-
# Project libraries, using using relative paths where applicable.
14+
# Third, project libraries, using using relative paths where applicable.
1515
from . import mymodule
1616
```
1717

@@ -24,28 +24,25 @@ one or more directories or files:
2424

2525
```bash
2626
pip install pep8
27+
2728
pep8 portal/core/admin.py # Check a file
2829
pep8 portal/mailers # Check a folder
2930
```
3031

3132
### PEP8 in Editors
3233

33-
**PyCharm**
34-
35-
Enable `PEP8 Coding Style violation` and `PEP8 Naming Convention violation`
36-
inspection rules.
37-
38-
**Sublime Text**
39-
40-
Install a PEP8 plugins: [PEP8 Autoformat](https://packagecontrol.io/packages/Python%20PEP8%20Autoformat) or
41-
[Sublime Linter PEP8](https://packagecontrol.io/packages/SublimeLinter-pep8).
34+
* **PyCharm**: Enable `PEP8 Coding Style violation` and `PEP8 Naming Convention violation`
35+
inspection rules.
36+
* **Sublime Text**: Install a PEP8 plugins: [PEP8 Autoformat](https://packagecontrol.io/packages/Python%20PEP8%20Autoformat) or
37+
[Sublime Linter PEP8](https://packagecontrol.io/packages/SublimeLinter-pep8).
4238

4339
### Resolving PEP8 Errors 🛠
4440

45-
Probably the best solution is [`autopep8`](https://pypi.python.org/pypi/autopep8):
41+
Use [`autopep8`](https://pypi.python.org/pypi/autopep8):
4642

4743
```bash
4844
pip install autopep8
45+
4946
autopep8 --diff portal/core/admin.py # Spot issues and generate a diff
5047
autopep8 --in-place portal/core/admin.py # Fix issues in a file
5148
autopep8 -i portal/core/* # Fix issues in a folder
@@ -54,17 +51,17 @@ autopep8 -i portal/core/* # Fix issues in a folder
5451
find portal/core -name '*.py' -print -exec autopep8 --in-place {} \;
5552
```
5653

57-
If fixing PEP8 issues obscures changes from reviewers, use
58-
[`pep8radius`](https://pypi.python.org/pypi/pep8radius) to apply `autopep8` to
59-
only modified areas:
54+
Use [`pep8radius`](https://pypi.python.org/pypi/pep8radius) limit fixes to areas
55+
that were modified:
6056

6157
```bash
6258
pip install pep8radius
59+
6360
pep8radius -vv --in-place
6461
```
6562

66-
`pep8radius` uses `git` to check files which have been modified but not commited
67-
so make sure to use it *before* you commit.
63+
`pep8radius` uses `git` to find changes in files that were modified but not
64+
commited. Use it *before* you commit.
6865

6966
## Code Inspection 🕵
7067

@@ -99,7 +96,7 @@ and it will be used when `pylint` is run from there:
9996
pylint --rcfile=pylint.rc mystuff/myapp/myfile.py
10097
```
10198

102-
### Fixing PyLint Messages
99+
#### Fixing PyLint Messages
103100

104101
Fix the message or disable:
105102

@@ -120,7 +117,7 @@ Message codes can be found [here](http://pylint-messages.wikidot.com/all-codes).
120117
Disable works for the block in which they are found, so include it at the module
121118
level to disable a message for a module or file.
122119

123-
## Pyflakes
120+
### Pyflakes
124121

125122
Pyflakes is another pip-installable code analysis tool that focuses on
126123
identifying coding issues (and less on code layout and formatting). _"Pyflakes

0 commit comments

Comments
 (0)