-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
442 lines (413 loc) · 10.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
[tool]
[tool.poetry]
name = "fastapi-boilerplate"
version = "0.1.0"
description = "FastAPI boilerplate"
license = "MIT"
authors = ["Juan Pablo Cadena Aguilar <jpcadena@espol.edu.ec>"]
maintainers = ["Juan Pablo Cadena Aguilar <jpcadena@espol.edu.ec>"]
readme = "README.md"
homepage = "https://github.com/jpcadena/fastapi-boilerplate"
repository = "https://github.com/jpcadena/fastapi-boilerplate"
documentation = "https://github.com/jpcadena/fastapi-boilerplate"
keywords = [
"python",
"backend",
"restful api",
"fastapi",
"boilerplate",
"template",
"poetry",
"pydantic",
"starlette",
"uvicorn",
"sqlalchemy",
"redis",
"isort",
"ruff",
"black-formatter",
"mypy",
"postgresql",
"solid-principles",
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
"Framework :: FastAPI",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Natural Language :: Spanish",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Topic :: Communications :: Email",
"Topic :: Communications :: Internet Phone",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Documentation",
"Topic :: File Formats",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development",
"Topic :: Software Development :: Version Control",
"Topic :: Software Development :: Version Control :: CVS",
"Topic :: Software Development :: Version Control :: Git",
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: Text Processing :: Markup :: Markdown",
"Topic :: Text Processing :: Markup :: reStructuredText",
"Typing :: Typed",
]
packages = [{include = "fastapi_boilerplate"}]
[tool.poetry.dependencies]
python = "^3.11"
fastapi = { extras = ["all"], version = "^0.115.6" }
uvicorn = { extras = ["standard"], version = "^0.34.0" }
starlette = "0.41.3"
pydantic = "^2.10.3"
pydantic-settings = "^2.6.1"
pydantic-extra-types = "^2.10.1"
email-validator = "^2.2.0"
phonenumbers = "^8.13.51"
pycountry = "^24.6.1"
python-dotenv = "^1.0.1"
python-multipart = "^0.0.20"
aiofiles = "^24.1.0"
types-aiofiles = "^24.1.0.20240626"
passlib = {extras = ["bcrypt"], version = "^1.7.4"}
types-passlib = "^1.7.7.20240819"
aiosmtplib = "^3.0.2"
sqlalchemy = { extras = ["asyncio"], version = "^2.0.36" }
asyncpg = "^0.30.0"
redis = "^5.2.1"
types-redis = "^4.6.0.20241004"
isort = {extras = ["colors"], version = "^5.13.2"}
black = "^24.10.0"
ruff = "^0.8.3"
mypy = "^1.13.0"
pre-commit = "^4.0.1"
bcrypt = "^4.2.1"
authlib = "^1.3.2"
pytest = "^8.3.4"
pytest-asyncio = "^0.25.0"
pytest-mock = "^3.14.0"
pytest-cov = "^6.0.0"
coverage = "^7.6.9"
asgi-lifespan = "^2.1.0"
trio = "^0.27.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dev-dependencies]
pytest = "^8.3.4"
coverage = "^7.6.9"
[tool.poetry.extras]
pgsql = ["asyncpg"]
redis = ["redis"]
databases = ["asyncpg", "redis", ]
[tool.poetry.urls]
"FastAPI boilerplate" = "https://github.com/jpcadena/fastapi-boilerplate"
[tool.poetry.scripts]
test = "pytest"
[tool.isort]
py_version = 311
skip_glob = ["cache/*", "tests/*", ".ruff_cache/*", ".pytest_cache/*", ".mypy_cache/", "logs/*", ]
skip_gitignore = true
line_length = 80
multi_line_output = 3
use_parentheses = true
atomic = true
include_trailing_comma = true
force_grid_wrap = 0
case_sensitive = true
ensure_newline_before_comments = true
profile = "black"
remove_redundant_aliases = true
color_output = true
[tool.black]
line-length = 80
target-version = ["py311"]
exclude = '''
(
/(\.venv
| \.mypy_cache
| \.ruff_cache
| \.pytest_cache
| cache
| venv
| tests)/
)
'''
skip-string-normalization = true
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".pytest_cache",
"cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
line-length = 80
indent-width = 4
target-version = "py311"
fix = true
output-format = "grouped"
show-fixes = true
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C4", # flake8-comprehensions
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
]
fixable = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"T",
"W",
"ANN",
"ARG",
"BLE",
"COM",
"DJ",
"DTZ",
"EM",
"ERA",
"EXE",
"FBT",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
"YTT",
]
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
quote-style = "double"
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = 80
[tool.ruff.lint.isort]
known-third-party = ["fastapi", "pydantic", "starlette"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.pep8-naming]
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
classmethod-decorators = [
"pydantic.validator"
]
[tool.ruff.lint.pydocstyle]
convention = "pep257" # google, numpy
ignore-decorators = ["typing.overload"]
[tool.ruff.lint.pylint]
allow-dunder-method-names = ["__tablename__", "__table_args__"] # PLW3201
[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
[tool.mypy]
exclude = '''
(
/(\.venv
| \.mypy_cache
| \.ruff_cache
| \.pytest_cache
| cache
| venv
| tests)/
)
'''
ignore_missing_imports = true
follow_imports = "silent"
python_version = "3.11"
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
implicit_reexport = false
strict_equality = true
strict = true
show_error_context = true
show_error_codes = true
pretty = true
plugins = ["pydantic.mypy"]
show_traceback = true
raise_exceptions = true
[tool.mypy-tests]
ignore_errors = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.bandit]
exclude_dirs = ["venv/*", ".mypy_cache/*", ".pytest_cache/*", ".ruff_cache/*", ".venv/*", "tests/*", ]
tests = ["B301"]
skips = ["B101", "B601", "B201", ]
[tool.pytest.ini_options]
addopts = [
"-rxXs", # Display extra info for test failures
"--strict-config", # Enforce strict pytest configuration
"--strict-markers", # Enforce strict markers
"--ignore=docs_src", # Ignore the 'docs_src' directory
"--cov=fastapi_boilerplate",
"--durations=10"
]
empty_parameter_set_mark = "xfail"
faulthandler_timeout = 5
filterwarnings = [
"error",
'ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10:DeprecationWarning:asyncio',
'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette',
"ignore:'cgi' is deprecated:DeprecationWarning",
"ignore:'crypt' is deprecated and slated for removal in Python 3.13:DeprecationWarning",
'ignore::pytest.PytestDeprecationWarning:pytest_cov',
"ignore::DeprecationWarning",
"ignore::UserWarning",
"ignore:the imp module is deprecated in favour of importlib:DeprecationWarning",
]
junit_duration_report = "call"
junit_logging = "system-out"
junit_log_passing_tests = false
log_auto_indent = true
log_cli = true
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
log_cli_format = "%(asctime)s [%(level)s] %(message)s"
log_cli_level = "INFO"
log_date_format = "%Y-%m-%d %H:%M:%S"
log_file = "logs/pytest-logs.txt"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
log_file_format = "%(asctime)s [%(level)s] %(message)s"
log_file_level = "INFO"
log_format = "%(asctime)s [%(level)s] %(message)s"
log_level = "INFO"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration (deselect with '-m \"not integration\"')",
]
minversion = "6.0"
norecursedirs = [".svn", "_build", "tmp*", "node_modules", "venv", ".venv"]
python_classes = "*TestSuite"
python_files = ["test_*.py", "*_test.py"]
python_functions = ["test_*", "*_test"]
pythonpath = ["src", "tests"]
required_plugins = ["pytest-cov", "pytest-asyncio"]
testpaths = ["tests"]
usefixtures = ["database_fixture"]
verbosity_assertions = 2
xfail_strict = true
[tool.coverage.run]
branch = true
concurrency = ["thread", "multiprocessing"]
context = "."
data_file = ".coverage"
disable_warnings = ["module-not-imported"]
omit = [
"fastapi_boilerplate/tests/*",
"fastapi_boilerplate/migrations/*",
".ruff_cache/*",
".mypy_cache/*",
".pytest_cache/*",
"cache/*",
".venv/*",
"venv/*",
]
parallel = true
source = ["fastapi_boilerplate", "."]
relative_files = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self\\.debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if TYPE_CHECKING:",
"@typing.overload",
"if __name__ == .__main__.:"
]
fail_under = 90.0
ignore_errors = true
show_missing = true
skip_covered = true
skip_empty = true
sort = "Cover"
[tool.coverage.html]
extra_css = "assets/css/coverage.css"
title = "FastAPI Boilerplate Coverage Report"
[tool.coverage.paths]
source = [
"fastapi_boilerplate",
"."
]
[tool.codeflash]
# All paths are relative to this pyproject.toml's directory.
module-root = "app"
tests-root = "tests"
test-framework = "pytest"
ignore-paths = []