-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
170 lines (146 loc) · 4.26 KB
/
pyproject.toml
File metadata and controls
170 lines (146 loc) · 4.26 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
[project]
name = "dlsite-classification-manager"
version = "0.1.0"
description = "CLI and API toolkit for classifying and managing DLsite works"
readme = "README.md"
requires-python = ">=3.10,<3.14"
dependencies = [
"aiofile>=3.9.0",
"aiohttp>=3.9.5,<4.0",
"async-timeout>=4.0.3,<5.0",
"beautifulsoup4>=4.12.3,<5.0",
"coverage>=7.5,<8.0",
"fastapi>=0.124,<0.127",
"starlette>=0.49.1,<0.51",
"lxml>=5.2.0,<6.0",
"mypy>=1.8,<2.0",
"pydantic>=2.7,<3.0",
"rich>=13.7,<14.0",
"pytest>=8.3,<9.0",
"pytest-asyncio>=0.23,<0.24",
"pytest-cov>=5.0,<6.0",
"ruff>=0.3.0",
"typing-extensions>=4.10,<5.0",
"uvicorn>=0.29,<0.32",
"yarl>=1.9,<2.0",
]
# ---------------- Ruff ----------------
[tool.ruff]
line-length = 88
target-version = "py310"
exclude = ["tests"]
[tool.ruff.lint.isort]
combine-as-imports = true
force-single-line = false
lines-after-imports = 2
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
[tool.ruff.lint]
# Enable comprehensive linting rules for high code quality
select = [
"E", # pycodestyle errors – PEP 8 outright violations (indentation, whitespace, etc.)
"W", # pycodestyle warnings – stylistic issues like excessive line length
"F", # Pyflakes – logical errors (unused imports, undefined names, etc.)
"UP", # pyupgrade – suggest modern Python syntax (f-strings, pathlib, etc.)
"B", # flake8-bugbear – common bugs and design problems
"SIM", # flake8-simplify – propose simpler, more readable constructs
"I" # isort – import grouping and ordering
]
ignore = [
"E501", # line-too-long
"COM819", # prohibited-trailing-comma
"TRY003", # raise-vanilla-args (avoid specifying long messages outside the exception class)
"PERF203", # try-except-in-loop (try-except within a loop incurs performance overhead)
"ANN204", # missing-return-type-special-method
"ANN401", # any-type (dynamically typed expressions (typing.Any) are disallowed)
]
# Configure pydocstyle to use Google docstring convention
[tool.ruff.lint.pydocstyle]
convention = "google" # Use Google-style docstrings (Args:, Returns:, Raises:)
[tool.ruff.lint.mccabe]
max-complexity = 10
# ---------------- mypy ----------------
[tool.mypy]
python_version = "3.10"
plugins = ["pydantic.mypy"]
ignore_missing_imports = true
warn_unused_ignores = true
exclude = ["tests"]
[[tool.mypy.overrides]]
module = "dlsite_classification.manager.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = [
"dlsite_classification.crawler.*",
"dlsite_classification.extract.*",
"dlsite_classification.tools.move",
]
ignore_errors = true
# ---------------- pytest ----------------
[tool.pytest.ini_options]
minversion = "8.0"
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
"--cov=dlsite_classification",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-report=xml",
"--disable-warnings",
]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::RuntimeWarning",
"ignore::UserWarning",
]
# ---------------- coverage ----------------
[tool.coverage.run]
source = ["dlsite_classification"]
branch = true
parallel = false
[tool.coverage.report]
show_missing = true
skip_covered = false
fail_under = 0
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == '__main__':",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
[tool.coverage.html]
directory = "htmlcov"
# ---------------- bandit ----------------
[tool.bandit]
targets = ["*"]
exclude_dirs = ["tests", ".venv", "venv", "env", ".env"]
skips = ["B101", "B601"]
[tool.bandit.assert_used]
skips = ["**/test_*.py", "**/tests/**"]
[dependency-groups]
dev = [
"ruff>=0.3.0",
"bandit[toml]>=1.7.0",
]