-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
367 lines (331 loc) · 8.21 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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
###############
### PROJECT ###
###############
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
version = "0.0.0" # a placeholder for poetry CI dynamic versionning plugin
name = "deker_tools"
packages = [{ include = "deker_tools" }]
description = "Shared functions library for Deker components"
authors = ["OpenWeather <[email protected]>"]
license = "GPL-3.0-only"
readme = "README.md"
documentation = 'https://docs.deker.io/'
homepage = 'https://deker.io/'
repository = 'https://github.com/openweathermap/deker-tools'
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
[tool.poetry-dynamic-versioning]
vcs = "git"
style = "semver"
metadata = false
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[[tool.poetry.source]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
priority = "supplemental"
####################
### DEPENDENCIES ###
####################
[tool.poetry.dependencies]
python = "^3.9"
numpy = "^1.18"
[tool.poetry.group.dev.dependencies]
black = "23.1.0"
darglint = "1.8.1"
Flake8-pyproject = "1.2.3"
flake8 = "5.0.4"
flake8-bugbear = "23.1.20"
flake8-docstrings = "1.7.0"
flake8-import-order = "0.18.2"
flake8-pytest-style = "1.7.0"
isort = "5.12.0"
mypy = "1.0.0"
mypy-extensions = "1.0.0"
pep8-naming = "0.13.3"
pre-commit = "3.0.4"
pycln = "2.1.3"
ssort = "0.11.6"
bandit = "1.7.5"
coverage = "7.1.0"
deepdiff = "6.3.0"
pytest = "7.2.1"
pytest-cov = "4.0.0"
pytest-sugar = "0.9.6"
pytest-random-order = "1.1.0"
pytest-mock = "3.10.0"
[tool.poetry.group.docs.dependencies]
docutils = "0.17"
m2r2 = "0.3.2"
sphinx-rtd-theme = "1.2.2"
enum_tools = "0.10.0"
sphinx_toolbox = "3.5.0"
doc8 = "0.11.2"
#############
### TOOLS ###
#############
##############
# FORMATTERS #
##############
[tool.black] # code formatter
target-version = ['py39']
line-length = 120
[tool.isort] # imports sorter
# https://pycqa.github.io/isort/
py_version = 39
sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']
profile = "black"
atomic = true
include_trailing_comma = true
line_length = 120
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3
extend_skip = [".md", ".json"]
known_local_folder = ["deker_tools"]
known_third_party = ["deker_tools"]
extra_standard_library = ["zoneinfo"]
use_parentheses = true
###########
# LINTERS #
###########
[tool.mypy] # code linter
# https://mypy.readthedocs.io/en/stable/
# https://pypi.org/project/mypy-extensions/
python_version = "3.9"
ignore_missing_imports = true
scripts_are_modules = true
allow_redefinition = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_no_return = false
show_error_context = true
show_column_numbers = true
show_error_codes = true
color_output = false
pretty = true
exclude = [
'^setup\.py$',
'^tmp\.py$',
'^venv/',
'^.venv/',
'^test+\.py$',
'^conftest\.py$',
'^tmp/',
'^examples/'
]
disable_error_code = "misc,no-redef,override,union-attr,index,assignment"
[[tool.mypy.overrides]]
module = "tests/*"
disallow_untyped_defs = false
[tool.flake8] # code linter
# https://flake8.pycqa.org/en/latest/
# https://pypi.org/project/flake8-bugbear
# https://pypi.org/project/flake8-docstrings/
# https://pypi.org/project/flake8-import-order/
# https://pypi.org/project/flake8-pytest-style/
# https://pypi.org/project/pep8-naming/
min_python_version = 3.9
max-complexity = 20
max-doc-length = 120
max-line-length = 120
strictness = "full"
docstring_style = "sphinx"
docstring-convention = "pep257"
application_import_names = "deker"
import-order-style = "pycharm"
exclude = [
"venv/*",
".venv/*",
".git/*",
"__pycache__/*",
".mypy_cache/*",
".pytest_cache/*",
".idea/*",
"examples/*",
"tmp/*",
"tests/*",
".eggs/*",
"tmp.py"
]
extend-select = ["D417"]
per-file-ignores = [
"__init__.py: D104, F401, F403, F405,",
]
ignore = [
"B012",
"D100",
"D104",
"D105",
"D106",
"D107",
"D203",
"D404",
"DAR003",
"DAR104",
"DAR105",
"DAR201",
"DAR401",
"I201",
"I202",
"N805",
"N807",
"N813",
"W503",
"W504",
]
[tool.pycln] # imports linter
# https://hadialqattan.github.io/pycln/#/README
all = true
diff = true
exclude = "venv/*,.venv/*,.git/*,__pycache__/*,examples/*"
[tool.doc8] # RST linter
# https://github.com/PyCQA/doc8
max-line-length = 99
[tool.bandit] # security linter
# https://github.com/PyCQA/bandit
skips = ["B324"]
[tool.ruff] # code linter
# https://github.com/astral-sh/ruff
target-version = "py39"
line-length = 120
select = ["ALL"]
ignore = [
"TRY200",
"ISC002",
"B904",
"EM102",
"TRY003",
"D100",
"ANN101",
"D105",
"ANN102",
"PGH003",
"W505",
"BLE001",
"DTZ004",
"FIX002",
"C901", # Too complex, refactor files with this error.
"SLF001",
"ANN401",
"G004",
"A003",
"TD003",
"TD002",
"DTZ003", # .utcnow() is not allowed
"DTZ005", # date time without tz
"DTZ006", # date time without tz
"FA100", # __future__ annotations
"TRY301",
"PLR0913", # Number of arguments
"PERF401",
"RUF012",
"PLR0912", # Too many branches,
"FBT001", # Boolean positional arg
"FBT002", # Boolean default value
"D401",
"COM812",
"EM101",
"UP006", # Tuple[..] -> tuple[..]
"UP035", # Tuple[..] -> tuple[..]
"UP007", # X | Y instead of Union
"UP037", # Quotes in annotations
"RET504",
"PIE790",
"ERA001",
"C408",
"ANN204",
"D107",
"RET503",
"UP004",
"UP015",
"TRY300" # move return to else
]
exclude = [
"venv/*",
".venv/*",
".git/*",
"__pycache__/*",
".mypy_cache/*",
".pytest_cache/*",
".idea/*",
"examples/*",
"tmp/*",
"tests/*",
"tmp.py"
]
[tool.ruff.per-file-ignores]
"__init__.py" = ["D104", "F401", "F403", "F405"]
[tool.ruff.pydocstyle]
convention = "pep257"
[tool.ruff.mccabe]
max-complexity = 3
[tool.ruff.pycodestyle]
max-doc-length = 120
[tool.ruff.isort]
section-order = ['future', 'standard-library', 'third-party', 'first-party', 'local-folder']
lines-after-imports = 2
lines-between-types = 1
known-local-folder = ["deker_tools"]
known-third-party = []
extra-standard-library = ["zoneinfo"]
#########
# TESTS #
#########
[tool.pytest.ini_options] # pytest
# https://docs.pytest.org
# https://pypi.org/project/pytest-asyncio/
# https://pytest-cov.readthedocs.io/en/latest/
# https://pypi.org/project/pytest-pythonpath/
# https://pypi.org/project/pytest-sugar/
minversion = 7.0
asyncio_mode = "auto"
addopts = ["--ignore=tmp.py"]
norecursedirs = "data"
testpaths = "./tests"
#log_cli = true
#log_cli_level = "DEBUG"
pythonpath = ["./deker_tools", "./.venv", "./venv"]
filterwarnings = ["ignore::UserWarning", 'ignore::DeprecationWarning', "ignore::ResourceWarning"]
[tool.coverage.run] # coverage
branch = true
omit = [
"tests/*",
"tmp.py",
"setup.py",
]
[tool.coverage.html]
directory = "tests/code_coverage"
[tool.coverage.report]
fail_under=86
exclude_lines = [
"no cov",
"pragma: no cover",
"if typing.TYPE_CHECKING:",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
"pass",
"raise NotImplementedError",
"except ImportError",
"except ModuleNotFoundError",
"except Exception"
]