Skip to content

Code Formatting

John Pocock edited this page May 12, 2021 · 4 revisions

We use Black. Please cede formatting control to Black.

Version

Please ensure that you are using the version of black in the requirements files. Check your version with black --version.

Command Line Usage

To format a single file:

black file.py

To format all .py files in the current directory:

black ./

Editor Plugins

https://black.readthedocs.io/en/stable/editor_integration.html

File Structure

  • Docstring at the top

  • Module imports

    • First tiatoolbox import and then external libraries
  • Class definition

  • Function definition

  • Version definition

 

 

 

Clone this wiki locally