-
-
Notifications
You must be signed in to change notification settings - Fork 380
/
pyproject.toml
509 lines (470 loc) · 14.8 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
[project]
authors = [
{name = "Cody Fincher", email = "cody@litestar.dev"},
{name = "Jacob Coffee", email = "jacob@litestar.dev"},
{name = "Janek Nouvertné", email = "janek@litestar.dev"},
{name = "Na'aman Hirschfeld", email = "nhirschfeld@gmail.com"},
{name = "Peter Schutt", email = "peter@litestar.dev"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"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",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development",
"Typing :: Typed",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"anyio>=3",
"httpx>=0.22",
"exceptiongroup; python_version < \"3.11\"",
"importlib-metadata; python_version < \"3.10\"",
"importlib-resources>=5.12.0; python_version < \"3.9\"",
"msgspec>=0.18.2",
"multidict>=6.0.2",
"polyfactory>=2.6.3",
"pyyaml",
"typing-extensions",
"click",
"rich>=13.0.0",
"rich-click",
# default litestar plugins
"litestar-htmx>=0.3.0"
]
description = "Litestar - A production-ready, highly performant, extensible ASGI API Framework"
keywords = ["api", "rest", "asgi", "litestar", "starlite"]
license = {text = "MIT"}
maintainers = [
{name = "Litestar Developers", email = "hello@litestar.dev"},
{name = "Cody Fincher", email = "cody@litestar.dev"},
{name = "Jacob Coffee", email = "jacob@litestar.dev"},
{name = "Janek Nouvertné", email = "janek@litestar.dev"},
{name = "Peter Schutt", email = "peter@litestar.dev"},
{name = "Visakh Unnikrishnan", email = "guacs@litestar.dev"},
{name = "Alc", email = "alc@litestar.dev"}
]
name = "litestar"
readme = "README.md"
requires-python = ">=3.8,<4.0"
version = "2.12.1"
[project.urls]
Blog = "https://blog.litestar.dev"
Changelog = "https://github.com/litestar-org/litestar/releases/"
Discord = "https://discord.gg/litestar"
Documentation = "https://docs.litestar.dev/"
Homepage = "https://litestar.dev/"
"Issue Tracker" = "https://github.com/litestar-org/litestar/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc"
Reddit = "https://www.reddit.com/r/LitestarAPI"
Repository = "https://github.com/litestar-org/litestar"
Twitter = "https://twitter.com/LitestarAPI"
[project.optional-dependencies]
annotated-types = ["annotated-types"]
attrs = ["attrs"]
htmx = ["litestar-htmx>=0.3.0"]
brotli = ["brotli"]
cli = ["jsbeautifier", "uvicorn[standard]", "uvloop>=0.18.0; sys_platform != 'win32'"]
cryptography = ["cryptography"]
full = [
"litestar[annotated-types,attrs,brotli,cli,cryptography,jinja,jwt,mako,minijinja,opentelemetry,piccolo,picologging,prometheus,pydantic,redis,sqlalchemy,standard,structlog]",
]
jinja = ["jinja2>=3.1.2"]
jwt = [
"cryptography",
"pyjwt>=2.9.0",
]
mako = ["mako>=1.2.4"]
minijinja = ["minijinja>=1.0.0"]
opentelemetry = ["opentelemetry-instrumentation-asgi"]
piccolo = ["piccolo"]
picologging = ["picologging"]
prometheus = ["prometheus-client"]
pydantic = ["pydantic", "email-validator", "pydantic-extra-types"]
redis = ["redis[hiredis]>=4.4.4"]
sqlalchemy = ["advanced-alchemy>=0.2.2"]
standard = ["jinja2", "jsbeautifier", "uvicorn[standard]", "uvloop>=0.18.0; sys_platform != 'win32'", "fast-query-parsers>=1.0.2"]
structlog = ["structlog"]
[project.scripts]
litestar = "litestar.__main__:run_cli"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.sdist]
include = [
'docs/PYPI_README.md',
'/Makefile',
'/litestar',
'/tests',
'/CHANGELOG.rst',
]
[tool.pdm]
ignore_package_warnings = [
"alabaster",
"sphinxcontrib-*",
"sphinx-*",
"sphinx",
"pre-commit",
"pydata-sphinx-*",
"slotscheck",
"autobahn",
"accessible-pygments"
]
[tool.pdm.dev-dependencies]
dev = [
"beanie>=1.21.0",
"beautifulsoup4",
"fsspec",
"greenlet",
"hypothesis",
"python-dotenv",
"starlette",
"trio",
"aiosqlite",
"asyncpg>=0.29.0",
"psycopg[pool,binary]>=3.1.10,<3.2",
"psycopg2-binary",
"psutil>=5.9.8",
"hypercorn>=0.16.0",
"daphne>=4.0.0",
]
dev-contrib = ["opentelemetry-sdk", "httpx-sse"]
docs = [
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"sphinx-copybutton>=0.5.2",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinx-click>=4.4.0",
"sphinxcontrib-mermaid>=0.9.2",
"auto-pytabs[sphinx]>=0.5.0",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git",
"sphinx-paramlinks>=0.6.0",
]
linting = [
"ruff>=0.2.1",
"mypy",
"pre-commit",
"slotscheck",
"codecov-cli",
"pyright==1.1.344",
"asyncpg-stubs",
"types-beautifulsoup4",
"types-pyyaml",
"types-redis",
"types-psutil",
]
test = [
"covdefaults",
"pytest<8.0.0",
"pytest-asyncio",
"pytest-cov",
"pytest-lazy-fixtures",
"pytest-mock",
"pytest-rerunfailures",
"pytest-timeout",
"pytest-xdist",
"time-machine",
]
[tool.pdm.scripts]
ci = {composite = ["lint", "test"]}
docs-serve = "sphinx-autobuild docs docs/_build/ -j auto --watch litestar --watch docs --watch tests --port 8002"
lint = "pre-commit run --all-files"
test = "pytest tests docs/examples"
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[tool.codespell]
ignore-words-list = "selectin"
skip = 'pdm.lock,docs/examples/contrib/sqlalchemy/us_state_lookup.json'
[tool.coverage.run]
concurrency = ["multiprocessing", "thread"]
omit = ["*/tests/*", "*/litestar/plugins/sqlalchemy.py", "*/litestar/_kwargs/types.py"]
parallel = true
plugins = ["covdefaults"]
source = ["litestar"]
[tool.coverage.report]
exclude_lines = [
'except ImportError\b',
'if VERSION.startswith("1"):',
'if pydantic.VERSION.startswith("1"):',
]
fail_under = 50
[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config --dist=loadgroup -m 'not server_integration'"
asyncio_mode = "auto"
filterwarnings = [
"ignore::trio.TrioDeprecationWarning:anyio._backends._trio*:",
"ignore::DeprecationWarning:pkg_resources.*",
"ignore::DeprecationWarning:google.rpc",
"ignore::DeprecationWarning:google.gcloud",
"ignore::DeprecationWarning:google.iam",
"ignore::DeprecationWarning:google",
"ignore::DeprecationWarning:sphinxcontrib",
"ignore::DeprecationWarning:litestar.*",
"ignore::pydantic.PydanticDeprecatedSince20::",
"ignore:`general_plain_validator_function`:DeprecationWarning::",
"ignore: 'RichMultiCommand':DeprecationWarning::", # this is coming from rich_click itself, nothing we can do about # that for now
"ignore: Dropping max_length:litestar.exceptions.LitestarWarning:litestar.contrib.piccolo",
"ignore: Python Debugger on exception enabled:litestar.exceptions.LitestarWarning:",
"ignore: datetime.datetime.utcnow:DeprecationWarning:time_machine",
]
markers = [
"sqlalchemy_integration: SQLAlchemy integration tests",
"server_integration: Test integration with ASGI server",
]
testpaths = ["tests", "docs/examples/testing"]
xfail_strict = true
[tool.mypy]
packages = ["litestar", "tests"]
plugins = ["pydantic.mypy"]
enable_error_code = [
"truthy-bool",
"truthy-iterable",
"unused-awaitable",
"ignore-without-code",
"possibly-undefined",
"redundant-self",
]
python_version = "3.8"
disallow_any_generics = false
show_error_codes = true
strict = true
warn_unreachable = true
local_partial_types = true
[[tool.mypy.overrides]]
ignore_errors = true
module = ["tests.examples.*", "tests.docker_service_fixtures"]
[[tool.mypy.overrides]]
module = ["tests.*"]
disable_error_code = ["truthy-bool"]
[[tool.mypy.overrides]]
disallow_untyped_decorators = false
module = ["tests.unit.test_kwargs.test_reserved_kwargs_injection"]
[[tool.mypy.overrides]]
module = ["tests.unit.test_contrib.test_repository"]
strict_equality = false
[[tool.mypy.overrides]]
module = ["tests.unit.test_plugins.test_pydantic.test_openapi","litestar._asgi.routing_trie.traversal"]
disable_error_code = "index, union-attr"
[[tool.mypy.overrides]]
module = ["tests.unit.test_channels.test_subscriber", "tests.unit.test_response.test_streaming_response"]
disable_error_code = "arg-type, comparison-overlap, unreachable"
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"brotli.*",
"fsspec.*",
"jsbeautifier.*",
"pytimeparse.*",
"importlib_resources",
"exceptiongroup",
]
[[tool.mypy.overrides]]
warn_unused_ignores = false
module = [
"litestar.contrib.sqlalchemy.*",
"litestar.plugins.pydantic.*",
"tests.unit.test_contrib.test_sqlalchemy",
"tests.unit.test_contrib.test_pydantic.*",
"litestar.openapi.spec.base",
"litestar.utils.helpers",
"litestar.channels.plugin",
"litestar.handlers.http_handlers._utils"
]
[[tool.mypy.overrides]]
warn_unused_ignores = false
module = [
"litestar.openapi.spec.base",
"litestar._asgi.routin_trie.traversal",
"litestar.plugins.pydantic.plugins.int",
]
disable_error_code = "arg-type"
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.pyright]
disableBytesTypePromotions = true
exclude = [
"test_apps",
"tools",
"docs",
"tests/examples",
"tests/docker_service_fixtures.py",
"litestar/plugins/pydantic/plugins/di.py",
"litestar/plugins/pydantic/plugins/init.py",
"litestar/plugins/pydantic/plugins/schema.py",
"litestar/plugins/pydantic/dto_factory.py",
"tests/unit/test_contrib/test_sqlalchemy.py",
]
include = ["litestar", "tests"]
pythonVersion = "3.8"
reportUnnecessaryTypeIgnoreComments = true
[tool.slotscheck]
strict-imports = false
exclude-classes = """
(
# github.com/python/cpython/pull/106771
(^litestar.events.emitter:BaseEventEmitterBackend)
# review these as time permits
|(^litestar.connection.base:ASGIConnection)
|(^litestar.datastructures.state:ImmutableState)
|(^litestar.datastructures.state:State)
|(^litestar.dto.base_dto:AbstractDTO)
|(^litestar.dto.data_structures:DTOData)
|(^litestar.middleware.session.base:BaseSessionBackend)
|(^litestar.pagination:ClassicPagination)
|(^litestar.pagination:CursorPagination)
|(^litestar.response.base:Response)
|(^litestar.testing.client.base:BaseTestClient)
|(^litestar.testing.life_span_handler:LifeSpanHandler)
|(^litestar.utils.sync:AsyncIteratorWrapper)
)
"""
[tool.ruff]
include = [
"{litestar,tests,docs,test_apps,tools}/**/*.{py,pyi}",
"pyproject.toml"
]
lint.select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"ERA", # eradicate
"EXE", # flake8-executable
"F", # pyflakes
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PIE", # flake8-pie
"PLC", # pylint - convention
"PLE", # pylint - error
"PLW", # pylint - warning
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle - warning
"YTT", # flake8-2020
]
line-length = 120
lint.ignore = [
"A003", # flake8-builtins - class attribute {name} is shadowing a python builtin
"B010", # flake8-bugbear - do not call setattr with a constant attribute value
"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
"E501", # pycodestyle line too long, handled by ruff format
"PLW2901", # pylint - for loop variable overwritten by assignment target
"RUF012", # Ruff-specific rule - annotated with classvar
"ISC001", # Ruff formatter incompatible
"CPY001", # ruff - copyright notice at the top of the file
]
src = ["litestar", "tests", "docs/examples"]
target-version = "py38"
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.mccabe]
max-complexity = 12
[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
"classmethod",
"pydantic.root_validator",
"pydantic.validator",
"sqlalchemy.ext.declarative.declared_attr",
"sqlalchemy.orm.declared_attr.directive",
"sqlalchemy.orm.declared_attr",
]
[tool.ruff.lint.isort]
known-first-party = ["litestar", "tests", "examples"]
[tool.ruff.lint.per-file-ignores]
"docs/**/*.*" = ["S", "B", "DTZ", "A", "TCH", "ERA", "D", "RET"]
"docs/examples/**" = ["T201"]
"docs/examples/application_hooks/before_send_hook.py" = ["UP006"]
"docs/examples/contrib/sqlalchemy/plugins/**/*.*" = ["UP006"]
"docs/examples/data_transfer_objects**/*.*" = ["UP006"]
"docs/examples/contrib/sqlalchemy/sqlalchemy_declarative_models.py" = ["UP006"]
"litestar/_openapi/schema_generation/schema.py" = ["C901"]
"litestar/exceptions/*.*" = ["N818"]
"litestar/handlers/**/*.*" = ["N801"]
"litestar/handlers/websocket_handlers/listener.py" = ["B027"]
"litestar/params.py" = ["N802"]
"test_apps/**/*.*" = ["D", "TRY", "EM", "S", "PTH"]
"tests/**/*.*" = [
"A",
"ARG",
"B",
"BLE",
"C901",
"D",
"DTZ",
"EM",
"FBT",
"G",
"N",
"PGH",
"PIE",
"PLR",
"PLW",
"PTH",
"RSE",
"S",
"S101",
"SIM",
"TCH",
"TRY",
"E721",
]
"tests/unit/test_contrib/test_sqlalchemy/**/*.*" = ["UP006"]
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT"]
"tools/prepare_release.py" = ["S603", "S607"]
"tests/unit/test_openapi/test_typescript_converter/test_converter.py" = ["W293"]
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88
[tool.unasyncd]
add_editors_note = true
ruff_fix = true
[tool.unasyncd.files]
"litestar/repository/abc/_async.py" = "litestar/repository/abc/_sync.py"
[tool.unasyncd.per_file_add_replacements."litestar/repository/abc/_async.py"]
"AbstractAsyncRepository" = "AbstractSyncRepository"
"AsyncRepoT" = "SyncRepoT"