-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
326 lines (291 loc) · 8.95 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
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
[tool.poetry]
name = "filename_suggestion_ai"
version = "0.1.0"
description = ""
authors = ["Matthias <myinusa@hotmail.co.uk>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
black = "^24.8.0"
ruff = "^0.6.3"
pytest = "^8.3.2"
isort = "^5.13.2"
vulture = "^2.11"
tqdm = "^4.66.5"
[tool.poetry.group.dev.dependencies]
# Code quality tools
mypy = "^1.11.2"
# Improved exception traceback output
# https://github.com/qix-/better-exceptions
better-exceptions = "^0.3.3"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
# [tool.poetry.scripts]
# filename_suggestion_ai = "filename_suggestion_ai.main:main"
# --- black ------------------------------------------------------------------
# ref: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
[tool.black]
target-version = ['py39']
line-length = 100
# target-version = ['py39']
include = '\.pyi?$|\.ipynb$'
extend-exclude = '''
# # A regex preceded with ^/ will apply only to files and directories
# # in the root of the project.
# ^/foo.py # exclude a file named foo.py in the root of the project (in addition to the defaults)
\.ipynb_checkpoints$|^/\.env|^/\.git|^/\.nox|^/\.pytest_cache|^/\.tox
'''
# --- ruff -------------------------------------------------------------------
[tool.ruff]
select = [
"A", # flake8-builtins
"AIR", # Airflow
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"COM", # flake8-commas
#"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle Error
"EM", # flake8-errmsg
"ERA", # eradicate
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"FLY", # flynt
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # Pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TD", # flake8-todos
"TID", # flake8-tidy-imports
# "TRIO", # flake8-trio
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle Warning
"YTT", # flake8-2020
# TODO: enable these once they're out of preview
# "CPY", # flake8-copyright
# "FURB", # refurb
]
# Avoid trying to fix extension types:
unfixable = [
"B", # Autofixing bugbear findings is a bit too aggressive
"ERA001", # Don't remove commented-out code
"F841", # Autofixing unused variables conservatively leaves right-hand-side intact, which is almost always incorrect
"RUF", # Autofixes for ruff-specific rules possibly too aggressive
"SIM", # Autofixes for flake8-simplify possibly too aggressive
"TRY", # Autofixes for tryceratops possibly too aggressive
]
ignore = [
"ERA001",
"T201",
"B905", # zip strict=True; remove once python <3.10 support is dropped.
"D100", # do not require module-level docstrings
"D104", # do not require package docstrings
"D107", # do not require docstrings in __init__ files
"D205", # don't require linebreak after docstring (ruff vs black conflict)
"D401",
# "TRY002",
# "D103",
# "E203", # not in ruff
# "E265", # not in ruff
# "E266", # not in ruff
"E501", # line too long
"F401", # unused import
"F403", # import *
"F405", # defined from import *
# "F541", # f-string missing placeholders
"N999", # allow "invalid" module names due to jinja templates "S101", # assert
"SIM105", # allow except: pass
"TRY003", # Avoid specifying messages outside exception class; overly strict, especially for ValueError
"TRY201", # Allow raise without exception name (align with Sonarlint)
# "W503", # not in ruff
"A001", # Allow shadowing built-in types like 'id'
"A002", # Allow shadowing built-in types like 'id'
"DTZ005", # Allow datetime.now() without specifiying timezone
"ANN101", # Type annotations for "self" args -> deprecated
"ANN102", # Type annotations for "cls" args -> deprecated
"DJ", # Disable Django linting -> unused
"E501", # Avoid linter errors for line length -> ruff-format handles line length as good as possible
"G004", # Allow logging statements using f-strings
"ISC001", # Conflicts with COM812 -> prefer trailing commas over implicit string concatenation to reduce diff noise
"TD002", # Don't require author for TODOs
"TRY002", # Allow descriptive exception messages without defining custom exception classes for now
"TRY003", # Allow descriptive exception messages without defining custom exception classes for now
#"D", # TODO: remove to enforce docstrings
]
# Exclude a variety of commonly ignored directories.
exclude = [
"*.egg-info",
".direnv",
".eggs",
".env",
".envrc",
".git",
".ipynb_checkpoints",
".nox",
".pytest_cache",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"ci/templates",
"build",
"dist",
"docs/conf.py",
"venv",
]
# Default autofix behavior
fix = true
# Max line length
line-length = 119
# Directories with source code
# src = ["notebooks", "src", "tests"]
# Assumed Python version
target-version = "py39"
[tool.ruff.per-file-ignores]
# # Ignore `E402` (import violations) in all `__init__.py` files,
# # and in `path/to/file.py`.
# "__init__.py" = ["E402"]
# "path/to/file.py" = ["E402"]
".ci/*" = ["D"]
"docs/*" = ["D"]
"notebooks/*" = ["B018", "D", "S101"]
"tests/*" = ["D", "S101"]
# --- ruff plugins --------------------
[tool.ruff.flake8-bugbear]
extend-immutable-calls = ["chr", "typer.Argument", "typer.Option"]
[tool.ruff.isort]
combine-as-imports = true
# extra-standard-library = ["path"]
forced-separate = ["scipy", "sklearn", "statsmodels", "ds_utils", "src"]
force-sort-within-sections = true
force-wrap-aliases = true
known-first-party = ["ds_utils", "src"]
# known-local-folder = ["src"] # for relative imports
[tool.ruff.mccabe]
max-complexity = 14
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.pep8-naming]
ignore-names = []
# [tool.ruff.pydocstyle]
# convention = "numpy"
# --- pytest -----------------------------------------------------------------
# ref: https://docs.pytest.org/en/7.3.x/reference/customize.html
[tool.pytest.ini_options]
addopts = '''
-ra
--strict-markers
--ignore=docs/conf.py
--ignore=setup.py
--ignore=ci
--ignore=.eggs
--tb=short
'''
# --doctest-modules
# --doctest-glob=\*.rst
norecursedirs = [
".env",
".git",
".nox",
".pytest_cache",
".tox",
"__pycache__",
"dist",
"docs",
"build",
"migrations",
"notebooks",
"writeup",
]
python_files = ["test_*.py", "*_test.py", "tests.py"]
pythonpath = "src"
testpaths = ["tests"]
# log_cli = true
# --- coverage ---------------------------------------------------------------
[tool.coverage.paths]
source = ["src", "*/site-packages"]
[tool.coverage.run]
branch = true
source = ["src"]
[tool.coverage.report]
show_missing = true
# Configuration for mypy
# https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
[tool.mypy]
python_version = "3.9"
follow_imports = "skip"
ignore_missing_imports = true
files = "acme" # directory mypy should analyze
# Directories to exclude from mypy's analysis
exclude = [
"acme/somedir",
"acme/somefile\\.py",
"dirname",
]
# # Configuration for pytest
# # https://docs.pytest.org/en/latest/reference/customize.html#pyproject-toml
# [tool.pytest.ini_options]
# testpaths = "tests" # directory containing your tests
# norecursedirs = [
# ".vscode",
# "__pycache__"
# ]
# Warnings that should be ignored
# filterwarnings = [
# "ignore::DeprecationWarning"
# ]
# custom markers that can be used using pytest.mark
# markers = [
# "slow: lower-importance tests that take an excessive amount of time",
# ]
# # Configuration for coverage.py
# [tool.coverage.run]
# # files or directories to exclude from coverage calculations
# omit = [
# 'acme/somedir/*',
# 'acme/somefile.py',
# ]
# Configuration for vulture
[tool.vulture]
# Files or directories to exclude from vulture
# The syntax is a little funky
exclude = [
"somedir",
"*somefile.py",
]