Complete code example that demonstrates all PEP-8 rules
I tend to look at code from established projects with contributor policies including PEP. Here are some examples:
sklearn:
- Feature selection _from_model.py
- logistic.py
- Gaussian process _gpr.py
Keras: training.py
Flask: sessions.py
In the examples here, Keras and Flask allow lines longer than 80 characters when necessary which seems common in other projects too. scikit-lean seems to conform exactly in the examples I've seen.
I think this is quite a good example for docstring: Napoleon. Though it's Google's take on docstring rather than official Python.
Get PyDev in Eclipse, the new version include support to make sure that your document is PEP8 compliant and will give warnings on each violation.
You could use Eclipse, the last versions (>2.3.0) of Pydev can include the pep8 checker, so the check will be done in real-time. As soon you wrote the code, the checker will verify it.
Here's a gist which claims to be a cheatsheet:
https://gist.github.com/RichardBronosky/454964087739a449da04