22
loading...
This website collects cookies to deliver better user experience
print("hello" )
.$ pip install black
$ black my-sample.py
reformatted my-sample.py
All done! ✨ 🍰 ✨
1 file reformatted.
$ pip install flake8
$ flake8 my-sample.py
my-sample.py:1:14: E202 whitespace before ')'
.format()
to using f-strings or checking that your naming follows the PEP8 guidelines. For example, adding flake8-length
adds line length checking to the linting.$ pip install flake8-length
$ flake8 test.py
test.py:1:80: LN001 line is too long (169 > 79)
def return_hello(name: str) -> int:
return f'Hello, {name}!'
$ pip install mypy
$ mypy my-sample.py
my-sample.py:2: error: Incompatible return value type (got "str", expected "int")
Found 1 error in 1 file (checked 1 source file)
name: Check import order
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install isort
run: |
python -m pip install --upgrade pip
pip install isort
- name: Check import order
run: isort . -c -v