Skip to content

Developer

Gurhar Khalsa edited this page Jul 14, 2022 · 4 revisions

Python Formatting

To format Python code use the Black formatter through pykern.pkcli.fmt.

Running the formatter

pykern fmt run <pathname>

The above example will format the singular .py file that pathname contains, or if pathname is a directory it will format all .py files recursively

Getting and checking the diff

pykern fmt diff <pathname>

diff will show you the diff between the file/dir in pathname and a formatted version of that file/dir, if there is any

pykern fmt check <pathname> 

check will trigger an exception if there is diff

Continuous integration

Source in pykern.pkcli.ci

Checking for prints

pykern ci check_prints

check_prints recursively checks repo for (naked) print and pkdp calls

Running continuous integrations checks and tests

pykern ci run

run will run continuous integration checks and tests. It calls check_prints, checks the formatting, and then runs pykern.pkcli.test.default_command