globality-black tech talk
2021-12-09
TABLE OF CONTENTS
01 | Context
02 | Black and the magic comma
02 | globality-black
03 | Usage
04 | How to adopt
2
Copyright © 2020 Globality, Inc.
Context
3
Copyright © 2021 Globality, Inc.
Horizontal spacing
4
Copyright © 2021 Globality, Inc.
Comprehensions
5
Copyright © 2021 Globality, Inc.
More examples
6
Copyright © 2021 Globality, Inc.
Context
7
Copyright © 2021 Globality, Inc.
Black
Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.
8
Copyright © 2021 Globality, Inc.
The magic comma
Always explode if there is a trailing comma. Otherwise explode depending on whether it fits the max line length (default for black = 88 characters).
9
Copyright © 2021 Globality, Inc.
fmt: off – fmt: on
An automated tool will never handle well 100% of the cases. We can explicitly �protect portions of code
but without protection ...
10
Copyright © 2021 Globality, Inc.
Black
Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.
but:
11
Copyright © 2021 Globality, Inc.
Well done, black
12
Copyright © 2021 Globality, Inc.
Oh no, black: comprehensions
13
Copyright © 2021 Globality, Inc.
Oh no, black: blank lines
14
Copyright © 2021 Globality, Inc.
Oh no, black: dotted chains
15
Copyright © 2021 Globality, Inc.
globality-black
16
1 All info here explained in the README
Copyright © 2021 Globality, Inc.
globality-black
17
1 All info here explained in the README
2 Only .py in package (excluding notebooks) and excluding __init__ files
Success stories | lines of code 2 | files 2 | # fmt: off |
Project 1 | 10k | 100 | 7 |
Project 2 | 5.6k | 45 | 10 |
Project 3 | 7k | 80 | 0 |
Project 4 | 10k | 65 | 14 |
Project 5 | 2.4k | 40 | 2 |
Project 6 | 23k | 258 | 5 |
Copyright © 2021 Globality, Inc.
Usage
See section in README
18
Copyright © 2021 Globality, Inc.
FAQ
19
1 See FAQ section in the README
2 To achieve this, git is installed if use_globality_black
Copyright © 2021 Globality, Inc.
FAQ
20
1 See FAQ section in the README
2 To achieve this, git is installed if use_globality_black
Copyright © 2021 Globality, Inc.
21
THANK YOU
and some credit to @pokey who helped with
the first prototype of globality-black
Copyright © 2021 Globality, Inc.