#Code Reviews
1 messages Β· Page 3 of 1
Description
This refactors the FilterTypes to a more extensible design. You can now subclass StatementFilter to create your own custom repository filters.
Closes
Description
This PR adds a delete_where to the repository and services.
Closes
We need to add a wrapper around signature_types so that it doesn't raise an error when the type is already loaded.
I've swapped them back to signature_namespace for now so that the app starts
Description
Updates the search filter so that it supports searching mulitple columns.
Closes
Looks like this job (Codecov / codecov/project) was running for 2 days π
https://github.com/litestar-org/litestar/pull/3543/checks?check_run_id=25775130556
I've just rebased the branch so it's gone, hopefully it has been stopped on codecov side
codecov/patch & codecov/project seems blocked with the status Expected β Waiting for status to be reported π€
idk if I am dumb, can you give me a direct link?
thanks
https://github.com/litestar-org/litestar/actions/runs/9398688694/job/25884709239
Found an error in Upload coverage reports to codecov
error - 2024-06-06 09:49:05,930 -- Upload failed: {"detail":"Tokenless has reached GitHub rate limit. Please upload using a token: https://docs.codecov.com/docs/adding-the-codecov-token. Expected available in 299 seconds."}
fwiw I can see a token setup, but @signal linden is probably better equipped here
Yep, in ci.yml, it might be empty though
i think its not even using that file
its searching for ci.yaml and that was renamed like 4 months back to ci.yml
guessing here
this is true though
Fix a bug that caused the .websocket_connect methods on TestClient and AsyncTestClient to not respect the base_url set in the client's constructor, and instead would use the static ws://testerver URL as a base.
Also removes most of the test client code as it was unneeded and in the way of this fix :)
size: small, type/bug
Small PR that fixes a bug in the TestClient
Also removes most of the TestClient code π
I was just thinking "this removed a ton of wrapping code"
Yup
tbh, I never really bothered to check why this code is the way it is
It was just copied from Starlette
Turns out, there's no reason for it to be like that
In 3.0 we can also remove the whole BaseTestClient class, but that would be breaking so I've left it out for now
Fix #3534.
Don't call rich_click.patch if rich_click is installed, and instead use conditional imports to refer to the correct library. External libraries will still be able to make use of rich_click implicitly when it's installed by inheriting from LitestarGroup / LitestarExtensionGroup, which they will by default.
area/private-api, pr/internal, size: small, type/bug
Ignore a type error in Controller.as_router that's not really easily fixable otherwise
the last two dont error out in my IDE though, does it warn in yours?
litestar_group.add_command(sessions.sessions_group) # pyright: ignore
litestar_group.add_command(schema.schema_group) # pyright: ignore
Idk, I'm not using that weird IDE you're on π
But pyright CLI does complain about it
Iβm guessing heβs on some cool IDE like vscode π
Where it uses pylance
Which is pyright + extras
Add a new validate_strict parameter to PydanticInitPlugin, which will be passed as the value of the strict parameter of Pydantic's BaseModel.model_validate.
Closes #3572.
Can your PR be added to https://github.com/litestar-org/litestar/pull/3327 ? I feel @jagged plaza did some groundwork there
Description
- Add support for additional V1 model_dump and V2 dict parameters in PydanticPlugin
This is a continuation of https://github.com/litestar-org/litestar/pull/3171
The last unresolved conversation is here https://github.com/litestar-org/litestar/pull/3171#discussion_r1544483848
Closes #3147
Triage Required :hospital:, area/types, pr/external, pr/internal, size: small, type/feat
Oh yeah, good point
Hi π
I sent two PRs
- https://github.com/litestar-org/litestar/pull/3577 docs(logging): advise to use
log_exceptions="always" - https://github.com/litestar-org/litestar/pull/3578 feat(logging): add param
logging_moduletoLoggingConfig
When encountering a typing.NewType during OpenAPI schema generation, we currently treat it as an opaque type. This PR changes the behaviour such that typing.NewTypes are always unwrapped during schema generation.
Friendly bump <@&1084813023044173866> π
I'd like to do a patch release once this one's merged!
I actually looked at this from my phone over the weekend
I just re-reviewed and approved
Fix a bug in tools/sphinx_ext/missing_references.py that would cause the docs build to fail: https://github.com/litestar-org/litestar/actions/runs/9602344070/job/26528903758
Okay I think I found the bug
But I still don't know why it just started to be triggered randomly and I can't reproduce it locally
Okay. I am officially 100% confuse now
Now it's throwing this.. Which also doesn't reproduce locally?!
Man. I hate debugging stuff that I can't reproduce π
try -v to see verbose?
You mean in CI?
yes
Not sure that helps. I can see why it's failing. I just don't know why it's doing that only there
This is so weird. It's as if it's running against a different version?
Fix #3593 by ensuring that the functions used by the signature model itself do not interfere with the signature model created.
π
# h ttps://github.com/litestar-org/litestar/issues/3593 π
Anyone around for a quick approval? https://github.com/litestar-org/litestar-fullstack/pull/173
addressees some test issues with the new AA multi-config support
Description
Currently, the FlashPlugin expects the request parameter to be a type of Request. However, there's no reason it can't use the parent class ASGIConnection.
Doing this, allows for flash to be called in guards that expect an ASGIConnection instead of Request:
def requires_active_user(connection: ASGIConnection, _: BaseRouteHandler) -> None:
if connection.user.is_active:
return
msg = "Your user account is inactive."
flash(connection, msg category="error")
raise PermissionDeniedException(msg)
Closes
area/plugins, pr/internal, size: small, type/bug
Hola, could I get some eyes over https://github.com/litestar-org/litestar/pull/3561.
And may be
- some guidance on how to make changes to target a specific version.
- how can I tag people in PR? reviewers seem locked
I'm not sure this is a breaking change
just reviewing the notes on the PR
if it's not a breaking change, we should just target main
Re: the second one. If you use the litestar-org/maintainers as the reviewer, i think it'll auto assign one of us
I think it's time for a v3 feature flag in experimental features
I think I have done something wrong initially. Can't add that group as reviewer
Small PR here in need for review: https://github.com/litestar-org/litestar/pull/3638
<@&1084813023044173866>
Some bug fix: https://github.com/litestar-org/litestar/pull/3639
Fix #3627 by properly handling the creation of FormMultiDict where multiple values are given for a single key, to make Request.form() match the behaviour of receiving form data via the data kwarg.
Before
@post("/")
async def handler(request: Request) -> Any:
return (await request.form()).getall("foo")
with create_test_client(handler) as client:
print(client.post("/", data={"foo": ["1", "2"]}).json()) # [["1", "2"]]
After
@post("/")
async def handler(request: Request) -> Any:
return (await request.form()).getall("foo")
with create_test_client(handler) as client:
print(client.post("/", data={"foo": ["1", "2"]}).json()) # ["1", "2"]
area/connection, pr/internal, size: small, type/bug
for my understanding, how is the accompanying test already in the branch? both the test and the bug fix were in the original PR, but this only moves the fix (as mentioned, the tests somehow exist, how)
The PR exists because the code that was changed during the original fix has been deleted in v3, but the behaviour hasn't
So the behaviour still exists outside the deleted code in v3, just in a different place
manual error / expected change? was the 3.0 branch failing till now?
It was failing after I rebase it, yes
And that was expected, because of the other change that deleted the code where the fix took place
thanks
Another bugfix: https://github.com/litestar-org/litestar/pull/3641
Fix a bug where the validation of the return annotation for the head route handler was too strict and would not allow returning a Response[None].
Fixes #3640.
size: small, type/bug
Can we get some eyes on this? <@&1084813023044173866> π
Description
This PR:
- correct an issue with the default order by contructor method
- Adds support for
DTODatain the service layer. It will auto-convert these types to instances.
Closes
most of the changes are linting or ignores, so it's not really 18 files
Description
- Update precommit and linting dependencies
- Main code changes is formatting errors and error code changes
Closes
Closes #518
Description
- Currently, tuple with fixed length and randomised collection length are not handled correctly. These are treated as arbitary length tuples.
- Remove calls to collection extender so this type is explicitly passed to other places.
Closes
Update package dependencies :)
Some maintenance PR π
Fix inconsistent usage of msgspec's strict mode in the base DTO backend.
strict=False was being used when transferring from builtins, while strict=True was used transferring from raw data, causing an unwanted discrepancy in behaviour,
Small DTO PR
is this related? https://github.com/litestar-org/litestar/issues/3679
Description
I had some code working before upgrading litestar. The newer versions where the codegen backend is enabled by default broke some tests. Here I'm copying the code in the doc and making small adjustments to match my case, I'm assuming it will behave the same, didn't try it yet.
from __future__ import annotations
from dataclasses import dataclass, field
from uuid import UUID, uuid4
from litestar import Litestar, post
from litestar.dto import DataclassDTO, DTOConfig
@dataclass
class User:
name: str
email: str
age: int
id: UUID = field(default_factory=uuid4)
nested_1: NestedUserAttr
@dataclass
class NestedUserAttr:
key: int
nested_2: AnotherNestedUserAttr
@dataclass
class AnotherNestedUserAttr:
a_nested_key: int | None = None
class UserWriteDTO(DataclassDTO[User]):
"""Don't allow client to set the id."""
config = DTOConfig(exclude={"id"}, max_nested_depth=4)
@post("/users", dto=UserWriteDTO, return_dto=None, sync_to_thread=False)
def create_user(data: DTOData[User]) -> User:
"""Create an user."""
d = data.create_instance()
return d
app = Litestar(route_handlers=[create_user])
Here is the issue: sending a proper json encoded data to the endpoint would result in a_nested_key = None. I'm not yet sure is it because of a) the default value b) the depth of nesting.
The behaviour isn't the same with experimental_codegen_backend=False.
URL to code causing the issue
No response
MCVE
# Your MCVE code here
Steps to reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Screenshots
""
Logs
No response
Litestar Version
main branch
Platform
- β»οΈ Linux
- β»οΈ Mac
- β»οΈ Windows
- β»οΈ Other (Please specify in the description above)
[!NOTE]
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.Check out all issues funded or available for funding on our Polar.sh dashboard
- If you would like to see an issue prioritized, make a pledge towards it!
- We receive the pledge once the issue is completed & verified
- This, along with engagement in the community, helps us know which features are a priority to our users.
Bug :bug:
No, this is something else unfortunately π
@snow sapphire Can you check this one out as well?
https://github.com/litestar-org/litestar/pull/3684
This PR adresses the abandoned/obsolete python package: python-jose.
This package has not been maintained since 2021.
looking at several issues on that project there are a couple CVE's im not comfortable with.
I went looking for a "drop-in" replacement and found pyjwt. (project last updated 3 weeks ago).
This pull requests addresses that problem.
hope you agree with this.
kind regards.
Triage Required :hospital:, area/dependencies, pr/external, pr/internal, size: small, type/feat
I'm leaning towards accepting this over the other PR, as it's the cleaner implementation and would allow us to get a release with this shipped more quickly
It also doesn't seem to have the issues the other PR has, which I think is good, as PyJWT should be a drop-in replacement
yeah, i agree. let's accept this. I've not had a chance to review that JWK/ECC stuff
i'll merge this guy's PR
(or you can?)
Already on it π
Description
This PR addresses an issue with exception handling and span creation in the LiteStar application when using OpenTelemetry for observability. The problem occurred when exceptions were raised before the OpenTelemetry middleware was invoked, resulting in those exceptions not being captured under the current request span. This led to incomplete traces, making it difficult to monitor and debug the full lifecycle of requests.
Solution
To solve this, I reordered the middleware chain to ensure that the OpenTelemetry middleware wraps the entire request lifecycle, including exception handling. The new order is as follows:
Initial ExceptionHandler Middleware -> OpenTelemetry Middleware -> ASGIRouter -> Middleware n -> Exception Handler Middleware -> Route Handler
This ensures that spans are created as early as possible in the request lifecycle and that any exceptions, regardless of where they occur, are logged within the appropriate span. However, this will only occur if the OpenTelemetry middleware is included in the middleware stack.
Closes
#3663
Triage Required :hospital:, area/docs, area/plugins, pr/external, pr/internal, size: small, type/bug
I'm reviewing that next
There's still some issues with it we'll need to fix π
Let me see if I can make a PR into that PR with fixes π
I have one more PR for otel as well
let me see if you think it can be merged
@rich ledge maybe you would be better to answer this. Would you say this fix could just be merged into main? https://github.com/litestar-org/litestar/issues/3056
Description
When using OpenTelemetryConfig, during the application launch the logs get spammed with messages like:
An instrument with name http.server.duration, type Histogram, unit ms and description measures the duration of the inbound HTTP request has been created already.
An instrument with name http.server.response.size, type Histogram, unit By and description measures the size of HTTP response messages (compressed). has been created already.
An instrument with name http.server.request.size, type Histogram, unit By and description Measures the size of HTTP request messages (compressed). has been created already.
An instrument with name http.server.active_requests, type UpDownCounter, unit requests and description measures the number of concurrent HTTP requests that are currently in-flight has been created already.
...repeats...
This is because the underlying OpenTelemetryMiddleware (from opentelemetry-instrumentation-asgi) constructs metrics objects in init.
The metrics are added to the global registry, so re-doing the same will throw a warning as they already exist there.
A separate middleware instance is created per route. Is there way to avoid that? I don't see why it would be needed. When the middleware is specified at the application level (ie. Litestar(middleware=[...])) wouldn't a single instance do?
Is there a way around?
MCVE
This is sufficient, because `OpenAPIController` is initialized by default, and the middleware wraps also it:
import uvicorn
from litestar import Litestar
from litestar.contrib.opentelemetry import OpenTelemetryConfig
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
metric_provider = MeterProvider()
metrics.set_meter_provider(metric_provider)
otel = OpenTelemetryConfig()
app = Litestar(middleware=[otel.middleware])
uvicorn.run(app)
Steps to reproduce
1. `python app.py`
2. See error
Litestar Version
2.5.1
Platform
- β Linux
- β»οΈ Mac
- β»οΈ Windows
- β»οΈ Other (Please specify in the description above)
[!NOTE]
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.Check out all issues funded or available for funding on our Polar.sh dashboard
- If you would like t...
Upstream
Seems reasonable, yes
Okay, I got something working, but it's really hacky, and I'm not sure if it's actually any better. I'll sleep on this and get back tomorrow
This would be another one of those things solved by middleware priorities quite neatly though @snow sapphire
I think I'll try to get to that soon
Description
- In some of the Litestar main repo tests, there were failures (likely) due to some sort of race condition. This additional conditional ensures that there is a
disposefunction that can be called.
Closes
if anyone is around for a quick review
i'm trying to unpin AA in the main litestar repo and this is a failure that is hitting the tests
Alright @snow sapphire. I've manage to pull it off: https://github.com/litestar-org/litestar/pull/3689
Extend the work done in #3665. For description / discussion, check over there
area/docs, area/plugins, pr/internal, size: small
It's not the best solution, but I think it's the best compromise we can make to achieve all the things we want at the moment
looks awesome. I added a single comment about making a method private, but otherwise, it's great.
Yup, good point. I've changed it
Add a new config option to DTOConfig: forbid_unknown_fields.
When set to True, a validation error response will be returned if the source data contains fields not defined on the model.
area/docs, area/dto, area/private-api, pr/internal, size: small, type/feat
Set forbid_unkown_fields=True for PydanticDTOs where the Pydantic model has an extra="forbid" config.
- Add a new
get_config_for_model_typemethod toAbstractDTO, that allows to customise the base config defined on the DTO factory for a specific model type - Use
get_config_for_model_typeto setforbid_unkown_fields=Truefor Pydantic models that use the `extra="forbid" config
Depends on #3690. Don't merge before that one :)
do not merge, pr/internal
Some DTO enhancements, allowing to configure how unknown fields are handled, model specific dynamic configuration, and support for Pydantic's extra="forbidden" config flag
@supple ferry I think you're going to like this π
makes you wish github had gitlabs "depends on"
Yeah. Well.. It's not that big of a deal, but it would be nice
And @snow sapphire if you're around: https://github.com/litestar-org/litestar/pull/3689 needs an explicit approval because the other PR has been closed
area/docs, pr/internal, size: small, type/bug
yay!
@snow sapphire Started working in improving the JWT situation
More is coming
Keeping it backwards compatible for now, working with what we have, but I'm hoping to be able to introduce a more comprehensive JWT plugin that simplifies stuff before 3.0, so we can deprecate the old stuff
Shouldn't it be there for best practices?
I asked that as a question π not as a review item
but my understanding is, "sig types if its a guarded (TYPE_CHECKING) import"
the linked code sends a message that, this (sig types) is always needed
It's actually required π
This should fix the AA build issues as far as I can tell
Great! I'll check it out
@woven tundra are you good with me fixing this one quickly? https://github.com/litestar-org/litestar/issues/3681
It makes signature_types kinda unusable otherwise
It's currently difficult to use the simpler signature_types syntax in plugins due to the potential of there being an exception raised during startup.
We should consider removing this entire section to keep the behavior consistent between signature_namespace and signature_types.
[!NOTE]
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.Check out all issues funded or available for funding on our Polar.sh dashboard
- If you would like to see an issue prioritized, make a pledge towards it!
- We receive the pledge once the issue is completed & verified
- This, along with engagement in the community, helps us know which features are a priority to our users.
Bug :bug:, Good First Issue, Refactor, area/signature
I'm not sure I understand
What exactly is the error behaviour here?
Or rather, why is it different between the two methods, and why does that make signature_types unusable?
let's say that in advanced alchemy, I add UUID to the signature namespace (which we do). It's done as a helper to make it easier to use for the user
Oh
but, let's say the user goes to do this again
I do this in quite a few places, actually
to make it so the user doesn't ahve to remember to add something to the namespace
How about we don't remove the check, but make it so that it doesn't check for the presence only, but checks if the name is present, but the value is different?
And only raises in that case
But, even that is different behavior from signature_namespace, right?
it's an override when using signature_namespace
there's no way to get an exception when using it
I would expect there to be an error as well π
Wait, let me try something real quick
Hm. I can't seem to reproduce this behaviour? Can you share a snippet that raises the exception / shows the inconsistency?
Not that I don't believe you, I just want to understand what's going on, and I feel like I'm currently not π¬
sure. gimme a few
Ah. I think I understand now
Hm. I guess to make it behave consistently we'd have to remove the exception when doing add_to_signature_namespace, and perform the check in resolve_signature_namespace
Altough I'm not sure if that's a good behaviour
from typing import Dict
from litestar import Litestar, get
from litestar.config.app import AppConfig
from litestar.plugins import InitPluginProtocol
class MyService:
"""My Service"""
@get("/", sync_to_thread=False)
def route_handler(name: str) -> Dict[str, str]:
return {"hello": name}
class CLIPlugin(InitPluginProtocol):
def on_app_init(self, app_config: AppConfig) -> AppConfig:
app_config.signature_types.append(MyService)
return app_config
app = Litestar(plugins=[CLIPlugin()], signature_namespace={"MyService": MyService}, route_handlers=[route_handler])
The app will not start configured like this
We have something similar with providers, where we don't allow to override in a different layer for the same type but with a different value though
So this should 100% be supported, I'm with you there
I actually quite like the layering ability here
How do you feel about this?
We remove the check from add_to_signature_namespace, and instead check in resolve_signature_namespace that, if an override exists, it's the same value?
Why would we add this limitation though?
what is the reason for limiting the ability to just change the type totally on a controller if needed?
Same reason we have for the providers I guess? To prevent hard to track down bugs where something is implicitly overwritten
yeah, it could definitely cause bugs
maybe we could just warn if it's different?
instead of raising an exception
I'm imagining a scenario where e.g. a 3rd party plugin registers some common name, and a user app overwrites it
Sounds good
yeah, this is exactly what will likely happen
it's how I noticed the issue
π¬
File "/home/cody/Code/Litestar/litestar/litestar/router.py", line 192, in __init__
self.signature_namespace = add_types_to_signature_namespace(
File "/home/cody/Code/Litestar/litestar/litestar/utils/signature.py", line 266, in add_types_to_signature_namespace
raise ImproperlyConfiguredException(f"Type '{name}' is already defined in the signature namespace")
litestar.exceptions.http_exceptions.ImproperlyConfiguredException: 500: Type 'MyService' is already defined in the signature namespace
is the error you get
okay so: Warning in resolve_signature_namespace if you overwrite a name with a different type?
yeah, I think that's the best way to do it. It still lets you have the flexibility to override it
why? the type is defined in a runtime scope
Raise a warning when a middlewares exclude pattern greedily matches all paths.
@severe onyx π
thanks for this, now it feels like if you insist on excluding "/" then you won't be able to blame the docs or bad defaults or anything like that π€π»
That was the intention, yes π
Can't think of a good use case for adding a middleware and then completely disabling it, so I think the warning is reasonable, right?
yes definitely
Feel free to review an approve if you think it can go in π
π
back on track with my SessionAuth protecting myself like it should
@woven tundra re: the logger message. I feel like the warning is more than likely incorrect in these cases. I think having a logger message draw attention to it allows for proper debugging, but doesn't pollute the production logs
What's the plan for this one? https://github.com/litestar-org/litestar/pull/3323
Description
A plugin to enable usage of problem details as the response.
The way this works is by injecting an exception handler into the app level exception handlers to convert ProblemDetailsException into a response following the specification as per RFC 9457.
Users can pass in a mapping of exception types to callables that will convert those exception types into ProblemDetailsException for handling specific exceptions such as pydantic's ValidationError. That converted ProblemDetailsException will then be used to create the response. This should allow for flexibility when needed.
Closes
Closes #3199.
area/docs, area/plugins, pr/internal, size: medium, type/feat
Can we get it merged before we release today?
Will try to get it done
If not, let's delay the release?
No rush there really
Yeah, thereβs no major reason to release today.
Fix a bug introduced in #3692 that would cause a 500 status response to be returned when ValidationError was raised during the token payload conversion.
This was caused by the switch to msgspec for converting the token payload after decoding and verification, and the lack of error handling for this case.
Small fix for a regression introduced in a recent JWT PR
This can be reviewed now: https://github.com/litestar-org/litestar/pull/3695
Customise the automatic verification of JWTs.
- β
Config to verify
aud - β
Config to verify
iss - β
Config to verify
iat - β
Config to verify
nbf - β
Config for strict
audverification - β Config for required claims
- β Update ocumentation
JWT backend changes
- Add
accepted_audiencesfield - Add
accepted_issuersfield - Add
require_claimsfield - Add
verify_expiryfield - Add
verify_not_beforefield - Add
strict_audiencefield
JWT middleware changes
- Add token_audience` parameter
- Add
token_issuerparameter - Add
require_claimsparameter - Add
verify_expiryparameter - Add
verify_not_beforeparameter - Add
strict_audienceparameter
Token changes
- Add
audienceparameter toToken.decode - Add
issuerparameter toToken.decode - Add
require_claimsparameter toToken.decode - Add
verify_expparameter toToken.decode - Add
verify_nbfparameter toToken.decode - Add
strict_audienceparameter toToken.decode - Add
decode_payloadmethod
area/docs, pr/internal, size: small, type/feat
Correctly handle OpenAPI schema generation for type aliases generated with the type keyword.
Fixes #3714.
area/private-api, size: small, type/bug
Fix some improperly constructed test cases, where annotated types were constructed as Annotated[str, annotated_types.LowerCase] instead of annotated_types.LowerCase[str], which lead to code that handled this incorrect case.
I stumbled across this during another refactor, where I wrote a correct test case that passed without this special code, while the old case was failing.
Make the metadata extraction from type annotations more robust.
- Remove "duck typing" approach of extracting metadata from arbitrary types if they have attributes that match metadata attributes we're interested in
- Remove coupling to 3rd party libraries in core code (specifically Pydantic)
- Fully move metadata extraction responsibilities to plugins
area/dependencies, area/dto, area/plugins, area/private-api, pr/internal, size: medium
<@&1084813023044173866> If you've got some time, please take a look at this one. It's a larger refactor of our metadata extraction / parsing logic, that cleans up some less pretty parts of our code π
Accept string for the media_type parameter of ResponseSpec, making it behave the same way as Response.media_type does.
Closes #3728.
for my understanding, why is OpenAPIMediaType (the enum not the dataclass) added in Response.media_type but not here?
It shouldn't be in Response.media_type in the first place, so I didn't add it to the ResponseSpec. That way we don't have to deprecate it there at some point
Small fix for a test: https://github.com/litestar-org/litestar/pull/3731
Remove some laziness in testing Pydantic private fields, which is currently causing some failing tests, due to a change in Pydantic's internals.
pr/internal, size: small
Another small PR: https://github.com/litestar-org/litestar/pull/3732
Update the MessagePack media type to the official application/vnd.msgpack.
Fixes #3727.
Follow up #3731, at it seems to still be breaking in some cases.
These test cases were initially added to ensure we never touch the fields, but Pydantic changed some internals which make it so they touch them, causing our invalid annotation to result in an exception. This means we can't use this as a check anymore, but also don't need to.
Fix #3734.
Ensure all data extractors are properly awaited by removing the delayed await
area/kwargs, area/private-api, pr/internal, size: small, type/bug
π
This lovely PR is also still looking for reviewers π
Should litestar/_kwargs/types.py be added here https://github.com/litestar-org/litestar/blob/053ef142c6a4eb728c496ea8fdcef61c507c59d5/pyproject.toml#L204 ?
pyproject.toml line 204
omit = ["*/tests/*", "*/litestar/plugins/sqlalchemy.py"]
i dont think the pragma is at a file level
not a review point, but why is that file using future imports?
idk. ruff did it? π
ahh ok, I asked because there was (is?) an issue in AA where some types when imported dont work, since they are not available in runtime
Okay, then let's remove that
i dont want to break your PR :p
I already did π€¦ββοΈ
uhm, do we not use coverage py?
since we had an entry I assumed it was for that, but codecov has its own ignore list?
We do?
it does
π¬
But we don't really define stuff in there
Description
When httponly is True, it's impossible to set the header. This fix allows this configruation to correctly validate.
Closes
area/middleware, size: small, type/bug
Allow customizing the schema key used for a component in the OpenAPI schema. The motivation is to give the user an escape hatch when we inevitably generate some less than pretty looking names for deeply nested types for the sake of uniqueness.
These supplied key are enforced to be unique, and it is checked that they won't be reused across different types.
- Add a new
schema_component_keytoKwargDefinitionand theBodyandParameterfunctions - Add a friendly error message when keys are not unique / reused across different types
area/openapi, area/params, area/private-api, pr/internal, size: small, type/feat
is this an alternate interface for https://docs.litestar.dev/latest/usage/openapi/schema_generation.html#customizing-operation-class ?
Not really. The Operation doesn't allow you to customise the schema component key
Add an informative error message to help users avoid the common mistake of attempting to use the body parameter to receive validated / structured data, by annotating it with a type such as list[str], instead of bytes. In such a case, the user will now be instructed to use the data parameter instead.
Fix a bug where we would not include the struct fields implicitly generated by msgspec for its tagged union support.
The change consists of an addition to the OpenAPI plugin where the tagged field will be added as a const to the schema.
Fix #3659.
Reverts litestar-org/litestar#3739
This is an incorrect usage of the protocol. The correct approach is to embed the csrf token within the form or template itself, so that it can be attached to the header.
It would, but it's bad for performance, since it's inside a function that gets called very frequently
true, its zero cost if no exception is raised, but not the other way (I think)
It's about 10x slower if the lib is installed, and 1000x if the lib is not installed
Even though the overhead of a single call is small in absolute numbers, since we call this for every type that has metadata attached to it, it does make a real difference
why is it slower if its installed, arent imports cached?
You're still doing a lookup and going through the hoops of the import mechanism. Also, on <3.11, exception handlers have a non trivial overhead attached to them, even in case where the exception isn't raised
Description
This PR deprecates the litestar.contrib.sqlalchemy module in favor of litestar.plugins.sqlalchemy
Closes
area/dependencies, pr/internal, size: medium, type/feat
I think you have to change the version from 2.11 to to 2.12
https://github.com/litestar-org/polyfactory/pull/588 PR for prepping for polyfactory release. I don't think I have relevant permissions to do the full release flow
https://github.com/litestar-org/polyfactory/actions/runs/10979945710 needs approval for the above release to go out
@plucky vale Anyone know what these failures are from? https://github.com/litestar-org/litestar/actions/runs/10983032652/job/30491964585
It looks like it's related to trio test using redis?
maybe it has something to do with the anyio upgrade from 4.4 to 4.5?
I'd remove the lockfile update from this PR
Probably unintentional?
probably. I think i was trying to get my osx env working again
let me remove that change
yeah, i guess that was it
it solves it locally
We also have some differences in what our version of mypy report vs the latest version
you asked a bot what to do π
LOL. Thought I got maintainers
Friendly ping on this PR if anyone has time: https://github.com/litestar-org/litestar/pull/3755
Description
This PR deprecates the litestar.contrib.sqlalchemy module in favor of litestar.plugins.sqlalchemy
Closes
area/dependencies, area/docs, area/plugins, pr/internal, size: large, type/feat
Description
This plugin migrates the HTMX integration to litestar.plugins.htmx.
This logic has been moved to it's own repository named litestar-htmx
This is in preparation for 3.0 release where contrib will be deprecated.
Closes
area/datastructures, area/dependencies, area/plugins, pr/internal, size: medium, type/feat
I'm trying to build docs and i'm getting this from our fix_missing_references script. Anyone have any pointers?
building [mo]: all of 0 po files
writing output...
building [html]: all source files
updating environment: [new config] 46 added, 0 changed, 0 removed
reading sources... [100%] usage/placeholder
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
The name of the builder is: htmlution-guide .. reference/alembic/commands
Extension error (tools.sphinx_ext.missing_references):
Handler <function on_warn_missing_reference at 0x7ffb93e0ec00> for event 'warn-missing-reference' threw an exception (exception: module, class, method, function, traceback, frame, or code object was expected, got TypeVar)
make: *** [Makefile:139: docs] Error 2
Description
anyio is installed with nearly all web frameworks, so I'd prefer to not add it as a required dependency.
However, when running standalone, you would receive this exception for fixtures
Closes
Description
- Constraints should be hashable to handle downstream usage
- Create
Frozendictto hold constraints - Alternative approachs
- Update to vendor in
annotated-types-esque classes and change internal to support this and use factories per type to generate. This would be backwards breaking and hard to generate for a user. - Pass constraints separately or another way. Not sure if can do this and pass these to
FieldMetawhilst not breaking exposed interface
- Update to vendor in
Closes
- Fixes #601
Fixes https://github.com/litestar-org/litestar/issues/3625
RateLimitMiddleware duplicate all RateLimit-* headers when handler cache is enabled because it's adding new rate limit headers to the new ones, instead of just updating their values.
Response header before
β― curl -i http://localhost:8000/
HTTP/1.1 200 OK
date: Tue, 12 Nov 2024 06:50:18 GMT
server: uvicorn
content-type: text/plain; charset=utf-8
content-length: 2
ratelimit-policy: 10; w=60
ratelimit-limit: 10
ratelimit-remaining: -8
ratelimit-reset: -54
ratelimit-policy: 10; w=60
ratelimit-limit: 10
ratelimit-remaining: 0
ratelimit-reset: -49
Response headers after
β― curl -i http://localhost:8000/
HTTP/1.1 200 OK
date: Tue, 12 Nov 2024 06:50:18 GMT
server: uvicorn
content-type: text/plain; charset=utf-8
content-length: 2
ratelimit-policy: 10; w=60
ratelimit-limit: 10
ratelimit-remaining: 0
ratelimit-reset: -49
Triage Required :hospital:, area/middleware, pr/external, size: small
https://github.com/litestar-org/litestar/pull/3852
friendly bump on this
Description
This PR continues preparation for 3.0 by deprecating litestar.contrib.pydantic in favor of litestar.plugins.pydantic
Closes
area/dependencies, area/docs, area/private-api, pr/internal, size: large, type/feat
Finalizing a few edits now, but it should be ready to anyone to start taking a look
Description
feat: deprecate litestar.contrib.prometheus in favor of the new location of litestar.plugins.prometheus
Closes
area/docs, size: medium, type/feat
Description
This adds a future flag to experimental_features to enable new features that may be otherwise considered breaking.
Closes
pr/internal, size: small, type/feat
I've got a draft PR that enables 3.13 support using a one-off build of msgspec. There's still a few things we need to work through though if anyone wants to take a look:
https://github.com/litestar-org/litestar/pull/3850
https://github.com/litestar-org/litestar/pull/3850/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R42
"msgspec-python313-pre ; python_version >= \"3.9\"", is there a reason this is not "msgspec-python313-pre ; python_version >= \"3.13\"",
Yeah. There are other fixes that can be used in the update
for my understanding, what advantage do we get with a catch call "future" flag vs specific flags (breaking or non breaking)
I understand experimental can be features that go in without a major version
"future" can be stuff that wont
We can turn on 3.0 style changes globally. Think sql alchemy
got it, I just felt having experimental and future in the same place might lead to confusion
It shouldn't lead to any confusion at the moment. Future is for behavior that will be default in 3.0 but is not currently. It could include experimental features potentially as well.
experimental = non breaking (once stable can be in v2)
future = anything goes (once stable will be in v3)
yeah, i think that's a cleaner explanation
https://github.com/litestar-org/litestar/pull/3864/files#diff-fcbbe89d576bb1122eba8970740c18a3f3eb876b634ed6b62789d7561cae8372R457
why is the test called test_use_future_feature_flag_warns warns? I don't see any warning assertions
it's because i changed the logic but forgot to change the test name
Bump on https://github.com/litestar-org/polyfactory/pull/602 if anyone has time to review π
Description
- Constraints should be hashable to handle downstream usage
- Create
Frozendictto hold constraints - Alternative approachs
- Update to vendor in
annotated-types-esque classes and change internal to support this and use factories per type to generate. This would be backwards breaking and hard to generate for a user. - Pass constraints separately or another way. Not sure if can do this and pass these to
FieldMetawhilst not breaking exposed interface
- Update to vendor in
Closes
- Fixes #601
WIP for a new multipart parser: https://github.com/litestar-org/litestar/pull/3872
Add a streaming multipart parser via the multipart lib.
This gives us:
- Ability to stream large / larger-than-memory file uploads
- Better / more correct edge case handling
- Still good performance
area/connection, area/dependencies, area/kwargs, area/multipart, area/private-api, pr/internal, size: small, type/feat
@little valley fyi π
Nah, couldn't wait
- Bump ruff to 0.8.0
- Apply resulting fixes (mostly sorting
__all__s)
Small fix for new pydantic version: https://github.com/litestar-org/litestar/pull/3874
Pydantic >=2.10 breaks because of the way we reference some types in our OpenAPI type map. This can be fixed by including the proper references. This fix is backwards compatible :)
Replace pdm with uv.
area/ci, area/dependencies, area/docs, pr/internal, size: small
- PDM dropped support for 3.8](https://github.com/pdm-project/pdm/pull/3298) in their latest release
- Pinning 3.8 actions to the latest PDM version that supports it (2.20.1)
area/ci, pr/internal, size: small, type/bug
This will anyways be short lived, since we are moving to UV (draft PR #3875)
tests for https://github.com/litestar-org/litestar/pull/3525 can be run if the above is merged π
This is good to go IMO
I ruined it π
All good, just a quick rebase π
for my understanding, why didnt you move away from setup-python and download python from uv?
And probably the note I left in the channel yesterday as well.
It's (mostly) fine for local dev (although I don't use it), but for testing, we definitely want to use the official stuff
Where?
The default pre-built python that it (uv), hatch, and pdm installs is built with specific optimizations that aren't available on older CPU models. This means that some x86 machines will raise an error when executing. I actually hit this on a standard cloud shape last week with 2 Intel Xeon CPUs.
thats hatch, boo
It's not hatch though
they all download from the same source?
It's the same indygreg builds linked above
I think this can be merged?
nit: can we add a # pragma: nocover to make this codecov warning go away?
just add a nocover on that one line
The issue seems to be legit though?
in that case, we should add some coverage?
Yup
i was just saying that for the sake of this change. It's like 7 months old
but, coverage would be better
Yeah, the turnaround time isn't great π
not dismissing the issue, but has anyone used int enums?
fair, though I havent really been using enums lately, moved to Literal
would you consider doing conditional version pinning? https://github.com/litestar-org/litestar/pull/3878
or move to uv? (maybe more effort to do it now)
Updated! I'd favour migrating to uv separately as this small (and admittedly short-lived) fix to fix state on main
thanks, you (and guacs) can decide if you want to migrate to uv, its just litestar and advanced-alchemy have moved
Description
There have been a number of complaints about circular dependencies with this package. This change make litestar only required for tests.
Litestar will be updated to have a minimum pin of 0.4.0 here.
Closes
Summary by Sourcery
Remove 'litestar' from the project dependencies, addressing circular dependency issues, and update the project version to '0.4.0'. Update the 'ruff-pre-commit' hook version in the pre-commit configuration.
Build:
- Remove 'litestar' from the project dependencies in 'pyproject.toml', making it only required for tests.
Chores:
- Update the version of the 'ruff-pre-commit' hook from 'v0.7.0' to 'v0.8.1' in the pre-commit configuration.
https://github.com/litestar-org/litestar/pull/3884
sorry for so many changes. Ruff updated when i changed the htmx pin. It's renamed a few rules deprecated rules.
I went ahead and merged this. All tests passed and we needed to get a release out with a correct LICENSE file.
Description
- Update lock file to target Pydantic 2.10
- Support
default_factorywith single arg - Fix support for URL. These are now distinct types so need specifying in provider map
- Fix typing issues
Closes
- Closes #610
Description
This PR allows you to resuse the existing DeclarativeBase subclasses with different metadata objects.
This enables better support for multi-database configurations with models targets for each specific database.
It:
- Creates a singleton registry object that tracks Metadata's for models
- uses the
__bind_key__syntax commonly found inflask-slqlalchemyand other SQLAlchemy libraries
As part of this, there are a few (minor) breaking changes:
- The custom subclass for
AlembicCommandshas been removed. It is no longer required and will make things easier for fastapi integration - The Alembic configuration now longer has a
template_metadatakey
Closes
area/alembic, area/base, area/config, area/dependencies, area/docs, area/example-apps, area/litestar, pr/internal, size: medium, type/feat
Description
This adds a configuration option to automatically enable an excpetion handler for Repository errors.
This will update the exception handler if you do not have one already configured for the RepositoryException class
Closes
area/ci, area/dependencies, area/litestar, pr/internal, size: medium, size: small, type/feat
Description
The Litestar DTO has been enhanced with:
- The SQLAlchemyDTOConfig's
exclude,include, andrename_fieldsfields will now accept string orInstrumentedAttributes - DTO supports
WriteOnlyMappedandDynamicMapped
Closes
area/litestar, pr/internal, size: small, type/feat
Alright. This one is ready for review: https://github.com/litestar-org/litestar/pull/3894
Add a new websocket_stream route handler that supports streaming data to a WebSocket via an async generator.
@websocket_stream("/")
async def handler() -> AsyncGenerator[str, None]:
yield str(time.time())
await asyncio.sleep(.1)
This is roughly equivalent to (with some edge case handling omitted):
@websocket("/")
async def handler(socket: WebSocket) -> None:
await socket.accept()
try:
async with anyio.task_group() as tg:
# 'receive' in the background to catch client disconnects
tg.start_soon(socket.receive)
while True:
socket.send_text(str(time.time()))
await asyncio.sleep(.1)
finally:
await socket.close()
area/docs, area/handlers, area/private-api, pr/internal, size: medium, type/feat
Change the implementation of responses.File to be able to handle most fsspec implementation's mtime equivalent.
This is necessary because fsspec implementations do not have a standardised way to retrieve an mtime equivalent; Some report an mtime, while some may use a different key (e.g. Last-Modified) and others do not report this value at all.
Fixes #3899
area/response, size: small, type/bug
missing coverage?
i saw it on the PR idk if its on the report or not, its for the line where you raise an exception
Got it
New PR design
I'm down to 3 remaining errors for Python 3.13 support. https://github.com/litestar-org/litestar/pull/3850
It appears to be related to changes in the standard library QueueListener if anyone has ideas.
Description
This PR implements support for Python 3.13.
Note This release uses a pre-release version of msgspec built by the Litestar team. This is a drop in replacement until the official pre-built wheels are available.
Note Python 3.8 continues to be supported with the existing msgspec implementation, while all other versions perfer the pre-built litestar wheels.
Closes
area/ci, area/dependencies, area/docs, area/logging, pr/internal, size: medium, type/feat
Where does it say this?
run this to reproduce: uv run --reinstall --python 3.13 pytest docs/examples tests -n auto
thanks, will check
Remove the inclusion of the query-only properties allowEmptyValue and allowReserved in path, cookie, header parameter and response header schemas.
Fixes #3908
area/datastructures, pr/internal, size: small, type/bug
Description
- Fixes issue described https://github.com/litestar-org/polyfactory/discussions/576
- Tested with script
(polyfactory) β polyfactory git:(perf-refactor-pydantic-imports) β cat test.sh
#!/usr/bin/env sh
.venv-fast/bin/python -m pip install -e .
.venv-fast/bin/python -m pip install "pydantic<2.5.0"
.venv-slow/bin/python -m pip install -e .
.venv-slow/bin/python -m pip install "pydantic==2.5.0"
.venv-slow/bin/python t.py
.venv-fast/bin/python t.py
with before and after this change
0.22203758300747722
0.1394521670008544
---
0.1482207500084769
0.13731049999478273
- Explanation here is
pydanticnow performs dynamic imports in some cases so affects performance when using attrs from the module. By importing directly for common attributes we avoid this cost.
Closes
β¦3.13, etc.)
Description
Picologging does not currently support Python 3.13. This change proactively adds updates to ensure tests work when picologging is not supported in the python environment.
Closes
area/logging, pr/internal, size: small, type/bug
Description
This PR updates the SQLAlchemy examples and documentation to align with current AA best practices.
Closes
area/dependencies, area/docs, pr/internal, size: small, type/bug
Description
This PR updates the channels backend to use the native psycopg SQL API.
Additionally, it preemptively fixes some new warnings from upcoming pyright and ruff changes
Closes
pr/internal, size: small, type/bug
Description
This PR temporarily ignores failures related to trio and specific anyio versions on Windows platforms.
Here is an example of the related error
Closes
size: small, type/bug
Description
running make install now will result in a broken environment because it tries to install 3.13.
This can be removed one the 3.13 PR is merged.
Closes
pr/internal, size: small
Description
- Update pipeline and files to test and use 3.13 for coverage
- Omitted removing 3.8 for now
Closes
is there a reason you did not change it in pre-commit? https://github.com/litestar-org/polyfactory/blob/infra-support-python-3.13/.pre-commit-config.yaml#L2
I left the same comment in the approval, feel free to act on it as you feel π
.pre-commit-config.yaml line 2
python: "3.12"
Description
- This action is deprecated https://github.com/sonarsource/sonarcloud-github-action/tree/master/
Closes
Good news on the Python 3.13 front.
Description
This PR implements support for Python 3.13.
Note
- This release uses a pre-release version of
msgspecbuilt by the Litestar team. This is a drop in replacement until the official pre-built wheels are available. - Python 3.8 continues to be supported with the existing
msgspecimplementation, while all other versions prefer the pre-built litestar wheels. - There are no Python 3.13 prebuilt wheels for
psycopg[binary]. If you rely on this for development, you'll need to have the postgres development libraries installed picologgingdoes not currently support Python 3.13. These tests are skipped automatically.
Closes
area/ci, area/dependencies, pr/internal, size: small, type/feat
@woven tundra Looks like we are good to go on the asyncio PR. I'm about opdate the dep and then i think we should be good to merge 3.13 support
merged
Perfect
I don't have time to prepare the release rn, I think I can get to it on the weekend
But I wouldn't mind if someone else picks itup as well π
https://github.com/litestar-org/litestar/actions/runs/12676121648/job/35328636028
looks like the compat tests are running the linux commands.
There are no Python 3.13 prebuilt wheels for psycopg[binary]. If you rely on this for development, you'll need to have the postgres development libraries installed
https://github.com/litestar-org/litestar/pull/3850
I just need to ignore it
i've got a fix incoming
wont this just fail at later point on windows though?
when it tries to install psycopg
.github/workflows/ci.yml line 148
python-version: "3.12"
that should be changed
if not, then it would just run the tests on 3.12, for which wheels are indeed present
unless I am misunderstanding this
but isnt the expectation to run the tests on the latest python version for these non ubuntu hosts?
double check the test results. I think it shows what you want. We only want the compat test to run on 3.12 right now
I can't trigger it until this is merged though: https://github.com/litestar-org/litestar/pull/3931
approved, will check the runner
once more quick approval. This just installs the psotgres client libraries in osx and windows and then runs the tests for the compat against 3.13
I just merged this one. I'm going to have a go at preparing the release
@woven tundra the newer version of pytest asyncio wants us to set the default loop runtime. I think it's causing some flaky test failure right now, but. the fix is to just re-run, i think.
Set the default loop scope for pytest-asyncio
Closes #3936
area/dependencies, area/docs, pr/internal, size: small, type/bug
Update the copyright and license files to reference 2025
area/docs, pr/internal, size: small
Experimental branch. Very much work in progress.
Basic idea is this: Instead of mutating handlers in place, treat them as static configuration objects. Once the handler tree has been collected, reduce all the layers into a single handler by recursively merging them.
Why? The idea is that this design is much less error prone and easier to follow (e.g. a lot of things currently need to happen in a specific order, otherwise they'll break). It also supports a pattern we're using in a few places now (websocket listeners + stream), where you essentially want to replace the handler with a new one. Another benefit is that this can get rid of all the deep copying we're currently doing :)
Goals
- β "Merge" handlers instead of setting ownership layers
- β
Move all routing functionality from
RoutertoLitestarinstance - β
Remove (deprecate) unnecessary
resolve_methods - β Remove ownership layer API completely
- β
Remove
deepcopying of route handlers during registration - β»οΈ
Extract common handler config into config objects (dataclasses), so they're easier to merge / manipulate - β»οΈ
Make route handlers purely static by removing all in-place mutation
I've decided to strike the last two goals, as it would make a migration path forward needlessly complex. With the removal of the now deprecated functionality in 4.0, this will be a lot easier to achieve, and we're still in a much better place with this than before.
Breaking π¨, area/asgi, area/connection, area/controller, area/dependencies, area/di, area/docs, area/dto, area/handlers, area/kwargs, area/layers, area/openapi, area/private-api, area/router, area/testing, area/types, pr/internal, size: large, type/feat
<@&1084813023044173866> I've decided to go ahead with this one despite not achieving all the goals I've set. In the interest of not introducing too many breaking changes in fundamental behaviour, I think it's best if we wait with these until 4.0
hey @snow sapphire
can you check this? https://github.com/litestar-org/litestar/pull/3948
Description
litestar.contrib.attrs was moved to litestar.plugins.attrswas in https://github.com/litestar-org/litestar/pull/3862 but still being used in code and gives warnings
Closes
Triage Required :hospital:, pr/external, size: small
you're 20min late π https://github.com/litestar-org/litestar/pull/3947
Oops π
Description
abc.ABCcannot be instantiated so does not make sense for these to be considered factory types
Closes
Can we close this issue?
Summary
The channels flowcharts in dark mode look like this, making them super hard to read:
Documentation :books:
yeah, can you close?
I don't have permission
seems you need to change pyproject, its using 2.18.1
Ah sorry, yes. I've created https://github.com/litestar-org/polyfactory/pull/637 to amend. What's the best way to amend: roll forward or delete this release?
it never reached pypi, you can just recreate it
it shows up on discord, but thats about it
By recreate, do you mean delete existing release? I think this is required to remove existing git tag
yes, I am not sure if there are elegant ways, but I made a similar mistake and I just removed and created the same tag
if you do know of a different way, then do go ahead with that π I don't think you have to skip a version just for this
Great. Thanks for confirming. See off now https://github.com/litestar-org/polyfactory/actions/runs/13027347790/job/36338859351 π
i deleted the old announcement post here
@peak monolith https://github.com/litestar-org/litestar/blob/main/tools/prepare_release.py
you can try adopting that, that does the version bump and also generates a draft release
PS: you can feel better knowing I made a mistake even with this π
While fixing #3912 I noticed we only unwrap these partially. However, I am not sure if unwrapping them at all is proper, because of a particular edge case: They can be self-referential. This is used e.g. in pydantic.JsonType.
SelfReferential = TypeAliasType("Outer", Union[Annotated[int, "meta"], list["Outer"]])
This type can be understood by e.g. mypy, but is hard to parse for our typing system since we want to extract the metadata from the Annotated, but need to keep the outer TypeAliasType, so the self-referencing works in later stages (e.g. Pydantic).
I'm not entirely sure how we should best handle this, as our typing system has fundamentally different requirements than that of the 3rd party tools we rely on.
Divergences in how self-referential types are treated by these tools further complicates things.
For example, this is fine in Pydantic:
import pydantic
type Foo = int | list[Foo]
class SomeModel(pydantic.BaseModel):
a: Foo
SomeModel.model_validate_json('{"a": 1}')
But msgspec raises a RecursionError:
import msgspec
type Foo = int | list[Foo]
class SomeStruct(msgspec.Struct):
a: Foo
msgspec.json.decode('{"a": 1}', type=SomeStruct)
Not really sure yet how to proceed, I'll have to think about this a bit. I'd be happy about some input though @litestar-org/members
<@&1084813023044173866> if you've got some time to spare, I'd appreciate your input on the above PR. I've hit a bit of a wall with how Litestar should handle cases described above, so I'd be happy about some external input π
is the 3.8 failure flakiness?
No, just me not writing the test properly π
I've created a proposal for a new middleware pattern:
Add a new base middleware class to facilitate easier configuration and middleware dispatching.
The new ASGIMiddleware features the same functionality as the AbstractMiddleware, but makes it easier to pass configuration directly to middleware classes without a separate configuration object, allowing to get rid of the DefineMiddleware pattern entirely.
area/docs, area/middleware, area/private-api, pr/internal, size: small, type/feat
Drop support for Python 3.8.
How to review this?
This is a rather big PR, however, almost all changes have been made automatically by ruff. I've put those into separate commits, so I sugges...
Fixes for v3 docs: https://github.com/litestar-org/litestar/pull/4012
Fix some issues with the v3 docs and re-add a commit from #3324 that got lost somewhere :eyes:
area/docs, pr/internal, size: small, type/docs
Description
- Update prettier precommit by vendoring in now archived hook and specifying prettier version here.
- This allows specifying version to one that will be supported by runners. This does have the downside of not being updatable via
pre-commit autoupdate - Also in this PR, update other pre-commits and linting fixes required from updates
Closes
Small change to our CI that allows us to have a dynamic test matrix: https://github.com/litestar-org/litestar/pull/4022
Add an 'aggregate' step that fails if one of the matrix jobs from the test job fail, so we can target this aggregate job as "required check" instead of the individual matrix jobs.
This allows us to e.g. have a 3.8 matrix job on one branch but not on the other, while still making the run fail if any of the matrix jobs fails.
area/ci, pr/internal, size: small
- Add
SerializationPluginto replaceSerializationPluginProcotol - Add
InitPluginto replaceInitPluginProtocol
These are the only ones for which the protocols don't have a non-protocol equivalent.
Following the same approach as for other plugins, they inherit their respective protocol for now, to keep type / isinstance checks compatible.
area/channels, area/docs, area/openapi, area/plugins, area/private-api, pr/internal, size: medium, type/feat
Remove the deprecated OpenAPISchemaPluginProtocol for v3.0.
Breaking π¨, area/docs, area/openapi, area/plugins, area/private-api, size: small, type/feat
No description provided.
@woven tundra does this need a pin to Litestar 3?
Nope!
ohh. we just removed the protocol in 3.0
We should have done this switch ages ago. CLIPlugin has been around forver π
Yeah. We kinda just forgot to upgrade in a few places π€·
I think i need to go through all of our plugins and do this
Use SerializationPlugin instead of SerializationPluginProtocol
Remove the deprecated SerializationPluginProtocol for v3.0.
We need to do a release of 2.15 first, so we can upgrade AA accordingly to the new SerializationPlugin.
area/dependencies, area/docs, area/plugins, area/private-api, pr/internal, size: medium, size: small, type/feat
Remove support for the starlette middleware protocol.
This was added as a backwards compatibility fix when we transition away from the starlette dependency.
area/docs, area/private-api, area/types, pr/internal, size: small, type/feat
Sorry for the spam, I've got a bit of time on my hands and want to move v3 forwards π
spam away
Smol PR to add a deprecation warning:
https://github.com/litestar-org/litestar/pull/4033
Litestar allows passing in a body parameter for a streaming response, but this parameter is ignored.
I'm adding a deprecation warning for this parameter, so we can remove it in v3.
area/response, size: small, type/bug
And removing it in v3: https://github.com/litestar-org/litestar/pull/4034
Remove the deprecated body param of ASGIStreamingResponse and ASGIFileResopnse. The parameter previous did nothing.
Breaking π¨, area/docs, area/response, size: small, type/feat
Hotfix for an issue introduced in the latest release: https://github.com/litestar-org/litestar/pull/4036
Fix a bug introduced in #3996 that would incorrectly issue a deprecation warning if a user subclassed a Litestar built-in middleware which itself subclasses AbstractMiddleware.
Fix consists of checking the mro to ensure we're only warning if the subclass has AbstractMiddleware as a direct ancestor within the user code.
Fix #4035
area/middleware, pr/internal, size: small, type/bug
Small documentation fix: https://github.com/litestar-org/litestar/pull/4038
Description
- This PR simplifies pytest plugin and improves ergonomics of usage
- Current implementation returns the pytest fixture then uses a registry to expose usage.
- The new implementation injects the fixture into the caller scope so the returned object is the factory itself. This allow direct usage of factory and simplified usage
Closes
Description
Based on existing implementation and raised issue this feels like a better range and closer to intention.
Closes
Fixes #645
Description
- I discovered by accident I could use Litestar built-ins instead of httpx_ws so this adresses it since there is no mention in the docs
Closes
Triage Required :hospital:, area/docs, pr/external, size: small, type/docs
Description
- When passing sync functions to listeners which can raise an error put the Litestar into unrecoverable state. (https://discord.com/channels/919193495116337154/1342406039013949440)
Closes
Triage Required :hospital:, area/events, pr/external, size: small
Add Julien to the list of maintainers and applies TOML lint to the pyproject.
area/dependencies, pr/internal, size: small
Implements a granian installation group similar to the uvicorn or standard group. This group auto-installs litestar-granian and necessary performance enhancements.
Additionally, the latest linting rules were applied after upgrading the project depedencies
area/contrib, area/dependencies, area/docs, area/private-api, pr/internal, size: medium, type/feat
Removes deprecated packages and prepares for 1.0 release.
Breaking π¨, area/base, area/exceptions, pr/internal, size: small, type/feat
I think we have everything done for 1.0
Well done! I love AA, it is top notch code.
Edit this to change the output of the custom command 1!
Description
Based on existing implementation and raised issue this feels like a better range and closer to intention.
Closes
Fixes #645
This can be reviewed, it's just missing usage docs: https://github.com/litestar-org/litestar/pull/4056
@signal linden @severe onyx I finally found it!
That was a wild ride π
Thanks @severe onyx for setting me on the right path with this π
Love the method
Well sometimes you just have to do a brute-force binary search by hand! π
it just shows dichotomy is still powerful
Description
Copy changes from litestar and remove sonar
Add codecov.yml to report test coverage
Closes
Closes Docs: Fix code quality links in READMEΒ #600
This one's still looking for a review π
Comments addressed on this one
Anyone have any ideas what I'm doing wrong on the coverage combiner here for Adv Alchemy? https://github.com/litestar-org/advanced-alchemy/pull/393/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR109
@woven tundra I'd like to merge this one since it cuts the test time in half, but I'm a bit stuck on it.
@snow sapphire looks like you need to use .coverage prefix https://coverage.readthedocs.io/en/latest/cmd.html#cmd-combine:~:text=When coverage.py combines data files%2C it looks for files named the same as the data file (defaulting to β.coverageβ)%2C with a dotted suffix. Here are some examples of data files that can be combined%3A. Will also need to adjust upload to include hidden
Don't think the speedup really works. Only takes down 3 minutes or so. Still running 18, where it was 21 before?
I think the last runs ran closer to 30 all together. I need to doublecheck that though.
there is still some work for docs and stuff but I think I adressed your comments @woven tundra https://github.com/litestar-org/litestar/pull/4055 . one thing I dont like though DX-wise is that user needs to put middleware in correct orders, I need to find an example, probably when using sessions but if you pass one before the other it will fail I think, and I dont remember if we hold developper's hand enough in that case, but at least now everyting is passed through middleware=[blablabla]
WIP
The middlewares are currently mostly based on either MiddlewareProtocol, AbstractMiddleware or AbstractAuthenticationMiddleware .
Their usage is spread around a few places:
using some kwags on...
well minus another coverage hit I introduced...well back on the blackboard
one thing I dont like though DX-wise is that user needs to put middleware in correct orders
Ah, so this might be a catch-22 then?
We need middleware priorities in order to support the PR that was, among other things, supposed to make it easier to enable middleware priorities? π
An option would be to simply merge your PR in this "brittle" state, or do some super basic middleware order checks, and then follow up with the middleware priorities?
well there is a priority right now, ie the order you passed them
but one can f** up and pass an outer one before
Yeah. But that's not guaranteed. Could be altered by a plugin for example. And it's something users need to be aware of
That's why I said brittle
yep, that's one of the reason for instance I put session in a plugin
it usueally requires 2 midleare and using it you're guaranteed to have it correctly
But we could, for example, do some basic sorting of the middlewares in the scope of this PR, e.g. when building the middleware stack, ensure a certain order
That would be kinda hacky, but at least not break things
yep, agreed
And then follow up with the proper priorities
it's so big and interleaved anyways I dont think there is a simple way to do it at once
at least now it's a little bit more consistent
or not depends on the pov 
Description
Updated .pre-commit-config.yaml
Renamed CONTRIBUTING.md to CONTRIBUTING.md (removed leading white space) and updated few steps
Changed pdm to uv in Makefile and added support for wind...
Reminder on this PR https://github.com/litestar-org/polyfactory/pull/675. Post in the wrong channel initially
I tihnk we may need to rework some of the alembic tests; there's some test case polution that's happening. I'm going to work on this PR, but i may just pragma no-cover this particular new block if we can't get the test to cooperate
i suspect they'll run on their own, but just not as a unit
This beast is ready for review finally: https://github.com/litestar-org/advanced-alchemy/pull/291
Description
Implement a file data type that leverages obstore or fsspec. Supports any supported FSSpec or Obstore backend it including sftp, gcs, s3, local, and more.
Closes
area/alembic, area/base, area/config, area/dependencies, area/docs, area/exceptions, area/fastapi, area/flask, area/litestar, area/private-api, area/repositories, area/sanic, area/services, area/unit-tests, pr/internal, size: large, type/feat
I had to remove the verbose option flag. It's not on the stamp command
I also merged this thing last night: https://github.com/litestar-org/advanced-alchemy/pull/336
Implements new Exists and NotExists filters to more easily apply this type of logic to queries.
Closes #331
area/filters, pr/internal, size: small, type/feat
Also, tests are passing for this one now, but i want to play around with it before we merge it
https://github.com/litestar-org/advanced-alchemy/pull/311
Description
This PR implements a "Multi-Filter" Filter type.
It allows:
- Create a collection of filters from an input
- Allows filters to be groups with and/or logic
It includes 3 implementations:
- The default JSON parameter based config
- A TanStack Table optimized class
- An AG Grid search filter
Closes
area/filters, pr/internal, size: small, type/feat
This one takes a multiple filters as an input and translates to the actual filters. @summer harbor this should be a logical extension from the sample you provided long ago. I've also tried to add in TanTable and AGGrid adapters so that it automatically accepts data in those specific formats (maybe this gets pulled before merging, not sure of the value here)
@summer harbor if you have a few, i'd like for you to check out the MultiFilter and make sure it at least still covers your current use case.
https://github.com/litestar-org/advanced-alchemy/pull/429
tests pending, but should be mostly ready for review
Implements a server side session backend using SQLAlchemy. Works with an Async or Sync configuration.
area/litestar, pr/internal, size: small, type/feat
Description
In the logger configuration, users can specify a set of status codes and exception types for which Litestar will not log the full stack trace.
Closes
Example
import uvicorn
from litestar import Litestar, get
from litestar.logging import LoggingConfig
@get("/")
def index() -> str:
return "Hello, world!"
@get("/value-error")
def value_error() -> None:
raise ValueError("This is a test value error.") # not log the stack trace
@get("/name-error")
def name_error() -> None:
raise NameError("This is a test name error.")
app = Litestar(
route_handlers=[index, value_error, name_error],
debug=True,
logging_config=LoggingConfig(
disable_stack_trace={404, ValueError} # disable_stack_trace: set[Union[int, type[Exception]]]
),
)
if __name__ == "__main__":
uvicorn.run(app=app, port=8621)
Triage Required :hospital:, area/logging, pr/external, size: small
Will update the tests if this approch is okay
I'll review this branch on Monday to see if itβs missing anything from our side, if there is no rush
- Fix #4088 by handling the diverging
TypeAliasTypeintroduced in typing-extensions4.13.0; This type is no longer backwards compatible, as it is a distinct new type fromtyping.TypeAliasType. We need to check for both types now - Add a new test job to the CI to test against known diverging versions of
typing-extensions
area/ci, pr/internal, size: small, type/bug
To ensure compatibility, run against typing-extension pre-releases as an early warning
This is probably what you want to look at
This corrects the 18c service to use the 18 XE image instead of 23c.
Added tests and docs
Migrates all database fixtures to pytest-database
area/dependencies, area/unit-tests, size: small, type/feat
Removes column re-ordering component was incorrectly causing incorrect constraints to be genreated.
Fixes #427
area/alembic, pr/internal, size: small, type/bug
I had a chance to look at it, lgtm. I'll ask another question, can there be a hook to add filters to advanced alchemy? like filters.add_filter(..)
any idea what could trigger this fail in 3.9 totally unrelated to the changes: https://github.com/litestar-org/litestar/actions/runs/14354366765/job/40240276935?pr=4096
https://github.com/litestar-org/litestar/pull/4095
https://github.com/litestar-org/litestar/pull/4096
https://github.com/litestar-org/litestar/pull/4097
https://github.com/litestar-org/litestar/pull/4099
https://github.com/litestar-org/litestar/pull/4101
Description
use literalinclude and move to the examples folder.
simplified the customization
page to check is https://docs.litestar.dev/latest/usage/security/abstract-authentication-middleware.ht...
Description
this renames most /docs/examples/request_data files adding a test_ prefix
thus the make test-examples command take them into account
tests have been added
Closes
Fixes #2940
You've been busy!
Enales the standard UnaryOperator order by support in addition to the existing OrderingPair
area/private-api, area/repositories, pr/internal, size: small, type/feat
Merged the build and deploy jobs into a single job named 'build_and_deploy' in the GitHub Actions workflow for documentation. This change simplifies the workflow and ensures that deployment occurs immediately after the build process, improving efficiency.
area/ci, size: small
https://github.com/litestar-org/polyfactory/pull/687
Edit: running into some build issues will need to resolve first
Description
- This PR automates some of the release process by create changelog and release commit
- This adds
bump-my-versionto align with other litestar repos and updatesgit-cliffcommand to usegh authto allow running without specifying token - Alternative approaches would be porting release script from other repos. Omitting this for now to avoid restructuring too much but happy to adopt those if preferable
Closes
Description
- This PR aims to simplify
helpersby making deterministic. Currently there is parsing onUnionwithin here and also in factory itself - This removes
randomthroughout and deprecates these and deprecates now unused functions - This does change behaviour of
unwrap_annotatedby removingUnionhandling there. Is this ok or can try refactoring to keep the current behaviour until v3?
Closes
Corrects an issue with the channels backend tests
pr/internal, size: small
Small docs improvement: https://github.com/litestar-org/litestar/pull/4124
Docs said send_websocket_stream would handle serialization of arbitrary objects when it did not; Only websocket_stream does.
area/docs, size: small, type/docs
See https://github.com/python/typing_extensions/issues/586.
We're not using this functionality anymore, so keeping this around just for backwards compatibility.
Fix a bug where a dependencies' cleanup was not guaranteed to be called would not be called if an exception was thrown:
- Late during ASGI response rendering
- During cleanup of another dependency when recovering from an exception
Refactor the code such that:
- Exceptions are always caught and thrown into dependencies as long as the dependencies are alive
- If the handler raises an exception and during dependency cleanup other exceptions are raised, the sub-exceptions are grouped into an
ExceptionGroup. This behaviour is now equivalent to regular dependency cleanup
area/dependencies, area/docs, area/kwargs, area/private-api, size: small, type/bug
Bump on this https://github.com/litestar-org/polyfactory/pull/688
Description
- This PR aims to simplify
helpersby making deterministic. Currently there is parsing onUnionwithin here and also in factory itself - This removes
randomthroughout and deprecates these and deprecates now unused functions - This does change behaviour of
unwrap_annotatedby removingUnionhandling there. Is this ok or can try refactoring to keep the current behaviour until v3?
Closes
Add a new attribute_accessor property to AbstractDTO, which can be used by both the codegen and functional backend to access attributes on an object.
This can be useful to implement DTOs for types that do not adhere to the plain protocol of obj.data_field or need to add additional checks, e.g. using obj.related_field.all() on a Django model to access related objects, while ensuring no I/O occurs.
Add a constraints framework for middlewares. These constraints can be defined on middleware classes / instances, and will be checked once the middleware stack for a handler have been resolved.
Currently implemented checks are:
- Any 'A' must come before any 'B'
- Any 'A' must come after any 'B'
- Middleware must be at the top of the stack
- Middleware at the bottom of the stack
- Middleware must be unique in the stack
All checks take into account the class hierarchy, so Any 'A' must come before any 'B' actually means Any type, subclass or instance of 'A' must come before any type, subclass or instance of 'B'.
Setting constraints is only supported on ASGIMiddleware, but constraints referring to other middleware, may refer to any middleware type (class, instance or factory function). In addition, constraints referring to other middleware may to so by providing a string reference, which will be resolved at runtime. ImportErrors can optionally be skipped here, making it possible for a constraint to only apply if e.g. a specific 3rd party library is installed.
Documentation and some cleanup is missing, I'm mainly looking for some early feedback.
area/handlers, area/middleware, area/types, size: small, type/feat
@severe onyx finally got something done π
Thanks for being a great sparring partner on the design of this!
im gonna look at that asap π
its hard
Im kinda debating with myself for 30min on the 1st test
rewriting and rewriting comments ...
it may entirely be just me though I tend more and more to struggle on things like this
You mean test_constraint_ignore_not_found?
test_check_middleware_constraints
Oh, that one. That's the integration test. Did you go over the tests in tests/unit/test_middleware/test_constraints.py already?
intuitively I would have said this should raise
shouldnt
because M2 on app level should be automatically before M1 on handler
or they are evaluated from center of onion to its exterior ?
Ah
Okay, I see how this can be confusing
One detail you have to keep in mind is that the middleware stack is reversed
So the first middleware you define, is the last one in the stack. Because they're being wrapped, if you want the "first" one (i.e. the one closest to the handler) to apply last in the chain, you need to wrap the ASGI callable first with it
So
@get("/", middleware=[MiddlewareOne()])
async def handler() -> None:
pass
Litestar([handler], middleware=[MiddlewareTwo()])
``` if you ask the handler about the middleware, it will return `MiddlewareOne`, `MiddlewareTwo`
im gonna take a pen and pper
I think for the most part, this is intuitive and expected, but for the order thing, it can be a bit confusing
Maybe this is also an indicator that the error messages aren't that great? Looking at the code, I can see how "MiddlewareOne before MiddlewareTwo" can be ambiguous
Because you essentially define the middleware stack in the reverse order it's resolved
ok so befre for you is before in the resolution not in the layering which is reversed
The "before" and "after" refer to the order of the layering (i.e. the stack), not the order the middlewares are applied in
ok that's why
i was rewriting and rewritig
now it makes sense but so the naming could be better
resolved_after, resolved_before ?
I was too focused on the stack, didn't event think about this
I get that's why Im here palying the dumb user
I think having the before and after refer to the order they are applied in makes more sense
The only issue with that is, then error messages become confusing
How about we flip the stack completely for the ordering checks? Then it would match the order the middlewares are applied in, but not the order they're wrapped (which you could argue is an implementation detail)
So in this example, the resolved order from the handler would be [MiddlewareOne, MiddlewareTwo], but the actual order they're applied in later would be [MiddlewareTwo, MiddlewareOne]. If we'd always reverse it, then what we check and report on would be [MiddlewareTwo, MiddlewareOne]
And maybe reword the exception, so instead of All instances of 'MiddlewareTwo' must come before any instance of 'MiddlewareOne', it would say All instances of 'MiddlewareTwo' must apply before any instance of 'MiddlewareOne'?
Because the "come before" could be a bit ambiguous
The only downside I see there is debugging. If we'd report a constraint violation of a middleware, and that it's at index 0, if you look at the resolved stack, you'd see it's actually at -1
best I can say is idk....
Actually, we could fix that if we don't reverse the order on the handler itself (which is what we're doing right now, while we're resolving the middleware), but only when we apply it?
can we detect where it faults ? in that example if we say somehting like: , M2 has a before M1 contraint but handler resolves as M1, M2
I just mean giving an explantion is maybe the solution
We can and we do
oh ok I ran the test and didnt see
Well, we don't give the full stack back (bc it could be too big I thought), but we do report the indices of the middlewares that are in violation of the constraint(s)
And we do say All instances of 'MiddlewareTwo' must come before any instance of 'MiddlewareOne'
ok my bad then, it's probably just me reading the test, the match *
ok ok I'll get back to it more concentrated
Yeah, I didn't include the full exception string bc I was refactoring so much and kept breaking my tests so I used a regex π
Should probably include the rest of the message there as well now tho
I pushed a change @severe onyx. I think that should make things easier to follow
You now define the stack "top down", i.e. the first middleware on the app is at 0, and the last middleware on a handler is at -1
I've also added more comment
Thanks, I'm going to give it another go this afternoon
Thanks for the feedback π
done π
I think I may have some work to do once that is merged π₯Έ ....if others can take a look too that would be cool to be fair, this is not that complex but still requires some concentration and some more eyes are always beneficial imho
I think I may have some work to do once that is merged
We can finally get your middleare refactoring thing in then π
Description
- Avoid deep copy and update to use parent method. This is to allow changes to underlying type
- Also update dependencies so dev dependencies allow running tests
Closes
https://github.com/litestar-org/polyfactory/pull/703. This was satisfying to clean up
Description
- Note target of this is new release candidate. Will aggregate changes there
- Remove all usage of deprecated param and remove related code
- Other changes notable
- Add
_init_modelinternal method. Used for rebuilding pydantic and setting check model true as some things need to be rebuilt after initialising factory but before checking. - Updating tests that relied on default behaviour
- Add
- One bit now unsure of is setting
SQLAlchemy.__set_association_property__toTrueas default. This seems to fail with relationships so tempted to default to False.
Closes
Updates the AlembicCommand to use named arguments and additionaly support Alembic 1.16's support for toml_file.
area/alembic, area/config, area/dependencies, pr/internal, size: small, type/bug
Description
Closes
Updated this and other pr now π
Description
- Update code and CI to drop 3.8 support
- Update target python version. Largely autoupdated here
Closes
Description
- Handling of union and recursive types changed slightly with https://github.com/litestar-org/polyfactory/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aclosed
- Update to handle forward ref explicitly
Closes
Closes #725
I'm going to merge the above shortly to unblock the release and bugs there and these have been test. Happy to follow up with any changes if need
review request https://github.com/litestar-org/type-lens/pull/48
The intent was to be sure we were not exposing pyright Unknown types out the public interface.
This goes beyond that and applies it to the whole repo, mainly because it's easier to ensure, if the whole repo is strictly enforced, and it wasn't that much more effort.
ty for the review. although i guess @signal linden, the publish CI failed during changelog generation.
doesn't block me but just fwiw. also i'll probably try revitalizing your uv PR, as i find pdm to be rather sad
Bump on these prs if anyone has time to review π
i did one (the easier one) π i am not familiar enough to review the 2nd
Thanks!
Description
- See title
Closes
No description provided.
oh dope nvm. didn't see the approval
Description
- Add option for manual docs runs of any version
area/ci, pr/internal, size: small
Update pytest: https://github.com/litestar-org/litestar/pull/4261
No description provided.
pr/internal, size: small
Fixed regression where service.create() method stopped handling relationship data correctly when passed SQLAlchemy model instances. Changed model_from_dict() in _util.py to use __mapper__.attrs.keys() instead of __mapper__.columns.keys() to include relationship attributes alongside column attributes.
- Use
attrs.keys()to include both columns and relationships - Add comprehensive tests for relationship handling in model_from_dict
- Verify unknown attributes are still ignored
area/private-api, area/repositories, pr/internal, size: small, type/bug
The official mysql connector has a dual use license. Unfortunately, the open version of the driver has a GPL license. This change swaps to the open pymysql driver instead.
Ensure that the IdentityPrimaryKey correctly generates IDENTITY DDL across multiple database dialects, including PostgreSQL, Oracle, and SQL Server. Update dependencies and add tests to verify the functionality.
area/dependencies, area/mixins, pr/internal, size: small, type/bug
Correctly allow loading configuration from the current directory
pr/internal, size: small, type/feat
Description
- Add reference for advanced alchemy sessions
Closes
Triage Required :hospital:, area/docs, pr/external, size: small, type/docs
Updates update and update_many to properly handle relationships and returning support.
area/dependencies, area/private-api, area/repositories, area/services, pr/internal, size: medium, type/bug
Corrects a TypeError reported from the init method of SQLAlchemyAsyncQueryRepository
area/private-api, area/repositories, pr/internal, size: small, type/bug
Introduce methods for creating LATERAL, LEFT LATERAL, and CROSS LATERAL joins in the SQL builder, along with comprehensive tests to validate their functionality.
Property correction for updates
area/private-api, area/repositories, pr/internal, size: small, type/bug
Introduce new async-native testing utilities:
AsyncTestClientAsyncWebSocketTestSessionLifespanHandlerTestClientTransport
And synchronhous equivalents:
TestClientWebSocketTestSessionSyncTestClientTransport
The test utilities are not async-first, meaning the implementation is async, and when using the synchronous versions, they will be bridged using anyios BlockingPortal, whereby they run the async code within a new thread + event loop.
This design removes various barriers and pitfalls, mainly dealing with multiple event loops when running tests asynchronously (e.g. avoiding nested event loops). It also simplifies the code quite a bit and brings a minor speedup when running async tests.
There is currently one issue stemming from a fundamental incompatibility between pytest-asyncio and anyio.CancelScope, https://github.com/pytest-dev/pytest-asyncio/issues/1191, but I'm working on a fix towards this, with a proof-of-concept already in place, so I think it's not a blocker.
Fixes #1920
area/docs, area/private-api, area/testing, area/types, size: medium, type/feat
@severe onyx managed to get it working and I'm quite happy with the result
Description
Closes
I'll look at this asap, this is exciting !!
Description
- This reverts the change proposed for v3 of changing this default
- This is done because association proxy will often be declared with relationships so will be redundant to calculate twice
Closes
Description
This removes deprecation warning from polyfactory from changing this default
Closes
area/private-api, size: small, type/bug
Add DTO support for union types that contain composite types and nested models, e.g. list[SomeModel] | None or SomeModel | list[SomeModel].
The limit of this support is when multiple composite types are introduced to the union, e.g. list[str] | dict[str, str] | SomeModel]. The reason for that being that it's not particularly simple to generate code that can handle these generally, and checks which case has been encountered. Doing so comes dangerously close to type checking :grimacing: So instead, we simply bail if we cannot perform our checks with a simple isinstance, type or is check.
Fixes #4273
area/dto, area/private-api, pr/internal, size: small, type/feat
After the most recent updates to rich-click and click, CLI plugins no longer show the command in the command help text.
This is because the plugin was not loaded before rending the help text. This change ensures that the plugins are loaded prior to formatting the help output.
area/private-api, pr/internal, size: small, type/bug
Third time's the charm? https://github.com/litestar-org/litestar/pull/4340
Summary
This PR completes the deprecation and migration of SQLAlchemy functionality from Litestar v3.0. Following the approach from PR #4225, both litestar.contrib.sqlalchemy and litestar.plugins.sqlalchemy modules have been completely removed. Users must now import directly from advanced_alchemy.extensions.litestar.
Related Issues/PRs
- Closes #4163 - Second removal attempt
- Related to #4225 - Previous near-perfect implementation (out of sync with master)
- Related to #4069 - Initial removal attempt by @provinzkraut
- Related to #3755 - Original deprecation PR
Breaking Changes
BREAKING CHANGE: All SQLAlchemy functionality has been removed from Litestar.
Migration Guide
from litestar.contrib.sqlalchemy import Xβfrom advanced_alchemy.extensions.litestar import Xfrom litestar.plugins.sqlalchemy import Yβfrom advanced_alchemy.extensions.litestar import Yfrom litestar.plugins.sqlalchemy.base import Zβfrom advanced_alchemy.extensions.litestar.base import Z
Changes Made
-
Complete Module Removal:
- Removed entire
litestar/contrib/sqlalchemy/directory tree - Removed
litestar/plugins/sqlalchemy.pyre-export file
- Removed entire
-
Documentation Updates: Updated all example files to use
advanced_alchemy.extensions.litestarimports -
Test Updates:
- Updated all tests to use new import paths
- Deleted tests for deprecated functionality that no longer exists
-
Clean Architecture: No re-export layer in Litestar - direct imports from advanced-alchemy only
-
Changelog: Added breaking change entry explaining the migration
Technical Implementation
This implementation follows the cleaner approach from PR #4225:
- No re-export layers - users import directly from
advanced_alchemy.extensions.litestar - Complete separation of concerns - Litestar no longer maintains SQLAlchemy code
- Single source of truth - advanced-alchemy is the sole provider of SQLAlchemy integration
Benefits
- Cleaner separation - Litestar doesn't maintain SQLAlchemy code
- Single source of truth - advanced-alchemy is the only place for SQLAlchemy integration
- Easier maintenance - No need to keep re-export layers in sync
- Clear dependency - Users know they need advanced-alchemy for SQLAlchemy support
Testing
- β All tests pass
- β Type checking pa...
Breaking π¨, area/docs, area/plugins, pr/internal, size: large, type/feat
Summary
Adds deprecation warning for the litestar.plugins.sqlalchemy module which will be removed in v3.0.
Context
- Related to #4340 which removes this module in v3
- Follows deprecation policy to warn users before removal
- Part of the ongoing migration to advanced-alchemy
Changes
- Add module-level deprecation warning to
litestar.plugins.sqlalchemy - Add test for deprecation warning
Migration Path
Users should update their imports:
# Old (deprecated)
from litestar.plugins.sqlalchemy import SQLAlchemyPlugin
# New
from advanced_alchemy.extensions.litestar import SQLAlchemyPlugin
area/plugins, pr/internal, size: small, type/feat
Middlewares inheriting from ASGIMiddleware will now have zero runtime cost when they are excluded e.g. via the scope or exclude_opt_key options.
Previously, the base middleware was always being invoked for every request, evaluating the exclusion criteria, and then calling the user defined middleware functions. If a middleware had defined scopes = (ScopeType.HTTP,), it would still be called for every request, regardless of the scope type. Only for requests with the type HTTP, it would then call the user's function.
With zero cost exclusion, the exclusion is being evaluated statically. At app creation time, when route handlers are registered and their middleware stacks are being built, a middleware that is to be excluded will simply not be included in the stack.
I've marked this change as breaking, even though no runtime behaviour difference is expected. Some test cases may break though if they relied on the fact that the middleware wrapper created by ASGIMiddleware was always being called, e.g. if using a mock or trying to observe side-effects of this behaviour.
Breaking π¨, area/dependencies, area/docs, area/middleware, area/private-api, size: small, type/feat
I am really pleased with this one π
https://github.com/litestar-org/litestar/pull/4340
Can I get a review on this one. I'm hoping to not have to rebase it or anything again.
Summary
This PR completes the deprecation and migration of SQLAlchemy functionality from Litestar v3.0. Following the approach from PR #4225, both litestar.contrib.sqlalchemy and litestar.plugins.sqlalchemy modules have been completely removed. Users must now import directly from advanced_alchemy.extensions.litestar.
Related Issues/PRs
- Closes #4163 - Second removal attempt
- Related to #4225 - Previous near-perfect implementation (out of sync with master)
- Related to #4069 - Initial removal attempt by @provinzkraut
- Related to #3755 - Original deprecation PR
Breaking Changes
BREAKING CHANGE: All SQLAlchemy functionality has been removed from Litestar.
Migration Guide
from litestar.contrib.sqlalchemy import Xβfrom advanced_alchemy.extensions.litestar import Xfrom litestar.plugins.sqlalchemy import Yβfrom advanced_alchemy.extensions.litestar import Yfrom litestar.plugins.sqlalchemy.base import Zβfrom advanced_alchemy.extensions.litestar.base import Z
Changes Made
-
Complete Module Removal:
- Removed entire
litestar/contrib/sqlalchemy/directory tree - Removed
litestar/plugins/sqlalchemy.pyre-export file
- Removed entire
-
Documentation Updates: Updated all example files to use
advanced_alchemy.extensions.litestarimports -
Test Updates:
- Updated all tests to use new import paths
- Deleted tests for deprecated functionality that no longer exists
-
Clean Architecture: No re-export layer in Litestar - direct imports from advanced-alchemy only
-
Changelog: Added breaking change entry explaining the migration
Technical Implementation
This implementation follows the cleaner approach from PR #4225:
- No re-export layers - users import directly from
advanced_alchemy.extensions.litestar - Complete separation of concerns - Litestar no longer maintains SQLAlchemy code
- Single source of truth - advanced-alchemy is the sole provider of SQLAlchemy integration
Benefits
- Cleaner separation - Litestar doesn't maintain SQLAlchemy code
- Single source of truth - advanced-alchemy is the only place for SQLAlchemy integration
- Easier maintenance - No need to keep re-export layers in sync
- Clear dependency - Users know they need advanced-alchemy for SQLAlchemy support
Testing
- β All tests pass
- β Type checking pa...
Breaking π¨, area/docs, area/plugins, pr/internal, size: large, type/feat
Will do. We'll get it done this time, I can feel it! π
@snow sapphire fixed all the outstanding issues, should be good to go now. Only a weird linting blip that's not just affecting your branch..
Merged
Thanks. this is a relief to finally cross off the list!
Yup. Big one!
@snow sapphire just fyi, I've put all the docs back in place (well, back and moved out of the contrib section). Dunno if you've left some of them out intentionally or not, just felt like it's the most sensible thing to do
We can migrate them to the AA docs at any point, we'd just have to add a redirect page into the Litestar docs then
Sounds good. I think we need to overhaul the AA docs and then maybe find a way to use intersphinx to link the two?
Summary
Fixes a RuntimeError: generator raised StopIteration that prevented the BigQuery emulator fixture from starting Docker containers. This issue affected BigQuery tests and could potentially impact other database services under certain conditions.
Root Cause
The error occurred in _service.py:188 where next() was used without a default value inside a @contextmanager generator function:
host_port = int(
container.ports[next(k for k in container.ports if k.startswith(str(container_port)))][0]["HostPort"]
)
When no matching port key was found, next() raised StopIteration. Since Python 3.7+, StopIteration inside a generator is converted to RuntimeError, causing the cryptic error message.
Changes
1. Enhanced retry loop (lines 178-182)
- Before:
container.reload()called after checking ports - After:
container.reload()called before checking ports - Why: Ensures fresh port bindings are available on each retry iteration
2. Safe port lookup with exact-key matching (lines 187-196)
- Before: Used
next()withstartswith()pattern matching - After: Uses explicit
dict.get()with exact protocol keys ("9050/tcp","9050/udp") - Benefits:
- Eliminates
StopIterationexceptions - Avoids false positives (e.g., "80" matching "8080/tcp")
- Provides descriptive error messages showing available ports
- Uses
RuntimeErrorfor consistency with fixture setup failures
- Eliminates
@woven tundra can you take a look? I'm having some random issues with tests hanging in some cases, and I tracked it down to this.
Fix looks reasonable, just one comment about where things should go
https://github.com/litestar-org/advanced-alchemy/pull/567
i've got a few PRs queued up using this, so I need to get it merged first. No actual code changes so should be a simple review
Introduce a structured agent workflow and comprehensive development guides for the AI agent based development. This includes detailed instructions for agents, directory structures for requirements, and updates to existing documentation.
area/dependencies, area/docs, pr/internal, size: large
Summary
Fixes #514 - Resolves InvalidRequestError when deleting objects with auto_expunge=True and auto_commit=True enabled.
Problem
Repository methods delete(), delete_many(), and delete_where() would fail with InvalidRequestError: Instance <Model> is not present in this Session when both auto_expunge=True and auto_commit=True were enabled.
The root cause was that the code attempted to expunge objects after they had already been deleted and committed. Once a transaction containing deletions is committed, SQLAlchemy automatically moves deleted objects to the detached state, removing them from the session. Attempting to expunge these already-detached objects raises an error.
Solution
Added a state check in the _expunge() method to skip expunge for deleted objects:
state = inspect(instance)
if state is not None and state.deleted:
# Object will be automatically detached when transaction commits
# Skip expunge to avoid InvalidRequestError
return None
This fix:
- β Checks object state before attempting expunge
- β Skips expunge for deleted objects (they're auto-detached on commit)
- β Maintains backward compatibility
- β Works for all three delete methods
- β Works across all database backends
- β Includes comprehensive tests
Changes
Modified Files
advanced_alchemy/repository/_async.py- Added state check in_expunge()methodadvanced_alchemy/repository/_sync.py- Auto-generated sync versiontests/unit/test_repository_delete_expunge.py- New unit tests validating the fix
Testing
- 6 unit tests covering various scenarios
- Tests for both async and sync repositories
- Validates deleted object handling
- Validates non-deleted object handling
- Tests with auto_expunge enabled/disabled
Verification
# Run unit tests
uv run pytest tests/unit/test_repository_delete_expunge.py -v
# Verify lint passes
make lint
# Verify type checking passes
make type-check
Related Issues
Fixes #514
area/private-api, area/repositories, pr/internal, size: small, type/bug
Summary
Implements complete API parity with Alembic 1.16.5 CLI by adding 9 missing commands and completing the stamp command with all options.
Changes
New Commands β¨
check- Verify pending migrationsedit- Edit revision with $EDITORensure-version- Create version table (supports --sql)heads- Show current heads (supports --verbose, --resolve-dependencies)history- Show revision history (supports --verbose, --rev-range, --indicate-current)merge- Merge revisions (supports -m/--message, --branch-label, --rev-id, --no-prompt)show- Show specific revision detailsbranches- Show branch points (supports --verbose)list-templates- List available Alembic templates
Enhanced Commands π§
stamp- Added missing options: --sql, --tag, --purge
Testing β
- 67 total tests (25 unit + 42 integration)
- All commands tested with edge cases
- Both sync/async configurations
- Multiple database backends
Documentation π
- Updated CLI reference with all commands
- Added usage examples and use cases
- Changelog entry added
Related Issues
- #568 - Python 3.9 template compatibility (separate issue)
area/alembic, area/dependencies, area/docs, pr/internal, size: medium, type/feat
Summary
Fixes a closure bug where multiple fields in in_fields and not_in_fields arrays resulted in only the last field working correctly. This was caused by loop variables being captured by reference rather than by value in nested function definitions.
Problem
When configuring multiple filter fields like this:
dependencies = providers.create_service_dependencies(
MyService,
"my_service",
filters={
"in_fields": [
providers.FieldNameType("type", str),
providers.FieldNameType("status", str),
],
},
)
Result:
GET /api/endpoint?typeIn=valueβ β FAILED (no filter generated)GET /api/endpoint?statusIn=valueβ β SUCCESS (only last field works)
This silent failure caused incorrect query results as filters were ignored.
Root Cause
Classic Python late-binding closure issue: all closures created in the loop captured the same loop variable field_def by reference. After the loop completed, all functions referenced the final value of field_def.
Solution
Uses default parameter values to capture the loop variable by value:
def create_in_filter_provider(
field_name: FieldNameType = field_def, # β
Captures by value
) -> Callable[..., Optional[CollectionFilter[Any]]]:
...
This ensures each closure has its own independent copy of the field definition.
Changes
Litestar Provider (advanced_alchemy/extensions/litestar/providers.py):
- Fixed
create_not_in_filter_providerclosure (lines 508-512) - Fixed
create_in_filter_providerclosure (lines 537-541)
FastAPI Provider (advanced_alchemy/extensions/fastapi/providers.py):
- Fixed
create_not_in_filter_providerclosure (lines 575-581) - Fixed
create_in_filter_providerclosure (lines 610-616)
Testing
β Existing tests validate the fix:
test_litestar_openapi_schema- Tests multiple fields in both arraystest_openapi_schema_comprehensive- Validates all filter parameters generatedtest_multiple_filters_aggregation- Verifies filter combinations work
All CI checks passing (Python 3.9-3.13, mypy, pyright, SonarCloud).
Impact
- Severity: Critical - Silent data filtering failures
- Scope: Any user with multiple fields in
in_fieldsornot_in_fieldsarrays - Compatibility: No breaking changes, backward compatible
- Performance: No performance impact (fix at DI setup time)
Fixes #507
area/docs, area/litestar, pr/internal, size: small, type/bug
Summary
Fixes #555
This PR fixes a bug in the Service layer's update() method where dict, Pydantic, msgspec, and attrs data bypassed the to_model() operation map, preventing custom to_model() implementations from being invoked during update operations.
Problem
The Service layer provides a documented pattern for customizing data transformation during CRUD operations via the to_model() method and its operation-specific hooks (to_model_on_create, to_model_on_update, etc.). However, the update() method had inconsistent implementation:
Before (Buggy):
- Dict data: Called
to_model_on_update()directly β bypassedto_model() - Pydantic/msgspec/attrs data: Called
schema_dump()β bypassed bothto_model()andto_model_on_update() - Model instance data: Correctly called
to_model(data, "update")β
After (Fixed):
- ALL data types: Call
to_model(data, "update")first to_model()internally routes toto_model_on_update()via operation_map- Matches the pattern used in
create()which always callsto_model(data, "create")
Changes
update()now callsto_model(data, "update")FIRST for ALL data types- Ensures custom
to_model()implementations receiveoperation="update"parameter to_model_on_update()still called via operation_map routing (backward compatible)- Uses SQLAlchemy inspect to only copy explicitly set attributes to existing instance
- Preserves existing instance when
item_idprovided (maintains relationships and db-managed fields) - Both async and sync variants updated (sync auto-generated via unasyncd)
Testing
- β All existing attrs service tests pass (including partial update with NOTHING values)
- β All existing sqlquery service tests pass
- β Both async and sync variants tested
- β Linting, mypy, and pyright checks pass
Backward Compatibility
This fix is backward compatible:
- Users with only
to_model_on_update()implemented: No change (still works via operation_map) - Users with custom
to_model()expecting operation parameter: Now works correctly (bug fixed) - Users who never override service methods: No change
- Method signature unchanged
- No breaking changes to public API
User Impact
Positive Impact:
- Users building custom services with specialized update logic who override
to_model()expecting theoperationparameter will now have their code work as documented - Consistency across all CRUD operations (create, update, upsert, delete)
area/private-api, area/services, pr/internal, size: small, type/bug
Description
- Prepare v2.22.3 release. Note needed to fix click dependency in bump my version usage due to https://github.com/callowayproject/bump-my-version/issues/377
uv.lockhas changed due to timestamp version diff in recent uv version
Closes
Description
what's included
- @adhtruong
refactor!: remove deprecated elements (https://github.com/litestar-org/polyfactory/pull/703[)f%5D(https://github.com/litestar-org/polyfactory/pull/720/commits/1eaede178ab42ea60e90b439040500ab2264ad89)
- @adhtruong drop 3.8 support and update linting
- @adhtruong remove unused tests
- @Harshal6927 update docs and logo
Notes
- Final v2 release has been made as per https://github.com/litestar-org/polyfactory/issues/668#issuecomment-3289521198
- I'll merge this PR ff to preserve commits for these
- I'll do follow up PR to generate release notes and prepare an announcement
Closes
Closes https://github.com/litestar-org/polyfactory/issues/668
I'm going to close this PR but we can reopen if there's more interest later: https://github.com/litestar-org/advanced-alchemy/pull/371
I've also started rewriting the docs for AA. https://github.com/litestar-org/advanced-alchemy/pull/586
the PR docs deploy style rendering is still not working though. I'd like to get that working before we consider merging this docs update
Also, this is pretty much ready to merge: https://github.com/litestar-org/sqlspec/pull/128
it's a bit of a beast in terms of changes, and i've been testing it locally, so i don't think a complete review is needed. but this is just in case and an fyi
and this one https://github.com/litestar-org/sqlspec/pull/137
Can i get a few eyeballs on the following?
https://github.com/litestar-org/advanced-alchemy/pull/585
https://github.com/litestar-org/advanced-alchemy/pull/580
I'd like to merge them today or tomorrow if possible
Summary
Adds support for SQLAlchemy func() expressions in filter classes to eliminate type checker errors when using database functions like func.random() or func.lower().
Closes #519
The Problem
T...
Can we get one more final review on this one before i merge?
It's no longer going to mention anything about deprecation and it automatically defaults to True (which is raise exception/exception group). https://github.com/litestar-org/advanced-alchemy/pull/580
Checking
Any issues with me removing the 3.9 test from the CI here? I think the mssql drivers have removed 3.9 support without deprecating. I've been getting this quite a bit in AA the last 2 days: https://github.com/litestar-org/advanced-alchemy/actions/runs/18820541212/job/53695384777
it's a segfault somewhere, i think
(leaving support in, just disabling the tests)
There are unpredictable segfaults now with a few of the database adapters and 3.9.
Rather than remove it, we can disable the tests for now.
area/ci, area/dependencies, pr/internal, size: small
well maybe that wasn't it
This is ready for review. I'll prep a release note for announcement channel. Note individual code was reviewed separately but have rebased since https://github.com/litestar-org/polyfactory/pull/720
Description
what's included
- @adhtruong
refactor!: remove deprecated elements (https://github.com/litestar-org/polyfactory/pull/703[)f%5D(https://github.com/litestar-org/polyfactory/pull/720/commits/1eaede178ab42ea60e90b439040500ab2264ad89)
- @adhtruong drop 3.8 support and update linting
- @adhtruong remove unused tests
- @Harshal6927 update docs and logo
Notes
- Final v2 release has been made as per https://github.com/litestar-org/polyfactory/issues/668#issuecomment-3289521198
- I'll merge this PR ff to preserve commits for these
- I'll do follow up PR to generate release notes and prepare an announcement
Closes
Closes https://github.com/litestar-org/polyfactory/issues/668
Description
- Job copied from https://github.com/litestar-org/litestar/blob/main/.github/workflows/ci.yml#L98 to simplify check
Closes
Description
- This adds support to use
BaseModel.model_validate(..., by_name). This unblocks use cases where the model names are not valid python identifiers - Set to False for backwards compatibility but may want to change this to true in future major release
Closes
Replace previous documentation URLs with the dedicated domain name.
area/dependencies, area/docs, pr/internal, size: small, type/bug
Silence a few configurations and deprecate the litestar.contrib.opentelemetry module in favor of litestar.plugins.opentelemetry, updating the relevant imports and adding tests for the deprecation warnings.
pr/internal, size: small, type/feat
Summary
This PR completes the implementation of SQLAlchemy inheritance pattern support in CommonTableAttributes, enabling proper handling of Single Table Inheritance (STI), Joined Table Inheritance (JTI), and Concrete Table Inheritance (CTI).
Changes
Core Implementation (advanced_alchemy/base.py)
-
Added
__init_subclass__hook (lines 209-277):- Detects STI children by checking if any parent has
polymorphic_onin their__mapper_args__ - Automatically sets
cls.__tablename__ = Nonefor STI children - Handles both explicit (with
polymorphic_identity) and implicit (without) STI children - Properly distinguishes between base classes and child classes
- Detects STI children by checking if any parent has
-
Enhanced
@declared_attr.__tablename__()method (lines 281-386):- Returns
Nonefor explicitly setNonevalues (set by__init_subclass__) - Provides fallback STI detection for cases where parent doesn't have explicit tablename
- Generates snake_case table names for non-STI classes
- Returns
Supported Patterns
-
β Single Table Inheritance (STI):
- Child classes with
polymorphic_identityshare parent's table - Works with both auto-generated and explicit parent table names
- Handles edge case of children without
polymorphic_identity(with warning)
- Child classes with
-
β Joined Table Inheritance (JTI):
- Child classes with explicit
__tablename__create joined tables - Proper foreign key relationships maintained
- Child classes with explicit
-
β Concrete Table Inheritance (CTI):
- Child classes with
concrete=Truecreate independent tables - No foreign keys to parent table
- Child classes with
Related Issues
Supersedes PR #600
area/base, pr/internal, size: small, type/bug
π€
ahh i was scrolled way up and got sent to https://github.com/litestar-org/polyfactory/pull/761 lol
I am sorry for the flood of review requests that are incoming. I'll highlight the important ones to prioritize for review.
here's the first one that should be prioritized. It fixes some issues with polymorphic table patterns and the table naming setup: https://github.com/litestar-org/advanced-alchemy/pull/611
Here's another one that is simple but needs to be approved. Starlette updated and changed the API on a few things. this fixes that: https://github.com/litestar-org/advanced-alchemy/pull/634
Reviews that need a bit more careful inspection:
https://github.com/litestar-org/advanced-alchemy/pull/640
And finally, ones that we need to really review and test more even though they are there. I want to use these with a real setup for a bit in a beta mode.
https://github.com/litestar-org/advanced-alchemy/pull/635
https://github.com/litestar-org/advanced-alchemy/pull/636
Description
In 3.14, the repr has changed so union are incorrect detected as literal https://docs.python.org/3/whatsnew/3.14.html#typing.
Update to check explicitly for union first
Closes
Closes...
If anyone is around for a quick review. I'm hitting this on a few things
@woven tundra I had to make a few tweaks on the tests to make things work with pytest 8
but i've retargeted mongo and yugabyte to be based off this merge
Yugabyte working finally: https://github.com/litestar-org/pytest-databases/pull/84
MongoDB is ready as well https://github.com/litestar-org/pytest-databases/pull/85
we need to merge them in the order above as the gizmosql fixtures fix some pytest 9 issues
This is also now ready for review finally: https://github.com/litestar-org/advanced-alchemy/pull/640
Anyone around for a quick review of this? https://github.com/litestar-org/pytest-databases/pull/84
I need to get a release of pytest-databases out for the gizmosql - but these are also ready to go, so I'd like to include them.
If anyone is aroudn for a quick review
I'm going to trigger a beta release of Advanced Alchemy soon, and this should make that much easier.
i gotchu
Last one before I think we are ready to trigger a beta: https://github.com/litestar-org/advanced-alchemy/pull/679
Summary
SQLModel table=True models now work seamlessly with Advanced Alchemy repositories and services without requiring AA base classes
ModelProtocol no longer requires to_dict() β models only ne...
Anyone around for a code review? https://github.com/litestar-org/pytest-databases/pull/112
it's docs and one new ruff rule modification
This change overhauls the docs and integrates Sybil testing for the code snippets in them
it also finishes the sanic, flask, starlette, litestar and fastapi docs
Drop support for Pydantic 1.
I've left in testing constructs to help test against multiple Pydantic version, as they may help us in the future, if another major release drops with this sort...
<@&1084813023044173866> fyi
https://github.com/litestar-org/litestar/pull/4623
Anyone PTAL?
I added a bit of feedback
dto codegen backend bug fix:
https://github.com/litestar-org/litestar/pull/4670
Hi, I have made the changes and you had it approved, can we merge it? https://github.com/litestar-org/litestar/pull/4623 Thanks
this has been merged. thanks for the change!
it's only linting: https://github.com/litestar-org/litestar/pull/4689
https://github.com/litestar-org/litestar/pull/4691
this fixes a deprecation warning from OTEL, moves to plugins, and updated docs. I'll create a PR to cherry pick the changes + a deprecation warning for the 2.0 branch after it merges.
another simple one: https://github.com/litestar-org/litestar/pull/4692
Someone other than me need to approve this one: https://github.com/litestar-org/litestar/pull/4652
https://github.com/litestar-org/advanced-alchemy/pull/719 <- this is the first in a stack
https://github.com/litestar-org/litestar/pull/4759
This backports the otel updates and adds the deprecation shims to the v2 branch.
Here's the same one for repository deprecation v2 cherry pick: https://github.com/litestar-org/litestar/pull/4758
https://github.com/litestar-org/litestar/pull/4762 - Moves Jinja from contrib to plugins
https://github.com/litestar-org/litestar/pull/4764 - Moves Mako from contrib to plugins
https://github.com/litestar-org/litestar/pull/4760 - Moves Minijinja from contrib to plugins
Each has a follow-up issue for the a v2 deprecation followup PR.