-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyproject.toml
204 lines (181 loc) · 5.4 KB
/
pyproject.toml
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
[tool.poetry]
name = "webhook-bridge"
version = "0.4.0"
description = "A flexible webhook integration platform."
authors = ["hal.long <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [
{ include = "webhook_bridge" },
]
include = [
"webhook_bridge/templates/*.html",
]
[tool.poetry.dependencies]
python = "^3.8"
markdown = "^3.7"
fastapi = "^0.104.0"
fastapi-versioning = "^0.10.0"
uvicorn = "^0.24.0"
pydantic = "^2.4.2"
httpx = "^0.24.0"
markdown2 = "^2.4.0"
jinja2 = "^3.1.4"
[tool.poetry.scripts]
webhook-bridge = "webhook_bridge.cli:main"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.commitizen]
name = "cz_conventional_commits"
version = "0.4.0"
tag_format = "v$version"
version_files = [
"pyproject.toml:version",
"webhook_bridge/__version__.py"
]
[tool.black]
line-length = 120
target-version = ['py36', 'py37', 'py38', 'py39']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.nox
| \.venv
| _build
| buck-out
| build
| datatalk/_vendor
| dist
)/
| foo.py # also separately exclude a file named foo.py in
# the root of the project
)
'''
[tool.isort]
profile = "black"
atomic = true
include_trailing_comma = true
lines_after_imports = 2
lines_between_types = 1
use_parentheses = true
src_paths = ["webhook_bridge", "tests"]
filter_files = true
known_first_party = "webhook_bridge"
# Enforce import section headers.
import_heading_future = "Import future modules"
import_heading_stdlib = "Import built-in modules"
import_heading_thirdparty = "Import third-party modules"
import_heading_firstparty = "Import local modules"
force_sort_within_sections = true
force_single_line = true
# All project unrelated unknown imports belong to third-party.
default_section = "THIRDPARTY"
skip_glob = []
# https://beta.ruff.rs/docs/configuration/
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
line-length = 120
indent-width = 4
target-version = "py38"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F", "ANN", "N", "I", "UP", "RUF", "PTH", "C4", "B", "A", "COM", "C90", "RSE", "SIM", "TID", "PD", "PGH", "FBT", "S", "BLE", "FLY", "PERF", "RUF", "UP", "W", "PL"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# 禁用特定规则
ignore = [
"ANN202", # Missing return type annotation for private function
"ANN201", # Missing return type annotation for public function
"ANN001", # Missing type annotation for function argument
"ANN002", # Missing type annotation for *args
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"S101", # Use of assert detected (in tests)
"S104", # Possible binding to all interfaces
"S606", # Starting a process without a shell
"BLE001", # Do not catch blind exception
"PLR2004", # Magic value used in comparison
"PTH110", # os.path.exists() should be replaced by Path.exists()
"PTH112", # os.path.isdir() should be replaced by Path.is_dir()
"PTH118", # os.path.join() should be replaced by Path with / operator
"PTH119", # os.path.basename() should be replaced by Path.name
"PTH120", # os.path.dirname() should be replaced by Path.parent
"PTH123", # open() should be replaced by Path.open()
"PTH207", # Replace glob with Path.glob or Path.rglob
"PTH103", # os.makedirs() should be replaced by Path.mkdir(parents=True)
"E402", # Module level import not at top of file
"RUF005", # Consider ["webhook-bridge", *test_args] instead of concatenation
"UP006", # Use dict instead of Dict for type annotation
"PERF102", # When using only the values of a dict use the values() method
"SIM102", # Use a single if statement instead of nested if statements
"I001", # Import block is un-sorted or un-formatted
]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.mypy]
python_version = "3.8"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_optional = true
[[tool.mypy.overrides]]
module = [
"fastapi.*",
"fastapi_versioning.*",
"httpx.*",
"markdown2.*",
"uvicorn.*",
"pydantic.*"
]
ignore_missing_imports = true