-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
144 lines (129 loc) · 4.05 KB
/
pyproject.toml
File metadata and controls
144 lines (129 loc) · 4.05 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
137
138
139
140
141
142
143
144
[project]
name = "pythoncodehub"
version = "0.1.0"
description = "用于记录日常开发中遇到的可以复用的代码"
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"celery==5",
"djangorestframework>=3.16.1",
"inflection>=0.5.1",
"pandas>=2.3.1",
"redis==6",
"requests>=2.32.4",
]
[dependency-groups]
dev = [
"fakeredis>=2.33",
"pre-commit>=4.2",
"pytest>=8.4.1",
"pytest-cov>=7",
"pytest-mock>=3.15.1",
"pytest-xdist>=3.8",
"requests-mock>=1.12.1",
"responses>=0.25.8",
"ruff>=0.12",
]
[tool.ruff]
target-version = "py311"
line-length = 120
exclude = [
".git",
".pytype",
".ruff_cache",
".venv",
"__pypackages__",
"node_modules",
"scripts",
"venv",
]
output-format = "full"
format.docstring-code-format = true
lint.select = [ "E4", "E7", "E9", "F", "UP" ]
lint.ignore = [
# `ruff rule S101` for a description of that rule
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
"EM101", # Exception must not use a string literal, assign to variable first
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
"G004", # Logging statement uses f-string
"ISC001", # Conflicts with ruff format -- DO NOT FIX
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
"PT018", # Assertion should be broken down into multiple parts
"RUF002", # Docstring contains ambiguous unicode characters (中文标点) -- DO NOT FIX
"RUF003", # Comment contains ambiguous unicode characters (中文标点) -- DO NOT FIX
"RUF013", # PEP 484 prohibits implicit `Optional` (过于严格) -- DO NOT FIX
"S101", # Use of `assert` detected -- DO NOT FIX
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
"SIM905", # Consider using a list literal instead of `str.split` -- DO NOT FIX
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)` -- DO NOT FIX
]
lint.extend-ignore = [ "E402" ]
lint.fixable = [ "ALL" ]
lint.extend-safe-fixes = [ "UP" ]
lint.mccabe.max-complexity = 17 # default: 10
lint.pylint.allow-magic-value-types = [
"float",
"int",
"str",
]
lint.pylint.max-args = 10 # default: 5
lint.pylint.max-branches = 20 # default: 12
lint.pylint.max-returns = 8 # default: 6
lint.pylint.max-statements = 88 # default: 50
[tool.codespell]
ignore-words-list = "3rt,abd,aer,ans,bitap,crate,damon,fo,followings,hist,iff,kwanza,manuel,mater,secant,som,sur,tim,toi,zar"
skip = "./.*,*.json,*.lock,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictionary.txt,strings/words.txt"
# pytest 配置
[tool.pytest.ini_options]
# 测试发现路径
testpaths = [ "tests/" ]
# Python 文件模式
python_files = [ "test_*.py" ]
python_classes = [ "Test*" ]
python_functions = [ "test_*" ]
# 标记定义
markers = [
"unit: 单元测试",
"slow: 慢速测试(>1s)",
"redis: 需要 Redis Mock",
"celery: 需要 Celery Mock",
"network: 需要网络 Mock",
]
# 输出配置
addopts = [
"-v",
"--tb=short",
"--cov=http_client",
"--cov-report=term-missing",
"--cov-fail-under=90",
"-p",
"no:warnings",
]
# 覆盖率配置
[tool.coverage.run]
source = [ "http_client" ]
omit = [
"*/tests/*",
"*/__pycache__/*",
"*/site-packages/*",
]
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
[[tool.uv.index]]
# 配置清华源
#url = "https://pypi.tuna.tsinghua.edu.cn/simple"
url = "https://mirrors.aliyun.com/pypi/simple"
default = true