- update your forked repo from my repo(ref)
- following 01_git, create a new branch
LAST#_04pep8
(ex: pan667_04pep8) in your forked repo - activate the environment you created in 03_conda
- install flake8, black, and isort
- take a look at file
setup.cfg
and try to understand each setting forflake8
- copy the file
code.py
tosubmissions/
and rename it asLAST#.py
- run flake8 on
LAST#.py
and you will see some warnings - In the warnings, you should see line 33, 34, and 35 are too long. Open
LAST#.py
and you should see these three lines correspond to three dummy lists (if you usevim
to open the file, type:set nu
to show the line numbers). Now add something on these three lines to makeflake8
ignore them. Save the file and runflake8
again, you should see the warnings are gone. - run
black --help
and go through the meaning of each option (flag) - run
black
withdiff
andcolor
flag and set the line length to 100. These two flags will show the difference without making modification yet. You should seeblack
is trying to fix three dummy lists again. OpenLAST#.py
and add something on these three lines to makeblack
ignore them. Save the file and runblack
with same flags again, you should see they are ignored. - run
black
with line length 100 on the file to make modificatoin in place - run
flake8
again and you should see some warnings were fixed byblack
- take a look at file
setup.cfg
and try to understand each setting forisort
- run
isort
with flagdiff
to review the modification first and runisort
again to modify the file in place (similar toblack
) - run
flake8
again and you should still see some warnings. This meansblack
andisort
can't fix everything. - fix the code yourself unitil flake8 shows no warnings
- finally run
black
with line length 100,isort
, andflake8
again because you may touch something in the previous step - stage changes, commit with the message "learning pep8", push and submit a pr
04_pep8
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||