Skip to content

refactor: asgimiddleware everywhere if possible #4055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 131 commits into
base: v3.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
d6e6eee
docs!: update to v3 style (#3324)
JacobCoffee Apr 10, 2024
4a1cfe3
refactor!: Remove deprecated `StaticFileConfig` (#3357)
provinzkraut Apr 10, 2024
a1a4368
feat!: no implicit default for optional params (#3361)
peterschutt Apr 10, 2024
ac3031d
refactor: removes deprecated OpenAPIController (#3360)
peterschutt Apr 10, 2024
2977223
refactor!: Remove deprecated `app` param of `Response.to_asgi_respons…
provinzkraut Apr 15, 2024
1d094ca
refactor!: Remove deprecated utils (#3394)
peterschutt Apr 15, 2024
0b3b126
refactor(routing)!: Refactor routes and route handlers (#3386)
provinzkraut Apr 21, 2024
5924dba
docs!: update to v3 style (#3324) (#3432)
JacobCoffee Apr 27, 2024
464b71c
Fix rebase issue
provinzkraut Apr 27, 2024
382edae
Resolve merge conflicts
provinzkraut May 25, 2024
b556c69
fix: Port CVE-2024-32982 path traversal fix to v3.0 (#3524)
provinzkraut May 25, 2024
7e4cf3c
feat!: Make route handlers functional decorators (#3436)
provinzkraut May 25, 2024
aa699a2
Fix merge artifact
provinzkraut May 26, 2024
d677c97
test: Remove test for warnings when subclassing route handler decorat…
provinzkraut May 26, 2024
8e599cc
fix merge artifacts
provinzkraut Jun 15, 2024
3e3441c
fix(typing): "Fix" typing for `Controller.as_router` (#3571)
provinzkraut Jun 15, 2024
3e56f3f
feat!: Remove deprecated `litestar.middleware.exceptions` module and …
provinzkraut Jun 15, 2024
95dccdb
feat(logging): always log exceptions by default (#3574)
jderrien Jun 16, 2024
123dbb6
chore: Port fix for #3593 to v3 (#3638)
provinzkraut Jul 21, 2024
7682720
resolve http handler conflicts
provinzkraut Aug 25, 2024
c2d23d8
formatting
provinzkraut Aug 25, 2024
d64ac31
feat: Update MessagPack media type (#3732)
provinzkraut Sep 14, 2024
04e9bec
Fix conflicts
provinzkraut Sep 15, 2024
124d58b
fix conflicts
provinzkraut Nov 20, 2024
7e6b127
conflict resolution
provinzkraut Nov 24, 2024
4e99656
fix conflict
provinzkraut Nov 29, 2024
085ab04
fix ws streaming
provinzkraut Dec 12, 2024
4be2304
docs: fix wording
JacobCoffee Jan 10, 2025
86ea3ab
docs: fix caption
JacobCoffee Jan 10, 2025
d47417c
fix dependency issue
provinzkraut Jan 11, 2025
4a1aecd
formatting
provinzkraut Jan 15, 2025
a3065e1
typing fixes
provinzkraut Jan 15, 2025
ca87f9d
feat!: static handler configuration (#3900)
provinzkraut Jan 16, 2025
f79562d
docs(v3): fix some doc issues (#4012)
provinzkraut Feb 19, 2025
7502702
feat(core)!: drop Python 3.8 support (#4010)
provinzkraut Feb 23, 2025
342cb34
some fixes after rebasing 'main'
provinzkraut Feb 25, 2025
7dbbbcc
feat(plugins)!: Remove `OpenAPISchemaPluginProtocol` (#4026)
provinzkraut Feb 25, 2025
dfe3beb
feat(plugins)!: Remove `CLIPluginProtocol` (#4027)
provinzkraut Feb 26, 2025
fc5592b
Linting fixes
provinzkraut Feb 26, 2025
5d42be9
feat(plugins): Remove deprecated `SerializationPluginProtocol` (#4028)
provinzkraut Feb 27, 2025
3e2fab2
feat: Remove starlette middleware compat (#4030)
provinzkraut Feb 27, 2025
508b1bc
lock update
provinzkraut Feb 28, 2025
b443e34
feat!: Remove deprecated `body` param from streaming and file respons…
provinzkraut Feb 28, 2025
89f9223
feat: v3 - Make `polyfactory` an optional dependency (#4062)
provinzkraut Mar 21, 2025
71412f9
docs(v3): fix build error (#4065)
provinzkraut Mar 22, 2025
84f2f93
feat: v3 - Move `litestar-htmx` to a package extra (#4063)
provinzkraut Mar 22, 2025
83f7890
feat(v3): Move `pyyaml` default dependency to `litestar[yaml]` extra …
provinzkraut Mar 22, 2025
6514b71
feat: v3 - new file system implementation (#4056)
provinzkraut Mar 22, 2025
377d3d3
refactor!: Remove deprecated `StaticFileConfig` (#3357)
provinzkraut Apr 10, 2024
f33220f
turn CompressionMiddleware into an ASGIMiddleware
euri10 Mar 4, 2025
4a7db5c
turn all middleware created "implicitly" by xxx_config app params int…
euri10 Mar 4, 2025
5f75006
from 33 to 29, ugly way to refactor build_route_middleware_stack but …
euri10 Mar 4, 2025
891f216
down to 11 failing tests fro 29, still ugly changes in build_route_mi…
euri10 Mar 4, 2025
8b024cc
17 failing, different, but mapping looks nicer
euri10 Mar 4, 2025
0ad7f76
13 now
euri10 Mar 4, 2025
147cb03
back to 11 with nicer mapping, still obscure how we manage order prop…
euri10 Mar 4, 2025
08ae802
down to 8, but test changed so ...
euri10 Mar 4, 2025
81279bf
up to 10 with LoggingMiddleware turned into a ASGIMiddleware
euri10 Mar 4, 2025
e127e16
wip, need to adapt LoggingMiddleware exclude stuff as we now us ASGIM…
euri10 Mar 4, 2025
b1f9a80
fix: csrf now might be correct in deferring exclude stuff to the ASGI…
euri10 Mar 4, 2025
c4daebe
applied same reasoning on LoggingMiddleware, down to 8 tests
euri10 Mar 4, 2025
26a3110
rewrite test involving compression and logging by removing the old co…
euri10 Mar 4, 2025
df08763
still 7, removed leftovers from mapping
euri10 Mar 4, 2025
f327a5f
one to go, but mapping is still weird
euri10 Mar 4, 2025
dff7320
simpler mapping, still one
euri10 Mar 4, 2025
db7077f
mypy sh*t
euri10 Mar 4, 2025
2b18084
Update litestar/_asgi/routing_trie/mapping.py
euri10 Mar 5, 2025
4cb5b73
test_response_caching fails and back to original
euri10 Mar 5, 2025
8a62ad7
fix test, could be better
euri10 Mar 5, 2025
8b555e5
cors middleware switch too
euri10 Mar 8, 2025
d4f0b55
rate middleware switch too, not handling keys atm
euri10 Mar 8, 2025
bb3e9c4
fix rate_limit middleware exclude capabilities
euri10 Mar 8, 2025
d0493d8
switch prometheus middleware too
euri10 Mar 8, 2025
106c8d5
switch opentelemetry, need to verify that carefully some tests fails …
euri10 Mar 8, 2025
4efb11e
session auth, 6 fails still, tests should be inspected
euri10 Mar 15, 2025
f59d8f7
?
euri10 Mar 15, 2025
2f45f44
1 left fixed opentelemetry
euri10 Mar 15, 2025
203333f
green?
euri10 Mar 15, 2025
7e409fe
slots ?
euri10 Mar 15, 2025
2301f6b
slots ?
euri10 Mar 15, 2025
191ae51
fix test
euri10 Mar 15, 2025
f5d96c6
fix tests
euri10 Mar 15, 2025
84882bd
fix tests
euri10 Mar 15, 2025
0ff1287
add to init for docs to build
euri10 Mar 15, 2025
e625038
docs painful
euri10 Mar 15, 2025
c88ebef
docs painful
euri10 Mar 15, 2025
fd3c6fb
docs painful
euri10 Mar 15, 2025
21f4350
docs painful
euri10 Mar 15, 2025
d22704e
slots back ?
euri10 Mar 15, 2025
b7ed926
slots superclass ?
euri10 Mar 15, 2025
b13249e
lint
euri10 Mar 15, 2025
c953c75
lint
euri10 Mar 15, 2025
566e4c3
remove slots, docs ok ?
euri10 Mar 15, 2025
eddaa05
docs
euri10 Mar 15, 2025
392eedf
Revert "refactor!: Remove deprecated `StaticFileConfig` (#3357)"
euri10 Mar 19, 2025
970cf67
superfluous self
euri10 Mar 19, 2025
033c162
reworked ASGIAuthenticationMiddleware to be a subclass of ASGIMiddleware
euri10 Mar 19, 2025
65b85d3
unreachable, scopes already defined in the base middleware
euri10 Mar 19, 2025
a6be5ea
unskip test that was skipped while debugging and left...
euri10 Mar 19, 2025
5a382b1
conserve tests on AbstractAuthenticationMiddleware
euri10 Mar 19, 2025
66bd90a
modified response caching test
euri10 Mar 19, 2025
3740b0e
adds deprecation on LoggingMiddlewareConfig.middleware
euri10 Mar 20, 2025
ba33eab
adds deprecation on SessionConfig middleware property
euri10 Mar 21, 2025
8e8b258
adds deprecation on PrometheusConfig middleware property
euri10 Mar 21, 2025
a0c2ec2
adds deprecation on the sessions stuff, one mypy error to fix but idk…
euri10 Mar 21, 2025
f694bc0
deprecation for SessionAuth.middleware and tests
euri10 Mar 21, 2025
97f3b59
deprecation for OpenTelemetryConfig.middleware and tests
euri10 Mar 22, 2025
b2f0715
fix type error
provinzkraut Mar 23, 2025
579b8aa
fix formatting
provinzkraut Mar 23, 2025
b2d57b4
include ASGIAuthenticationMiddleware in exports
provinzkraut Mar 23, 2025
7fa0a16
simplify ASGIAuthenticationMiddleware
provinzkraut Mar 23, 2025
216b9a5
some more mypy fixes
provinzkraut Mar 23, 2025
17224ee
moved and renamed authentication base
euri10 Mar 24, 2025
433cb5d
forgot csrf_config on some tests, interestingly it fails on 2
euri10 Mar 24, 2025
6f488a0
fix csrf_config tests
euri10 Mar 24, 2025
0c912e0
add deprecation messages and tests for csrf, compression and allowed …
euri10 Mar 24, 2025
536ca0d
docs
euri10 Mar 24, 2025
598ef95
hopefully coverage better
euri10 Mar 25, 2025
d156532
leftover allowed_hosts in tests
euri10 Mar 25, 2025
5e529ec
not covering deprecated csrf_config
euri10 Mar 25, 2025
ba734e1
remove nocover to see where the missing coverage is
euri10 Mar 31, 2025
e8aa9cd
add tests with previouos crsf_config
euri10 Mar 31, 2025
1bb8e7e
typo
euri10 Mar 31, 2025
9701eac
no need to discriminate on CORSMiddleware apparently
euri10 Mar 31, 2025
fe20230
top level import is wrong
euri10 Mar 31, 2025
f34a36e
no special casing for opentelemetry ?
euri10 Mar 31, 2025
8a62459
try except on import, is that the same as what _patch_opentelemetry_m…
euri10 Mar 31, 2025
6bc10fe
return asgi_handler if opentelemetry not installed
euri10 Mar 31, 2025
d89b05c
fix skip in compression test, tricky
euri10 Mar 31, 2025
991c206
try except on opentelemetry
euri10 Mar 31, 2025
78bb8c4
remove TODO
euri10 Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
push:
branches:
- main
- v1.51

env:
UV_LOCKED: 1
Expand All @@ -19,7 +18,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.9"

- name: Install Pre-Commit
run: python -m pip install pre-commit
Expand All @@ -41,8 +40,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.8"
allow-prereleases: true
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v5
Expand All @@ -60,8 +58,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.8"
allow-prereleases: true
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v5
Expand All @@ -79,8 +76,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.8"
allow-prereleases: false
python-version: "3.9"

- name: Install uv
uses: astral-sh/setup-uv@v5
Expand All @@ -96,10 +92,10 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
uses: ./.github/workflows/test.yml
with:
coverage: ${{ (matrix.python-version == '3.12' || matrix.python-version == '3.8') }}
coverage: ${{ (matrix.python-version == '3.12' || matrix.python-version == '3.9') }}
python-version: ${{ matrix.python-version }}

# add an aggregate step here to check if any of the steps of the matrix 'test' job
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ docs-clean: ## Dump the existing built docs

docs-serve: docs-clean ## Serve the docs locally
@echo "=> Serving documentation"
uv run --python 3.12 sphinx-autobuild docs docs/_build/ -j auto --watch litestar --watch docs --watch tests --watch CONTRIBUTING.rst --open-browser --port=0
uv run --isolated --python 3.12 sphinx-autobuild docs docs/_build/ -j auto --watch litestar --watch docs --watch tests --watch CONTRIBUTING.rst --open-browser --port=0

docs: docs-clean ## Dump the existing built docs and rebuild them
@echo "=> Building documentation"
@uv run --python 3.12 sphinx-build -M html docs docs/_build/ -E -a -j auto -W --keep-going
@uv run --isolated --python 3.12 sphinx-build -M html docs docs/_build/ -E -a -j auto -W --keep-going

.PHONY: docs-linkcheck
docs-linkcheck: ## Run the link check on the docs
@uv run --python 3.12 sphinx-build -b linkcheck ./docs ./docs/_build -D linkcheck_ignore='http://.*','https://.*'
@uv run --isolated --python 3.12 sphinx-build -b linkcheck ./docs ./docs/_build -D linkcheck_ignore='http://.*','https://.*'

.PHONY: docs-linkcheck-full
docs-linkcheck-full: ## Run the full link check on the docs
@uv run --python 3.12 sphinx-build -b linkcheck ./docs ./docs/_build -D linkcheck_anchors=0
@uv run --isolated --python 3.12 sphinx-build -b linkcheck ./docs ./docs/_build -D linkcheck_anchors=0
6 changes: 3 additions & 3 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
color: #f55353;
}

p {
font-size: 1.1em;
}
/*p {*/
/* font-size: 1.1em;*/
/*}*/

html[data-theme="dark"] .mermaid svg {
background-color: white;
Expand Down
16 changes: 16 additions & 0 deletions docs/_static/tables/framework-comparison.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature,Litestar,FastAPI,Starlette,Sanic,Quart
OpenAPI,:octicon:`check`,:octicon:`check`,-,-,-
Automatic API documentation,"Swagger, ReDoc, Stoplight Elements","Swagger, ReDoc",-,-,-
Data validation,:octicon:`check`,:octicon:`check`,-,-,-
Dependency Injection,:octicon:`check`,:octicon:`check`,-,:octicon:`check`,-
Class based routing,:octicon:`check`,Extension,:octicon:`check`,:octicon:`check`,:octicon:`check`
ORM integration,"SQLAlchemy, Tortoise, Piccolo",-,-,-,Extension
Templating,"Jinja, Mako",Jinja,Jinja,Jinja,Jinja
MessagePack,:octicon:`check`,-,-,-,-
CORS,:octicon:`check`,:octicon:`check`,:octicon:`check`,:octicon:`check`,Extension
CSRF,:octicon:`check`,-,-,-,-
Rate-limiting,:octicon:`check`,-,-,Extension,-
JWT,:octicon:`check`,-,-,-,-
Sessions,:octicon:`check`,Client-side,Client-side,-,Client-side
Authentication,JWT / Session based,-,-,-,-
Caching,:octicon:`check`,-,-,-,-
16 changes: 9 additions & 7 deletions docs/_static/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const addVersionWarning = (currentVersion, latestVersion) => {
const container = document.createElement("div");
container.id = "version-warning";

const warningText = document.createElement("span");
warningText.textContent = `You are viewing the documentation for ${
currentVersion === "dev" ||
parseInt(currentVersion) > parseInt(latestVersion)
? "a preview"
: "an outdated"
} version of Litestar.`;
const isPreviewVersion = (version) => {
const previewVersions = ['dev', 'develop', 'main', '3-dev'];
return previewVersions.includes(version) || parseInt(version) > parseInt(latestVersion);
};

const warningText = document.createElement("span");
warningText.textContent = `You are viewing the documentation for ${
isPreviewVersion(currentVersion) ? "a preview" : "an outdated"
} version of Litestar.`;
container.appendChild(warningText);

const latestLink = document.createElement("a");
Expand Down
Loading
Loading