Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
274 lines (255 loc) · 7.04 KB
/
Copy pathpyproject.toml
File metadata and controls
274 lines (255 loc) · 7.04 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "litefs"
dynamic = ["version"]
description = "Build a web server framework using Python."
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT"}
authors = [
{name = "Leafcoder", email = "leafcoder@gmail.com"}
]
keywords = ["web", "server", "wsgi", "http", "framework"]
classifiers = [
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"argh>=0.26.2",
"greenlet>=0.4.13",
"Mako>=1.0.6",
"MarkupSafe>=1.1.1",
"orjson>=3.10",
"PyYAML>=5.1",
"watchdog>=0.8.3",
"SQLAlchemy>=2.0.0",
]
[project.optional-dependencies]
wsgi = [
"gunicorn>=20.1.0",
"uwsgi>=2.0.20",
"waitress>=2.1.0",
]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-asyncio>=0.21.0",
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=7.0.0",
"mypy>=1.0.0",
"ruff>=0.1.0",
# 可选依赖的可测试版本,保证单元测试在 CI 中可直接运行
"prometheus-client>=0.20.0",
"alembic>=1.13.0",
# 会话/缓存后端的客户端库,集成测试用例依赖
"pymemcache>=4.0.0",
"redis>=5.0.0",
# 任务队列,tasks 模块单元测试依赖
"celery>=5.3.0",
# 依赖安全审计(pip-audit),CI security 门禁依赖
"pip-audit>=2.7.3",
]
prometheus = [
"prometheus-client>=0.20.0",
]
db = [
"alembic>=1.13.0",
]
mail = [
# 邮件发送本身零新增依赖;Celery 仅用于异步投递,未安装时自动降级为同步发送
"celery>=5.3.0",
]
docs = [
"sphinx>=9.0.0",
"sphinx-rtd-theme>=3.0.0",
"myst-parser>=3.0.0",
"sphinx-autodoc-typehints>=3.0.0",
]
performance = [
"memory-profiler>=0.60.0",
"line-profiler>=3.5.0",
"locust>=2.15.0",
"pytest-benchmark>=4.0.0",
"psutil>=5.9.0",
"py-spy>=0.3.14",
"pytest-xdist>=3.0.0",
]
[project.scripts]
litefs = "litefs.cli:main"
[project.urls]
Homepage = "https://github.com/leafcoder/litefs"
Documentation = "https://github.com/leafcoder/litefs#readme"
Repository = "https://github.com/leafcoder/litefs"
Issues = "https://github.com/leafcoder/litefs/issues"
[tool.setuptools]
package-dir = {"" = "src"}
package-data = {litefs = ["templates/*.j2", "templates/*.py", "templates/*/*.j2", "templates/*/*.py", "templates/*/*/*.j2", "templates/*/*/*.py"]}
[tool.setuptools.dynamic]
version = {attr = "litefs._version.__version__"}
[tool.setuptools.packages.find]
where = ["src"]
[tool.black]
line-length = 100
target-version = ["py38", "py39", "py310", "py311", "py312"]
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
[tool.ruff]
# line-length 与 [tool.black] / .flake8 保持一致
# target-version 省略,自动从 requires-python = ">=3.8" 推断
line-length = 100
extend-exclude = ["docs", "build", "dist"]
[tool.ruff.lint]
# 默认规则集(E4/E7/E9/F),与 flake8 常用规则对齐,后续按目录逐步扩展
select = ["E4", "E7", "E9", "F"]
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
strict_equality = true
# 分阶段类型化治理:以下模块尚未完成类型注解收敛,暂不阻断 CI。
# 收敛一个模块即可从本列表移除,使 mypy 门禁范围逐步扩大。
[[tool.mypy.overrides]]
module = [
"litefs.auth",
"litefs.auth.decorators",
"litefs.auth.jwt",
"litefs.auth.middleware",
"litefs.auth.models",
"litefs.auth.oauth2",
"litefs.auth.password",
"litefs.auth.providers",
"litefs.cache.cache",
"litefs.cache.db",
"litefs.cache.manager",
"litefs.cache.redis",
"litefs.cache_decorators",
"litefs.cache.form_cache",
"litefs.cli",
"litefs.config",
"litefs.database.core",
"litefs.debug",
"litefs.debug.middleware",
"litefs.forms",
"litefs.handlers.asgi",
"litefs.handlers.enhanced",
"litefs.handlers.form",
"litefs.handlers.socket",
"litefs.handlers.wsgi",
"litefs.middleware.csrf",
"litefs.middleware.enhanced_logging",
"litefs.middleware.rate_limit",
"litefs.openapi",
"litefs.openapi.generator",
"litefs.openapi.ui",
"litefs.plugins.base",
"litefs.plugins.loader",
"litefs.routing.radix_tree",
"litefs.routing.router",
"litefs.server.asgi",
"litefs.server.asyncio",
"litefs.server.greenlet",
"litefs.session.cache_session",
"litefs.session.db",
"litefs.session.manager",
"litefs.session.redis",
"litefs.session.session",
"litefs.static_handler",
"litefs.tasks",
"litefs.validators",
"litefs.websocket.connection",
"litefs.websocket.protocol",
"litefs.websocket.server",
]
ignore_errors = true
# 第三方库缺少类型存根(py.typed)或未安装,不属于本项目类型化范围
[[tool.mypy.overrides]]
module = [
"mako.*",
"memcache.*",
"pymemcache.*",
"watchdog.*",
"yaml.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
# 标准库 3.11+ 模块,CI 的 py3.8 环境下 mypy 找不到实现
"tomllib",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# 强制测试导入仓库 src/ 实时代码,避免误测 site-packages 中的安装快照
pythonpath = ["src"]
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
]
filterwarnings = [
"ignore:session_secure 设置为 False:UserWarning",
"ignore:生产环境检测到 session_secure=False:UserWarning",
"ignore:生产环境检测到 debug=True:UserWarning",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
]
[tool.coverage.run]
source = ["src"]
branch = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
]