Python 格式化

Black (Opinionated Formatter)

pip install blackInstall Black
black myfile.pyFormat file
black --check .Check without modifying
black --diff myfile.pyShow diff without applying
black --line-length 100 .Custom line length

isort (Import Sorting)

pip install isortInstall isort
isort myfile.pySort imports
isort --check-only .Check only
isort --profile black .Black-compatible profile

flake8 (Linting)

pip install flake8Install flake8
flake8 myfile.pyLint file
flake8 --max-line-length=100Set max line length
# noqa: E501Suppress specific rule on line