-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
535 lines (486 loc) · 13.5 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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "data-syncmaster"
version = "0.1.6"
license = "Apache-2.0"
description = "Syncmaster REST API + Worker"
authors = ["DataOps.ETL <[email protected]>"]
readme = "README.rst"
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
"Framework :: FastAPI",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"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",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
keywords = ["Syncmaster", "REST", "API", "Worker", "Replication"]
packages = [
{ include = "syncmaster" },
]
exclude = [
{path = "tests"},
]
[tool.poetry.urls] # Optional
"Homepage" = "https://github.com/MobileTeleSystems/syncmaster"
"Documentation" = "https://syncmaster.readthedocs.io"
"Source" = "https://github.com/MobileTeleSystems/syncmaster"
"CI/CD" = "https://github.com/MobileTeleSystems/syncmaster/actions"
"Tracker" = "https://github.com/MobileTeleSystems/syncmaster/issues"
[tool.poetry.dependencies]
python = "^3.11"
pydantic = "^2.9.2"
pydantic-settings = { version = "^2.5.2", optional = true }
sqlalchemy = { version = "^2.0.35", optional = true }
sqlalchemy-utils = { version = "^0.41.2", optional = true }
fastapi = { version = "^0.115", optional = true}
asgi-correlation-id = {version = "^4.3.4", optional = true}
uvicorn = { version = ">=0.30.6,<0.35.0", optional = true }
alembic = { version = "^1.13.2", optional = true }
python-jose = { version = "^3.3.0", extras = ["cryptography"], optional = true }
jinja2 = { version = "^3.1.4", optional = true }
python-multipart = { version = ">=0.0.9,<0.0.20", optional = true }
celery = { version = "^5.4.0", optional = true }
onetl = { version = "^0.12.0", extras = ["spark"], optional = true }
pyyaml = {version = "*", optional = true}
# due to not supporting MacOS 14.x https://www.psycopg.org/psycopg3/docs/news.html#psycopg-3-1-20
psycopg = { version = ">=3.1.0,<3.2.4", extras = ["binary"], optional = true }
uuid6 = "^2024.7.10"
coloredlogs = {version = "*", optional = true}
python-json-logger = {version = "*", optional = true}
asyncpg = { version = ">=0.29,<0.31", optional = true }
apscheduler = { version = "^3.10.4", optional = true }
starlette-exporter = {version = "^0.23.0", optional = true}
itsdangerous = {version = "*", optional = true}
python-keycloak = {version = ">=4.7,<6.0", optional = true}
[tool.poetry.extras]
server = [
"pydantic-settings",
"sqlalchemy",
"sqlalchemy-utils",
"fastapi",
"starlette-exporter",
"uvicorn",
"alembic",
"python-multipart",
"python-jose",
"asgi-correlation-id",
"jinja2",
"psycopg",
"uuid6",
"coloredlogs",
"python-json-logger",
"asyncpg",
"itsdangerous",
"python-keycloak",
"pyyaml",
"celery",
]
worker = [
"pydantic-settings",
"sqlalchemy",
"sqlalchemy-utils",
"python-multipart",
"python-jose",
"celery",
"onetl",
"asgi-correlation-id",
"jinja2",
"psycopg",
"uuid6",
"coloredlogs",
"python-json-logger",
"pyyaml",
]
scheduler = [
"apscheduler",
"pydantic-settings",
"sqlalchemy",
"sqlalchemy-utils",
"asyncpg",
"python-multipart",
"python-jose",
"pyyaml",
"coloredlogs",
"python-json-logger",
"celery",
]
[tool.poetry.group.test.dependencies]
pandas-stubs = "^2.2.2.240909"
pytest = "^8.3.3"
httpx = "^0.27.2"
pytest-asyncio = ">=0.24,<0.26"
pytest-randomly = "^3.15.0"
pytest-deadfixtures = "^2.2.1"
pytest-mock = "^3.14.0"
onetl = {extras = ["spark", "s3", "hdfs"], version = "^0.12.0"}
faker = ">=28.4.1,<34.0.0"
coverage = "^7.6.1"
gevent = "^24.2.1"
responses = "*"
[tool.poetry.group.dev.dependencies]
mypy = "^1.11.2"
pre-commit = ">=3.8,<5.0"
black = "^24.8.0"
flake8 = "^7.0.0"
flake8-pyproject = "^1.2.3"
sqlalchemy = {extras = ["mypy"], version = "^2.0.35"}
types-python-jose = "^3.3.4.20240106"
[tool.poetry.group.docs.dependencies]
autodoc-pydantic = {version = "^2.2.0", python = ">=3.8"}
numpydoc = {version = "^1.8.0", python = ">=3.8"}
sphinx = [
{version = "^7.1.2", python = ">=3.8"},
{version = "^7.2.6", python = ">=3.9"},
]
furo = {version = "^2024.8.6", python = ">=3.8"}
sphinx-copybutton = {version = "^0.5.2", python = ">=3.8"}
sphinxcontrib-towncrier = {version = "^0.4.0a0", python = ">=3.8"}
# TODO: remove upper limit after https://github.com/sphinx-contrib/sphinxcontrib-towncrier/issues/92
towncrier = {version = ">=23.11,<24.7", python = ">=3.8"}
sphinx-issues = {version = ">=4.1,<6.0", python = ">=3.8"}
sphinx-design = {version = "^0.6.1", python = ">=3.8"}
sphinx-favicon = {version = "^1.0.1", python = ">=3.8"}
sphinx-argparse = {version = "^0.5.2", python = ">=3.8"}
# https://github.com/mgeier/sphinx-last-updated-by-git/pull/77
sphinx-last-updated-by-git = {version = "^0.3.8", python = ">=3.8"}
# uncomment after https://github.com/zqmillet/sphinx-plantuml/pull/4
# sphinx-plantuml = {version = "^1.0.0", python = ">=3.8"}
[tool.black]
line-length = 120
[tool.isort]
profile = "black"
py_version = "311"
known_first_party = ["app"]
[tool.mypy]
python_version = "3.11"
plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"]
follow_imports = "silent"
[[tool.mypy.overrides]]
module = "alembic.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "pyarrow.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "keycloak.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "avro.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "celery.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "fastapi.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "kombu.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "onetl.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "pyspark.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "sqlalchemy_utils.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "starlette.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "uvicorn.*"
ignore_missing_imports = true
[tool.pytest.ini_options]
markers = [
"server: tests for server (require running database)",
"scheduler: tests for scheduler (require running database)",
"worker: tests for syncmaster worker",
"hive: tests for Hive",
"postgres: tests on Postgres",
"oracle: tests for Oracle",
"hdfs: tests for hadoop hdfs",
"s3: tests for S3",
]
[tool.coverage.paths]
source = ["syncmaster"]
[tool.coverage.run]
branch = true
parallel = true
relative_files = true
concurrency = ["gevent", "multiprocessing"]
omit = [
"tests/*",
]
data_file = "reports/.coverage"
[tool.coverage.report]
precision = 2
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if .*debug:",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if log.isEnabledFor(logging.DEBUG):",
"if sys.version_info",
"@(abc\\.)?abstractmethod",
"\\.\\.\\.",
"def downgrade\\(\\)",
]
[tool.flake8]
jobs = 4
# We don't control ones who use our code
i-control-code = false
# Max of noqa in a module
max-noqa-comments = 10
max-annotation-complexity = 4
max-returns = 5
max-awaits = 5
max-local-variables = 20
max-name-length = 60
# Max of expressions in a function
max-expressions = 15
# Max args in a function
max-arguments = 15
# Max classes and functions in a single module
max-module-members = 35
max-import-from-members = 35
max-methods = 25
# Max line complexity measured in AST nodes
max-line-complexity = 24
# Max Jones Score for a module: the median of all lines complexity sum
max-jones-score = 15
# Max amount of cognitive complexity per function
max-cognitive-score = 20
# Max amount of cognitive complexity per module
max-cognitive-average = 25
max-imports = 25
max-imported-names = 50
# Max of expression usages in a module
max-module-expressions = 15
# Max of expression usages in a function
max-function-expressions = 15
max-base-classes = 5
max-decorators = 6
# Max of repeated string constants in your modules
max-string-usages = 15
max-try-body-length = 15
max-asserts = 15
# Max number of access level in an expression
max-access-level = 6
# maximum number of public instance attributes
max-attributes = 20
max-line-length = 120
max-doc-length = 120
# https://pypi.org/project/flake8-quotes/
inline-quotes = "double"
multiline-quotes = "double"
docstring-quotes = "double"
# https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html
show-source = true
# Print total number of errors
count = true
statistics = true
exclude = [
".tox",
"migrations",
"dist",
"build",
"hadoop_archive_plugin",
"virtualenv",
"venv",
"venv36",
"ve",
".venv",
"tox.ini",
"docker",
"Jenkinsfile",
"dags",
"setup.py",
"docs"
]
rst-directives = [
"autosummary",
"data",
"currentmodule",
"deprecated",
"glossary",
"moduleauthor",
"plot",
"testcode",
"versionadded",
"versionchanged"
]
# https://github.com/peterjc/flake8-rst-docstrings/pull/16
rst-roles = [
"attr",
"class",
"func",
"meth",
"mod",
"obj",
"ref",
"term",
"py:func",
"py:mod"
]
ignore = [
"ANN",
"FI1",
# Found upper-case constant in a class: DB_URL
"WPS115",
# Found statement that has no effect
"WPS428",
# Found `f` string [opinionated]
"WPS305",
# Found class without a base class (goes against PEP8) [opinionated]
"WPS306",
# Found line break before binary operator [goes against PEP8] [opinionated]
"W503",
# Found multiline conditions [opinionated]
"WPS337",
# Found mutable module constant [opinionated]
"WPS407",
# Found empty module:
"WPS411",
# Found nested import [opinionated]
"WPS433",
# Found negated condition [opinionated]
"WPS504",
# Found implicit `.get()` dict usage
"WPS529",
# Docstrings [opinionated]
"D",
# string does contain unindexed parameters'
"P101",
"P103",
# Found implicit string concatenation [optional]
"WPS326",
# Found wrong function call: locals'
"WPS421",
# module level import not at top of file
"E402",
# Document or section may not begin with a transition.
"RST399",
# Error in "code" directive
"RST307",
# Found `%` string formatting
"WPS323",
# doc line too long
"W505",
# line too long
"E501",
# Found wrong module name: util
"WPS100",
# Found wrong keyword: pass
"WPS420",
# Found incorrect node inside `class` body: pass
"WPS604",
# Found wrong variable name: data
"WPS110",
# Found builtin shadowing: id
"WPS125",
# Found too short name: e < 2
"WPS111",
# Found a line that starts with a dot
"WPS348",
# first argument of a method should be named 'self'
"N805",
# Found `finally` in `try` block without `except`
"WPS501",
# Wrong multiline string usage: textwrap.dedent + multiline comment
"WPS462",
# Found incorrect multi-line string: 3-quoted docstring with just one line
"WPS322",
# https://github.com/wemake-services/wemake-python-styleguide/issues/2847
# E704 multiple statements on one line (def)
"E704",
# WPS220 Found too deep nesting: 34 > 20
"WPS220",
]
per-file-ignores = [
# F401 imported but unused
# WPS410 Found wrong metadata variable: __all__
"__init__.py:F401,WPS410",
# WPS102 Found incorrect module name pattern
# WPS432 Found magic number: 256
"*migrations/*.py:WPS102,WPS432",
# WPS237 Found a too complex `f` string
"*exceptions/*.py:WPS237",
"*exceptions/__init__.py:F40,WPS410",
# TAE001 too few type annotations
# WPS231 Found function with too much cognitive complexity
# S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# WPS442 Found outer scope names shadowing
# WPS432 Found magic number
# WPS334 Found reversed complex comparison
# WPS218 Found too many `assert` statements: 19 > 15
# WPS226 Found string literal over-use: value > 15
# WPS118 Found too long name:
"*tests/*.py:TAE001,WPS231,S101,WPS442,WPS432,WPS334,WPS218,WPS226,WPS118",
]
[tool.towncrier]
name = "Syncmaster"
package = "syncmaster"
filename = "docs/changelog/NEXT_RELEASE.rst"
directory = "docs/changelog/next_release/"
title_format = "{version} ({project_date})"
issue_format = ":issue:`{issue}`"
[[tool.towncrier.type]]
directory = "breaking"
name = "Breaking Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "significant"
name = "Significant Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "improvement"
name = "Improvements"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "dependency"
name = "Dependencies"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Doc only Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Misc"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Removal"
showcontent = true
[tool.poetry_bumpversion.file."syncmaster/__init__.py"]
search = '_raw_version = "{current_version}"'
replace = '_raw_version = "{new_version}"'
[tool.poetry_bumpversion.file."docs/conf.py"]
search = 'ver = Version.parse("{current_version}")'
replace = 'ver = Version.parse("{new_version}")'