pip install git+https://github.com/psf/black
pip install isort
pip install Flake8-pyproject
isort .
black
flake8

black Getting Started - Black 23.12.1 documentation

flake8 忽略创建但是未使用

table = Table(  # noqa: F841
	get_case_table_name(task_id),
	meta,
	*columns,
	UniqueConstraint(
		"dataset_id",
		"dataset_data_id",
		name=f"_case_for_task_{task_id}_did_iid_uk",
	),
)
meta.create_all(shard_engine)
[tool.black]
line-length = 80
target-version = ['py39']
exclude='(__pycache__)|(^/label)|(^/logs)|(^/pids)|(^/resources)'
 
[tool.flake8]
max-line-length = 88
count=true
per-file-ignores="./annotation/manager.py:F401"
exclude=["./label", "__pycache__", "./migrations", "./logs", "./pids", "./resources"]
ignore=["W503", "E203"]
enable-extensions="G"
application-import-names=["flake8-isort", "flake8-logging-format", "flake8-builtins"]
import-order-style="edited"
 
[tool.isort]
py_version=39
profile="black"
multi_line_output=9
line_length=80
group_by_package=true
case_sensitive=true
skip_gitignore=true

VS Code:Python Flake8 與 Black Formatter 擴充套件快速上手 - Code and Me