-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyproject.toml
699 lines (645 loc) · 18.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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
####################
# Project Metadata #
####################
[project]
description = 'Reusable database fixtures for any and all databases.'
license = "MIT"
name = "pytest-databases"
readme = "README.md"
requires-python = ">=3.8"
version = "0.10.0"
#
authors = [{ name = "Cody Fincher", email = "[email protected]" }]
keywords = [
"database",
"migration",
"postgres",
"mysql",
"oracle",
"mssql",
"duckdb",
"bigquery",
"spanner",
"alloydb",
"alloydbomni",
"cockroachdb",
"redis",
"elasticsearch",
"azure",
]
# options under https://pypi.org/classifiers/
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
# direct dependencies of this package
dependencies = ["pytest"]
[project.urls]
Documentation = "https://github.com/litestar-org/pytest-databases#readme"
Issues = "https://github.com/litestar-org/pytest-databases/issues"
Source = "https://github.com/litestar-org/pytest-databases"
[project.optional-dependencies]
azure-storage = ["azure-storage-blob"]
bigquery = ["google-cloud-bigquery"]
cockroachdb = ["psycopg"]
dragonfly = ["redis"]
elasticsearch7 = ["elasticsearch7"]
elasticsearch8 = ["elasticsearch8"]
keydb = ["redis"]
mssql = ["pymssql"]
mysql = ["pymysql"]
oracle = ["oracledb"]
postgres = ["psycopg>=3"]
redis = ["redis"]
spanner = ["google-cloud-spanner"]
######################
# Build & Versioning #
######################
[tool.hatch.build.targets.sdist]
exclude = ["/.github", "/docs"]
[tool.hatch.metadata]
allow-direct-references = true
#####################
# Environment Setup #
#####################
# Default environment with production dependencies
[tool.hatch.envs.default]
extra-dependencies = [
# tests
"coverage[toml]>=6.2",
"coverage[toml]>=6.2",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-vcr",
"pytest-click",
"pytest-xdist",
# lint
"mypy",
"ruff",
"pylint",
"pre-commit",
"types-click",
"types-six",
"types-decorator",
"types-pyyaml",
"types-docutils",
"types-redis",
"types-pymysql",
# docs
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-click>=5.0.1",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.4.0",
]
installer = "uv"
python = "3.12"
# Test environment with test-only dependencies
[tool.hatch.envs.test]
extra-dependencies = [
# tests
"coverage[toml]>=6.2",
"coverage[toml]>=6.2",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-vcr",
"pytest-click",
"pytest-xdist",
# lint
"mypy",
"ruff",
"pylint",
"pre-commit",
"types-click",
"types-six",
"types-decorator",
"types-pyyaml",
"types-docutils",
"types-redis",
"types-pymysql",
# docs
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-click>=5.0.1",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.4.0",
]
features = [
"oracle",
"mysql",
"mssql",
"postgres",
"spanner",
"cockroachdb",
"spanner",
"redis",
"elasticsearch7",
"elasticsearch8",
"bigquery",
"azure-storage",
]
template = "default"
type = "virtual"
[tool.hatch.envs.test.env-vars]
PYTHONPATH = ".:src/"
PYTHONUNBUFFERED = "1"
SOURCE_DATE_EPOCH = "1580601600"
# Test matrix for various Python versions replacing the functionality of tox
[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
[tool.hatch.envs.test.scripts]
cov = "pytest --cov=pytest_databases --cov-report=xml"
debug = "cov --no-cov -s --pdb --pdbcls=IPython.core.debugger:Pdb"
no-cov = "cov --no-cov"
# Docs environment
[tool.hatch.envs.docs]
extra-dependencies = [
# tests
"coverage[toml]>=6.2",
"coverage[toml]>=6.2",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-vcr",
"pytest-click",
"pytest-xdist",
# lint
"mypy",
"ruff",
"pylint",
"pre-commit",
"types-click",
"types-six",
"types-decorator",
"types-pyyaml",
"types-docutils",
"types-redis",
"types-pymysql",
# docs
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-click>=5.0.1",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.4.0",
]
features = [
"oracle",
"mysql",
"mssql",
"postgres",
"spanner",
"cockroachdb",
"spanner",
"redis",
"elasticsearch7",
"elasticsearch8",
"bigquery",
"azure-storage",
]
python = "3.11"
template = "default"
type = "virtual"
[tool.hatch.envs.docs.env-vars]
PYTHONPATH = "."
PYTHONUNBUFFERED = "1"
SOURCE_DATE_EPOCH = "1580601600"
[tool.hatch.envs.docs.scripts]
build = "sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going"
serve = "sphinx-autobuild docs docs/_build/ -j auto --watch pytest_databases --watch docs --watch tests --watch CONTRIBUTING.rst --port 8002 {args}"
# --ignore-url=None since the SUMMARY.md file leaves a <toc>None</toc> in sitemap.xml
validate = "linkchecker --config .linkcheckerrc --ignore-url=/reference --ignore-url=None site"
# https://github.com/linkchecker/linkchecker/issues/678
build-check = ["build", "validate"]
[tool.hatch.envs.local]
extra-dependencies = [
# tests
"coverage[toml]>=6.2",
"coverage[toml]>=6.2",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-vcr",
"pytest-click",
"pytest-xdist",
# lint
"mypy",
"ruff",
"pylint",
"pre-commit",
"types-click",
"types-six",
"types-decorator",
"types-pyyaml",
"types-docutils",
"types-redis",
"types-pymysql",
# docs
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-click>=5.0.1",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.4.0",
]
features = [
"oracle",
"mysql",
"mssql",
"postgres",
"cockroachdb",
"spanner",
"redis",
"elasticsearch7",
"elasticsearch8",
"bigquery",
"azure-storage",
]
path = ".venv/"
python = "3.11"
template = "docs"
type = "virtual"
# Lint environment
[tool.hatch.envs.lint]
extra-dependencies = [
# tests
"coverage[toml]>=6.2",
"coverage[toml]>=6.2",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-vcr",
"pytest-click",
"pytest-xdist",
# lint
"mypy",
"ruff",
"pylint",
"pre-commit",
"types-click",
"types-six",
"types-decorator",
"types-pyyaml",
"types-docutils",
"types-redis",
"types-pymysql",
# docs
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-click>=5.0.1",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.4.0",
]
python = "3.12"
type = "virtual"
[tool.hatch.envs.lint.scripts]
check = ["style", "typing"]
fix = [
"typing",
"ruff format {args:.}",
"ruff check --fix {args:.}",
"style", # feedback on what is not fixable
"pre-commit run --all-files",
]
style = ["echo \"VERSION: `ruff --version`\"", "ruff check {args:.}", "ruff format --check {args:.}"]
typing = ["echo \"VERSION: `mypy --version`\"", "mypy --install-types --non-interactive {args}"]
##################
# External Tools #
##################
## Linting Tools
[tool.slotscheck]
strict-imports = false
[tool.codespell]
ignore-words-list = "alog"
skip = 'pdm.lock, package-lock.json'
[tool.pyright]
exclude = ["scripts", "docs"]
include = ["src/pytest_databases", "tests"]
[tool.git-cliff.changelog]
body = """
{% if version %}\
`Release [v{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} <https://github.com/litestar-org/pytest-databases/releases/tag/v{{ version | trim_start_matches(pat="v") }}>`_
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* `See All commits in v{{ version | trim_start_matches(pat="v") }} <https://github.com/litestar-org/pytest-databases/commits/v{{ version | trim_start_matches(pat="v") }}>`_
{% else %}\
[unreleased]
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{% endif %}\
{% if previous %}\
{% if previous.commit_id %}
`{{ previous.commit_id | truncate(length=7, end="") }} <https://github.com/litestar-org/pytest-databases/commit/{{ previous.commit_id }}>`_ ... \
`{{ commit_id | truncate(length=7, end="") }} <https://github.com/litestar-org/pytest-databases/commit/{{ commit_id }}>`_ \
| `See diff for {{ version | trim_start_matches(pat="v") }} <https://github.com/litestar-org/pytest-databases/compare/{{ previous.commit_id }}...{{ commit_id }}>`_
{% endif %}\
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
{{ group | upper_first }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{% for commit in commits %}
* (`{{ commit.id | truncate(length=7, end="") }} <https://github.com/litestar-org/pytest-databases/commit/{{ commit.id }}>`_) {% if commit.breaking %}[**breaking**] {% endif %} - {{ commit.message | upper_first }} ({{ commit.author.name }})\
{% for footer in commit.footers -%}
, {{ footer.token }}{{ footer.separator }}{{ footer.value }}\
{% endfor %}\
{% endfor %}
{% endfor %}\n
"""
footer = """
Pytest Databases Changelog
"""
header = """
=========
Changelog
=========\n
All commits to this project will be documented in this file.\n
"""
trim = true
[tool.git-cliff.git]
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
]
conventional_commits = true
filter_commits = false
filter_unconventional = true
ignore_tags = ""
protect_breaking_commits = false
skip_tags = "v0.1.0-beta.1"
sort_commits = "oldest"
split_commits = false
tag_pattern = "v[0-9]*"
topo_order = false
[tool.mypy]
disallow_untyped_defs = false
files = ["src/pytest_databases", "tests"]
follow_imports = "normal" # "silent" for not following
ignore_missing_imports = true
pretty = true
show_column_numbers = true
warn_no_return = false
warn_unused_ignores = true
[[tool.mypy.overrides]]
disable_error_code = "attr-defined"
module = "pytest_databases.docker.spanner"
[[tool.mypy.overrides]]
disable_error_code = "attr-defined"
module = "pytest_databases.docker.bigquery"
[[tool.mypy.overrides]]
disable_error_code = "attr-defined"
disallow_untyped_decorators = false
module = "tests.*"
warn_unused_ignores = false
[[tool.mypy.overrides]]
disable_error_code = ["arg-type"]
disallow_untyped_calls = false
disallow_untyped_decorators = false
module = ["docutils.nodes.*"]
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"pyodbc",
"google.auth.*",
"google.cloud.*",
"google.protobuf.*",
"googleapiclient",
"googleapiclient.*",
]
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
'__pycache__',
]
fix = true
include = ["src/**/*.py", "src/**/*.pyi", "tests/**/*.py", "tests/**/*.pyi"]
line-length = 120
lint.fixable = ["ALL"]
lint.ignore = [
"B027", # Allow non-abstract empty methods in abstract base classes
"FBT003", # Allow boolean positional values in function calls, like `dict.get(... True)`
# Ignore checks for possible passwords
"S105",
"S106",
"S107",
# Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLC1901", # empty string comparisons
"PLW2901", # `for` loop variable overwritten
"SIM114", # Combine `if` branches using logical `or` operator
"E203", # Whitespace before :, needed for black compatability and also `ruff format`
"ISC001", # causes unexpected behaviour with formatter
"E501", # pycodestyle line too long, handled by black
"D100", # pydocstyle - missing docstring in public module
"D101", # pydocstyle - missing docstring in public class
"D102", # pydocstyle - missing docstring in public method
"D103", # pydocstyle - missing docstring in public function
"D104", # pydocstyle - missing docstring in public package
"D105", # pydocstyle - missing docstring in magic method
"D106", # pydocstyle - missing docstring in public nested class
"D107", # pydocstyle - missing docstring in __init__
"D202", # pydocstyle - no blank lines allowed after function docstring
"D205", # pydocstyle - 1 blank line required between summary line and description
"D415", # pydocstyle - first line should end with a period, question mark, or exclamation point
"UP037", # pyupgrade - removes quotes from type annotation
"A003", # flake8-builtins - class attribute {name} is shadowing a python builtin
"B010", # flake8-bugbear - do not call setattr with a constant attribute value
"B008", # flake8-bugbear - Do not perform function call `Parameter` in argument defaultsRuff(B008)
"RUF012", # ruff - mutable class attributes should be annotated with `typing.ClassVar`
"ANN401", # ruff - Dynamically typed expressions (typing.Any) are disallowed
"ANN102",
"ANN101", # ruff - Missing type annotation for `self` in method
"PLR0913", # ruff - Too many arguments to function call
"PLR2004", # Magic value used in comparison
"FBT001", # Boolean typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FBT003", # Boolean Boolean default positional argument in function definition
"ARG002", # Unused method argument
"ARG001", # Unused function argument
"TD002",
"TD003",
"FIX002",
"PGH003",
"RUF006",
"RUF029", # Ruff - Function is declared `async`, but doesn't `await` or use `async` features. # ignore
"SLF001",
"PT007",
'PT004',
'PT005',
'S603',
"E501", # pycodestyle line too long, handled by black
"PLW2901", # pylint - for loop variable overwritten by assignment target
"ANN401",
"ANN102",
"ANN101",
"FBT",
"PLR0913", # too many arguments
"PT",
"TD",
"PERF203", # ignore for now; investigate
"COM812",
"PLR0917",
"CPY001", # copywrite check
"DOC201", # `return` is not documented in docstring
"DOC501", # Raised exception missing from docstring
"DOC502", # Raised exception missing from docstring
"A005", # module shadows builtin
]
lint.select = ["ALL"]
# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
preview = true # preview features & checks, use with caution
src = ["src", "tests/", "docs/"]
target-version = "py38"
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["pytest_databases", "tests"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.per-file-ignores]
# Allow print/pprint
"__init__.py" = ['F401', 'D104']
"__main__.py" = ["E402"]
"docs/*" = ["S404", "INP001"]
"examples/*" = ["T201"]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = [
"PLR2004",
"S101",
"TID252",
"ERA001",
"ANN201",
"ANN001",
"D103",
"D104",
"T201",
"S404",
"PLR6301",
"FA102",
]
[tool.ruff.lint.mccabe]
max-complexity = 12
[tool.ruff.lint.pep8-naming]
classmethod-decorators = ["classmethod"]
# configure in-case someone runs this
[tool.black]
exclude = '''
/(
\.git
| \.mypy_cache
| \.tox
| venv
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
include = '\.pyi?$'
line-length = 120
## Testing Tools
[tool.pytest.ini_options]
addopts = "--dist loadfile -n 2 -ra -q --doctest-glob='*.md'"
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources",
"ignore::DeprecationWarning:xdist.*",
"ignore::DeprecationWarning:importlib._bootstrap",
]
markers = [
"mysql: MySQL Tests",
"postgres: Postgres Tests",
"oracle: Oracle Tests",
"spanner: Google Cloud Spanner Tests",
"duckdb: DuckDB Tests",
"mssql: Microsoft SQL Server Tests",
"elasticsearch: Elasticsearch Tests",
]
testpaths = ["tests"]
[tool.coverage.run]
branch = true
concurrency = ["multiprocessing"]
disable_warnings = ["no-data-collected", "module-not-measured", "module-not-imported"]
omit = [
"_version.py", # automatically created by hatch-vcs, not in repo
"src/pytest_databases/__metadata__.py",
"tests/*",
"scripts/*",
]
parallel = true
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
'class .*\bProtocol\):',
'@(abc\.)?abstractmethod',
]