#!/usr/bin/env python # coding: utf-8 # # pep257 # # # ## a static linter for docstring conventions # # # # Amir Rachum # PyWeb-IL 45 # In[ ]: # kennethreitz/requests """ Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` """ # In[ ]: # cool-RR/python_toolbox ''' Defines the `profile_ready` decorator. See its documentation for more details. ''' # In[ ]: # docopt/docopt """Expand pattern into an (almost) equivalent one, but with single Either. Example: ((-a | -b) (-c | -d)) => (-a -c | -a -d | -b -c | -b -d) Quirks: [-a] => (-a), (-a...) => (-a -a) """ # In[ ]: # django/django """ Output the approximate number of changed/added strings in the en catalog. """ # In[ ]: # kumar303/disable-docstring """THIS IS FAIL""" # ## Who can say which convention is better? # #Guido. Guido can. # #PEP257 Examples # * One-liners should fit on one line. # * All *public* modules, classes, methods and functions should be documented. # * 1 blank line required after class docstring. # * The first line of a method or function docstring should begin with an imperative verb. # * And so forth... # In[4]: get_ipython().run_cell_magic('bash', '', 'pep257 test.py 2>&1 >/dev/null | head\n') # In[8]: get_ipython().run_cell_magic('bash', '', 'pep257 test.py --explain 2>&1 >/dev/null | head \n') # In[16]: get_ipython().run_cell_magic('bash', '', 'pep257 test.py --source --ignore=D100,D101,D102,D103 2>&1 >/dev/null | head -n8\n') # In[17]: get_ipython().run_cell_magic('bash', '', 'pep257 --help\n') # # What Else? # * Static analysis - it does not import your code (safe from side effects) # * No dependencies (for now). Install via `pip install pep257`. # * Integrates with `flake8` via `flake8-docstrings`. # * Coming up: better error selection, to support several "convention sets", such as pep257, numpy, _your own_. # * Authored by Vladimir Keleshev (of `docopt` notoriety) # * I am currently the sole maintainer # In conclusion: # # #Conventions are arbitrary, # #so use this one. # ### Thanks for listening # # ## `https://github.com/GreenSteam/pep257` # # # Amir Rachum # amir@rachum.com