Skip to content

Commit c35226f

Browse files
authored
Check 2 (ssciwr#13)
* more fixes - part 1 complete * more fixes - part 2 * update part 3 * update task description
1 parent 5261c1b commit c35226f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Material_Part3_Formatter/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,29 @@ flake8 Material_Part3_Formatter/example1.py
1717
```
1818
You will notice that flake8 is not returning errors except a line length error for one of the comment lines: Note that black does not reformat comments other than inserting proper whitespace before and after the #.
1919

20+
**Task 1: Reformat [`example1.py`](https://github.com/ssciwr/Python-best-practices-course/blob/main/Material_Part3_Formatter/example1.py) and [`example2.py`](https://github.com/ssciwr/Python-best-practices-course/blob/main/Material_Part3_Formatter/example2.py) using black. Compare to your own reformatted files.**
21+
2022
## Black configuration
2123
Sometimes you only want to check what black would actually reformat. In order to do so, run
2224
```
23-
black Material_Part2_Formatter/example1.py --diff
25+
black Material_Part3_Formatter/example1.py --diff
2426
```
2527
or
2628
```
27-
black Material_Part2_Formatter/example1.py --diff --color
29+
black Material_Part3_Formatter/example1.py --diff --color
2830
```
31+
**Task 2: Try this out with your own reformatted files from Part 1 of this course (PEP styleguide).**
2932

3033
## Black with jupyter notebooks
3134
To use black with jupyter notebooks, you need to install the extension using
3235
```
33-
pip install 'black[jupyter]'
36+
pip install black[jupyter]
3437
```
3538

39+
**Task 3: Try out the notebook extension with [this example](https://github.com/ssciwr/Python-best-practices-course/blob/main/Material_Part3_Formatter/example_jupyter.ipynb).**
40+
3641

3742
## Black with VSCode
3843
If you are using an IDE, specifically [Visual Studio Code](https://code.visualstudio.com/), you can set up black as the default formatter for your `*.py` files. Follow the instructions provided [here](https://dev.to/adamlombard/how-to-use-the-black-python-code-formatter-in-vscode-3lo0).
3944

40-
For more tipps and tricks, see [this page](https://code.visualstudio.com/docs/python/editing).
45+
For more tips and tricks, see [this page](https://code.visualstudio.com/docs/python/editing).

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
flake8
22
black
33
numpy
4-
pandas
4+
pandas
5+
flake8-nb
6+
black[jupyter]

0 commit comments

Comments
 (0)