Merged
Conversation
warnings.deprecated is only available since Python 3.13!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
This release, like the previous one, includes some breaking changes to the public code API of certain classes, hence the bump in version from
2.2.0to2.3.0. The breaking changes aim to improve the user experience (UX) when usingControllersand registering routes. In particular, they address issues #511 and #540.The scope of the breaking changes is relatively minor, as they affect built-in features that are likely not commonly modified: removes theprepare_controllersand theget_controller_handler_patternfrom theApplicationclass, transferring them to a dedicatedControllersManagerclass. Additionally, theRouterclass has been refactored to work consistently for request handlers defined as functions and those defined as Controllers' methods.The Router now allows registering all request handlers without evaluating them immediately, postponing duplicate checks, and introduces an
apply_routesmethod to make routes effective upon application startup. This change is necessary to support using the same functions for both functions and methods, addressing issue #540, improving UX, and eliminating potential confusion caused by having two sets of decorators (get, post, put, etc.) that behave differently. While the two sets of decorators are still maintained to minimize the impact of breaking changes, the framework now supports using them interchangeably.While breaking changes may cause inconvenience for some users, I believe the new features in this release represent a significant step forward. Now Controllers support routes inheritance! This is an important feature that was missing so far in the web framework.
for inheriting endpoints from parent controller classes, when subclassing
controllers. Example:
@abstract()decorator that can be applied to controller classes to skiproutes defined in them; so that only their subclasses will have the routes
registered, prefixed by their own prefix).
Applicationcode to encapsulate in adedicated class functions that prepare controllers' routes.
Routerclass to handle consistentlyrequest handlers defined using functions and controllers' class methods
(refer to the note above for more information).
and race condition in
client.IncomingContent.stream(), by @ohait.for Pydantic's
@validate_calland@validate_argumentsand other wrappersapplied to functions before they are configured as request handlers.
Contribution by @aldem, who reported the issue and provided the solution.
@validate_call, configure automatically a defaultexception handler for
pydantic.ValidationErrorwhen Pydantic is installed.all generated
$refvalues contain only allowed characters.implementation of Server-Sent Events (SSE) to support sending data in any
shape, and not only as JSON. Add a
TextServerSentEventclass to send plaintext to the client (this still escapes new lines!).
is_stoppingfunction to emit a warning instead of raising aRuntimeErrorif the env variableAPP_SIGNAL_HANDLERis not set to atruthy value.
RouteDuplicateclass.are available since Python 3.9 (e.g.
list[str],set[str],tuple[str]).introduced in
2.2.0that would prevent customHTTPExceptionhandlers frombeing used when the user configured a catch-all
Exceptionhandler(this practice is not recommended; let the framework handle unhandled exceptions
using
InternalServerErrorexception handler).ConflictHTTPExceptiontoblacksheep.exceptionsfor409response code.