Files
tsl-devkit/docs/python/tooling.md
T
csh eada742d75 Squashed 'docs/standards/playbook/' content from commit e504a68
git-subtree-dir: docs/standards/playbook
git-subtree-split: e504a689dcf2e2fdeeb64097930347d504e68f5f
2025-12-14 17:55:55 +08:00

823 B
Raw Blame History

Python 工具链(Tooling

本 Playbook 推荐用以下工具保证代码一致性与质量:

  • black:格式化(行宽 80
  • isortimport 排序(Google profile
  • flake8:风格检查 + docstring 约定
  • pylint:静态检查(以 .pylintrc 为准,可按项目调整)
  • mypy:类型检查(可选)
  • pytest:测试(可选)
  • pre-commit:在 git commit 前自动运行上述检查/格式化(可选,但推荐)

常用命令(示例)

安装工具(示例,按项目实际依赖管理方式调整):

python -m pip install black isort flake8 pylint mypy pytest pre-commit

格式化与检查(示例):

black .
isort .
flake8 .
pylint .
mypy .
pytest

启用 pre-commit(只需一次):

pre-commit install