Changes between Version 33 and Version 34 of Submitting/Python


Ignore:
Timestamp:
Nov 17, 2020, 2:03:10 PM (4 years ago)
Author:
wenzeslaus
Comment:

Describe how to use Black and Flake8

Legend:

Unmodified
Added
Removed
Modified
  • Submitting/Python

    v33 v34  
    6262== Style ==
    6363
     64=== Indentation ===
     65
    6466Use 4-space indentation (GNU Emacs python-mode default). **Do not use tabs (tabulators) at all**.
    6567Note that Python determines nesting based upon indentation, so it is quite crucial to be consistent, i.e. use given rules.
    6668
     69=== Automation ===
     70
     71Use Black to format new files:
     72
     73
     74{{{
     75black python_file.py
     76}}}
     77
     78Use Flake8 to check formatting of all files:
     79
     80{{{
     81flake8 --extend-ignore=E203,E266,E501 --max-line-length=88 python_file.py
     82}}}
     83
     84If the file you changed gives too many error in lines you did not change,
     85see if the directory or any parent directory contains a file called .flake8 which
     86contains a less strict configuration for this legacy code.
     87Use it with the `--config` pararameter:
     88
     89{{{
     90flake8 --config {path_to_flake8_file} {path_to_python_file}
     91}}}
     92
     93For example like this:
     94
     95{{{
     96flake8 --config lib/python/.flake8 lib/python/temporal/register.py
     97}}}
    6798=== Editor settings for 4-space indentation ===
    6899