Upgrading starlette 0.17 to 0.18
Review needed0.17.1 → 0.18.0New8Changed1Fixed5
Review neededUpgrade verdict
1 behavior change.
In plain terms
- Files served by FileResponse are now sent in larger 64 kilobyte chunks instead of 4 kilobyte chunks.
Must act Nothing to change
No breaking, platform, security or deprecated items in this range.
Nothing in this upgrade needs a code or configuration change.
API changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- changed:
constructor Starlette(debug: bool=…, routes: typing.Sequence[BaseRoute]=…, middleware: typing.Sequence[Middleware]=…, exception_handlers: typing.Dict[typing.Union[int, typing.Type[Exception]], typing.Callable]=…, on_startup: typing.Sequence[typing.Callable]=…, on_shutdown: typing.Sequence[typing.Callable]=…, lifespan: typing.Callable[[Starlette], typing.AsyncContextManager]=…) -> None → constructor Starlette(debug: bool=…, routes: typing.Sequence[BaseRoute]=…, middleware: typing.Sequence[Middleware]=…, exception_handlers: typing.Mapping[typing.Any, typing.Callable[[Request, Exception], typing.Union[Response, typing.Awaitable[Response]]]]=…, on_startup: typing.Sequence[typing.Callable]=…, on_shutdown: typing.Sequence[typing.Callable]=…, lifespan: typing.Callable[[Starlette], typi… - changed:
method Starlette.url_path_for(name: str, **path_params: str) -> URLPath → method Starlette.url_path_for(name: str, **path_params: typing.Any) -> URLPath
- changed:
constructor BackgroundTask(func: typing.Callable, *args: typing.Any, **kwargs: typing.Any) -> None → constructor BackgroundTask(func: typing.Callable[P, typing.Any], *args: P.args, **kwargs: P.kwargs) -> None - changed:
method BackgroundTasks.add_task(func: typing.Callable, *args: typing.Any, **kwargs: typing.Any) -> None → method BackgroundTasks.add_task(func: typing.Callable[P, typing.Any], *args: P.args, **kwargs: P.kwargs) -> None - added:
variable P
- changed:
async function iterate_in_threadpool(iterator: Iterator) -> AsyncGenerator → async function iterate_in_threadpool(iterator: typing.Iterator[T]) -> typing.AsyncIterator[T] - changed:
async function run_in_threadpool(func: typing.Callable[..., T], *args: typing.Any, **kwargs: typing.Any) -> T → async function run_in_threadpool(func: typing.Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T - added:
variable P
- changed:
async method UploadFile.read(size: int=…) -> typing.Union[bytes, str] → async method UploadFile.read(size: int=…) -> bytes - changed:
async method UploadFile.write(data: typing.Union[bytes, str]) -> None → async method UploadFile.write(data: bytes) -> None - changed:
constructor UploadFile(filename: str, file: typing.IO=…, content_type: str=…) -> None → constructor UploadFile(filename: str, file: typing.Optional[typing.BinaryIO]=…, content_type: str=…, *, headers: typing.Optional[Headers]=…) -> None - added:
field UploadFile.file: typing.BinaryIO - added:
field UploadFile.headers: Headers
- changed:
constructor ExceptionMiddleware(app: ASGIApp, handlers: dict=…, debug: bool=…) -> None → constructor ExceptionMiddleware(app: ASGIApp, handlers: typing.Mapping[typing.Any, typing.Callable[[Request, Exception], Response]]=…, debug: bool=…) -> None - changed:
method ExceptionMiddleware.add_exception_handler(exc_class_or_status_code: typing.Union[int, typing.Type[Exception]], handler: typing.Callable) -> None → method ExceptionMiddleware.add_exception_handler(exc_class_or_status_code: typing.Union[int, typing.Type[Exception]], handler: typing.Callable[[Request, Exception], Response]) -> None
- changed:
async function unattached_send(message: Message) -> None → async function unattached_send(message: Message) -> typing.NoReturn
- changed:
constructor SessionMiddleware(app: ASGIApp, secret_key: typing.Union[str, Secret], session_cookie: str=…, max_age: int=…, same_site: str=…, https_only: bool=…) -> None → constructor SessionMiddleware(app: ASGIApp, secret_key: typing.Union[str, Secret], session_cookie: str=…, max_age: typing.Optional[int]=…, same_site: str=…, https_only: bool=…) -> None
- changed:
async function empty_receive() -> Message → async function empty_receive() -> typing.NoReturn - changed:
async function empty_send(message: Message) -> None → async function empty_send(message: Message) -> typing.NoReturn
- changed:
method BaseRoute.url_path_for(name: str, **path_params: str) -> URLPath → method BaseRoute.url_path_for(name: str, **path_params: typing.Any) -> URLPath - changed:
method Host.url_path_for(name: str, **path_params: str) -> URLPath → method Host.url_path_for(name: str, **path_params: typing.Any) -> URLPath - changed:
method Mount.url_path_for(name: str, **path_params: str) -> URLPath → method Mount.url_path_for(name: str, **path_params: typing.Any) -> URLPath - changed:
method Route.url_path_for(name: str, **path_params: str) -> URLPath → method Route.url_path_for(name: str, **path_params: typing.Any) -> URLPath - changed:
method Router.url_path_for(name: str, **path_params: str) -> URLPath → method Router.url_path_for(name: str, **path_params: typing.Any) -> URLPath - changed:
method WebSocketRoute.url_path_for(name: str, **path_params: str) -> URLPath → method WebSocketRoute.url_path_for(name: str, **path_params: typing.Any) -> URLPath
- changed:
constructor StaticFiles(*, directory: PathLike=…, packages: typing.List[str]=…, html: bool=…, check_dir: bool=…) -> None → constructor StaticFiles(*, directory: PathLike=…, packages: typing.List[typing.Union[str, typing.Tuple[str, str]]]=…, html: bool=…, check_dir: bool=…) -> None - changed:
method StaticFiles.get_directories(directory: PathLike=…, packages: typing.List[str]=…) -> typing.List[PathLike] → method StaticFiles.get_directories(directory: PathLike=…, packages: typing.List[typing.Union[str, typing.Tuple[str, str]]]=…) -> typing.List[PathLike]
- changed:
constructor Jinja2Templates(directory: typing.Union[str, PathLike]) -> None → constructor Jinja2Templates(directory: typing.Union[str, PathLike], **env_options: typing.Any) -> None
- changed:
async method WebSocket.accept(subprotocol: str=…) -> None → async method WebSocket.accept(subprotocol: str=…, headers: typing.Iterable[typing.Tuple[bytes, bytes]]=…) -> None - changed:
async method WebSocket.close(code: int=…) -> None → async method WebSocket.close(code: int=…, reason: str=…) -> None - changed:
constructor WebSocketClose(code: int=…) -> None → constructor WebSocketClose(code: int=…, reason: str=…) -> None - changed:
constructor WebSocketDisconnect(code: int=…) -> None → constructor WebSocketDisconnect(code: int=…, reason: str=…) -> None