Files
tsl-devkit/docs/python/configuration.md
T
csh ac794a6a70 Squashed 'docs/standards/playbook/' changes from e504a68..b529012
b529012  test(tests): avoid hardcoded missing path
07583c8 🐛 fix(tests): make doc link check awk-portable
6244aa3 🔧 chore(ci): relax gitattributes check
31dd0c5 🐛 fix(scripts): require existing project root
15d4d63 🔧 chore(ci): install python3-pip
90c6313 🔧 chore(ci): run tests in a single job
d84eff0 🔧 chore(ci): make actions base url configurable
395598d 🔧 chore(ci): fix yaml step names
4ae2733  feat(sync_standards): auto-detect existing languages
e97fb00  feat(sync_standards): default gitattributes to append
da0ef2b  test: add automated tests and ci workflow
99bef30 🎨 style(markdown): format all markdown files with prettier
7e96bc8 ♻️ refactor(tsl): split function.md into 44 modular files
0d6b2a0 📝 docs(readme): add quick decision table and TL;DR for distribution methods
3b2188f 🎨 style(markdown): format markdown files with prettier
41fc43b 📝 docs(tsl): document {Unit.}Type source annotation
3dceaf7 📝 docs(tsl): clarify tsf-only top-level rules and type annotations
3a63829 📝 docs(skills): add create-plan skill
f02a707 🐛 fix(scripts): escape markdown backticks in vendor_playbook
064aa92 🐛 fix(scripts): correct bat scripts
4881feb 🔧 chore(gitattributes): enforce crlf for bat files
1fa3e2a 🐛 fix(scripts): escape parentheses in sync_standards output
3958cad 📝 docs(vendor_playbook): mention ci templates
9d059cf  feat(templates): add gitea ci example
a52bb24 📝 docs(codex_skills): normalize markdown formatting
cc8ad4c 📝 docs(skills): slim commit-message
2a98e15 🐛 fix(skills): quote YAML descriptions
8f78d22 🐛 fix(sync_standards): generate minimal AGENTS.md
5547665  feat(skills): add commit-message suggestion skill
3fe8bd7 🔧 chore(sync_standards): create AGENTS.md on sync
283d311  feat(playbook): add syntax book and codex skills tooling
5b97ed5 📝 docs(tsl): clarify syntax references
27e0700  feat(skills): add pdf/docx/pptx/xlsx wrapper workflows
5551363  feat(skills): add debugging and bulk refactor workflows
1d4f548  feat(skills): add built-in workflow skills
c0895dd 📝 docs(skills): add anthropics document-skills integration
cf9f80d 🔧 chore(playbook): add Claude Code skills guide and align python templates

git-subtree-dir: docs/standards/playbook
git-subtree-split: b529012c59c5d67c3073884d7b617763647417fd
2026-01-08 15:56:36 +08:00

2.0 KiB
Raw Blame History

Python 配置清单(Configuration

本文件用于把 Python 工具配置“汇总说明”到一个可读入口。

注意:本 Playbook 将可复制模板放在 templates/python/;在目标项目落地时,这些文件通常需要复制到项目根目录(工具默认查找位置):

  • pyproject.toml
  • .flake8
  • .pylintrc
  • .pre-commit-config.yaml
  • .editorconfig
  • .vscode/settings.json

1) pyproject.toml

模板文件:templates/python/pyproject.toml

  • tool.black
    • line-length = 80
    • target-version = ['py313'](按项目 Python 版本调整)
  • tool.isort
    • profile = "google"
    • line_length = 80
    • known_third_party / known_first_party:按项目维护
  • tool.mypy
    • python_version = "3.13"(按项目调整)
    • ignore_missing_imports = true(对第三方二进制/无类型库更友好)
  • tool.pytest.ini_options
    • 测试发现与参数(若项目引入 tests/ 会自动生效)

2) .flake8

模板文件:templates/python/.flake8

  • max-line-length = 80
  • docstring-convention = google
  • black 冲突的规则已屏蔽(例如 E203W503

3) .pylintrc

模板文件:templates/python/.pylintrc

  • 命名风格:snake_case / PascalCase 等(对齐 Google Python 风格)
  • max-line-length = 80
  • init-hook 将项目根目录加入 sys.path(便于本地运行与检查;如项目不需要可移除)

4) .pre-commit-config.yaml

模板文件:templates/python/.pre-commit-config.yaml

  • 基础文本检查:尾随空格、文件末尾换行、YAML/TOML 基础校验
  • Pythonblackisortflake8

5) .editorconfig

模板文件:templates/python/.editorconfig

  • Python4 空格缩进、行宽 80
  • 通用:UTF-8、LF、去尾随空格、文件末尾换行

6) .vscode/settings.json

模板文件:templates/python/.vscode/settings.json

  • 保存即格式化、80 列标尺、默认使用 Black formatter、按需组织 import