-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
136 lines (116 loc) · 3.3 KB
/
Copy pathpyproject.toml
File metadata and controls
136 lines (116 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "codebase-knowledge-builder"
version = "0.1.1"
description = "A tool for analyzing Git repositories and generating knowledge documents"
readme = "README.md"
requires-python = ">=3.10"
license = { text = "MIT" }
authors = [{ name = "yuanyu", email = "lws2004@163.com" }]
dependencies = [
"pocketflow>=0.0.2",
"litellm>=0.13.0",
"langfuse>=2.1.0",
"gitpython>=3.1.40",
"pydantic>=2.10.0",
"python-dotenv>=1.0.0",
"tqdm>=4.66.1",
"requests>=2.31.0",
"pyyaml>=6.0.0",
"psutil>=5.9.0",
]
[project.optional-dependencies]
dev = ["pytest>=8.0.0", "black>=24.0.0", "isort>=5.12.0", "mypy>=1.0.0"]
[tool.setuptools]
packages = ["src"]
# 所有格式化和 linting 功能现在由 Ruff 提供
[tool.ruff]
# Python linter 配置
line-length = 120
target-version = "py310"
[tool.ruff.lint]
# E: pycodestyle 错误
# F: pyflakes 错误
# W: pycodestyle 警告
# I: isort 规则
# C: McCabe 复杂度
# N: PEP8 命名规则
# D: pydocstyle 文档规则
select = ["E", "F", "W", "I", "C", "N", "D"]
ignore = ["E203", "D203", "D212", "D415"]
exclude = [".git", "__pycache__", "build", "dist", ".venv"]
# 允许自动修复
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
# 忽略特定文件中的复杂度问题
"src/nodes/combine_and_translate_node.py" = ["C901"]
"src/nodes/generate_content_flow.py" = ["C901"]
"src/nodes/module_quality_check_node.py" = ["C901"]
"src/utils/code_parser.py" = ["C901"]
"src/utils/env_manager.py" = ["C901"]
"src/utils/formatter.py" = ["C901"]
"tests/test_generate_content_flow.py" = ["C901"]
"tests/test_generate_docs.py" = ["C901"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
disallow_incomplete_defs = false
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q"
testpaths = ["tests"]
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.run]
source = ["src"]
[tool.code-style]
# 代码长度约束
max_file_lines = 300
max_function_lines = 30
max_line_length = 120
max_class_lines = 200
max_node_class_lines = 100
max_nesting_level = 2
max_function_params = 5
# 文档风格约束
[tool.code-style.documentation]
require_docstrings = ["class", "function", "method", "module"]
docstring_style = "google"
max_docstring_lines = 20
[tool.code-style.documentation.required_sections]
function = ["Args", "Returns", "Raises"]
class = ["Attributes", "Methods"]
# 命名约定
[tool.code-style.naming]
class_pattern = "[A-Z][a-zA-Z0-9]+"
function_pattern = "[a-z][a-z0-9_]+"
variable_pattern = "[a-z][a-z0-9_]+"
constant_pattern = "[A-Z][A-Z0-9_]+"
private_pattern = "_[a-z][a-z0-9_]+"
node_class_pattern = "[A-Z][a-zA-Z0-9]+(Node|Flow)"
# 导入规则
[tool.code-style.imports]
forbidden_imports = ["from __future__ import *", "import *"]
import_order = [
"standard_library",
"third_party",
"first_party",
"local_folder",
]
import_group_spacing = 1
[tool.uv.sources]
codebase-knowledge-builder = { path = ".", editable = true }
[dependency-groups]
dev = ["pytest>=8.3.5"]