Skip to content

Upgrading starlette 0.12 to 0.13

Unknown0.12.13 → 0.13.8Security1New4Changed3Fixed5

UnknownUpgrade verdict

DepDelta hasn't looked for the notes of 4 of 9 releases yet, so breaking changes can't be ruled out.

  • DepDelta hasn't finished looking for the notes in this range, so it can't rule out breaking changes yet.
  • Their commits are listed with this comparison.
1 item needs code or config changes
Security1
Makes the path-traversal check in the StaticFiles app more robust.
StaticFiles

Generated by DepDelta from published Python source. Not mixed with prose notes.

  • changed: constructor Starlette(debug: bool=…, routes: typing.List[BaseRoute]=…, middleware: typing.List[Middleware]=…, exception_handlers: typing.Dict[typing.Union[int, typing.Type[Exception]], typing.Callable]=…, on_startup: typing.List[typing.Callable]=…, on_shutdown: typing.List[typing.Callable]=…) -> None → 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.AsyncGenerator]=…) -> None
  • changed: method Starlette.add_middleware(middleware_class: type, **kwargs: typing.Any) -> None → method Starlette.add_middleware(middleware_class: type, **options: typing.Any) -> None
  • added: async function run_until_first_complete(*args: typing.Tuple[typing.Callable, dict]) -> None
  • changed: constructor Config(env_file: str=…, environ: typing.Mapping[str, str]=…) -> None → constructor Config(env_file: typing.Union[str, Path]=…, environ: typing.Mapping[str, str]=…) -> None
  • changed: method Config.get(key: str, cast: type=…, default: typing.Any=…) -> typing.Any → method Config.get(key: str, cast: typing.Callable=…, default: typing.Any=…) -> typing.Any
  • added: class UUIDConvertor(Convertor)
  • added: field UUIDConvertor.regex
  • added: method UUIDConvertor.convert(value: str) -> typing.Any
  • added: method UUIDConvertor.to_string(value: typing.Any) -> str
  • changed: field WebSocketEndpoint.encoding → field WebSocketEndpoint.encoding: typing.Optional[str]
  • changed: constructor Middleware(cls: type, options: dict=…, enabled: typing.Any=…) -> None → constructor Middleware(cls: type, **options: typing.Any) -> None
  • added: variable SAFELISTED_HEADERS
  • changed: method ServerErrorMiddleware.format_line(position: int, line: str, frame_lineno: int, center_lineno: int) -> str → method ServerErrorMiddleware.format_line(index: int, line: str, frame_lineno: int, frame_index: int) -> str
  • changed: method ServerErrorMiddleware.generate_frame_html(frame: inspect.FrameInfo, center_lineno: int, is_collapsed: bool) -> str → method ServerErrorMiddleware.generate_frame_html(frame: inspect.FrameInfo, is_collapsed: bool) -> str
  • added: function cookie_parser(cookie_string: str) -> typing.Dict[str, str]
  • changed: constructor FileResponse(path: str, status_code: int=…, headers: dict=…, media_type: str=…, background: BackgroundTask=…, filename: str=…, stat_result: os.stat_result=…, method: str=…) -> None → constructor FileResponse(path: typing.Union[str, os.PathLike[str]], status_code: int=…, headers: dict=…, media_type: str=…, background: BackgroundTask=…, filename: str=…, stat_result: os.stat_result=…, method: str=…) -> None
  • changed: constructor RedirectResponse(url: typing.Union[str, URL], status_code: int=…, headers: dict=…) -> None → constructor RedirectResponse(url: typing.Union[str, URL], status_code: int=…, headers: dict=…, background: BackgroundTask=…) -> None
  • changed: method Response.set_cookie(key: str, value: str=…, max_age: int=…, expires: int=…, path: str=…, domain: str=…, secure: bool=…, httponly: bool=…) -> None → method Response.set_cookie(key: str, value: str=…, max_age: int=…, expires: int=…, path: str=…, domain: str=…, secure: bool=…, httponly: bool=…, samesite: str=…) -> None
  • added: async method StreamingResponse.listen_for_disconnect(receive: Receive) -> None
  • added: async method StreamingResponse.stream_response(send: Send) -> None
  • added: function guess_type(url: typing.Union[str, os.PathLike[str]], strict: bool=…) -> typing.Tuple[typing.Optional[str], typing.Optional[str]]
  • removed: async method Lifespan.shutdown() -> None
  • removed: async method Lifespan.startup() -> None
  • removed: class Lifespan(BaseRoute)
  • removed: constructor Lifespan(on_startup: typing.Union[typing.Callable, typing.List[typing.Callable]]=…, on_shutdown: typing.Union[typing.Callable, typing.List[typing.Callable]]=…)
  • removed: method Lifespan.add_event_handler(event_type: str, func: typing.Callable) -> None
  • removed: method Lifespan.matches(scope: Scope) -> typing.Tuple[Match, Scope]
  • removed: method Lifespan.on_event(event_type: str) -> typing.Callable
  • removed: method Lifespan.to_list(item: typing.Union[typing.Callable, typing.List[typing.Callable]]=…) -> typing.List[typing.Callable]
  • changed: constructor Mount(path: str, app: ASGIApp=…, routes: typing.List[BaseRoute]=…, name: str=…) -> None → constructor Mount(path: str, app: ASGIApp=…, routes: typing.Sequence[BaseRoute]=…, name: str=…) -> None
  • changed: constructor Router(routes: typing.List[BaseRoute]=…, redirect_slashes: bool=…, default: ASGIApp=…, on_startup: typing.List[typing.Callable]=…, on_shutdown: typing.List[typing.Callable]=…) -> None → constructor Router(routes: typing.Sequence[BaseRoute]=…, redirect_slashes: bool=…, default: ASGIApp=…, on_startup: typing.Sequence[typing.Callable]=…, on_shutdown: typing.Sequence[typing.Callable]=…, lifespan: typing.Callable[[typing.Any], typing.AsyncGenerator]=…) -> None
  • added: async method BaseRoute.handle(scope: Scope, receive: Receive, send: Send) -> None
  • added: async method Host.handle(scope: Scope, receive: Receive, send: Send) -> None
  • added: async method Mount.handle(scope: Scope, receive: Receive, send: Send) -> None
  • added: async method Route.handle(scope: Scope, receive: Receive, send: Send) -> None
  • added: async method Router.lifespan(scope: Scope, receive: Receive, send: Send) -> None
  • added: async method Router.shutdown() -> None
  • added: async method Router.startup() -> None
  • added: async method WebSocketRoute.handle(scope: Scope, receive: Receive, send: Send) -> None
  • added: method Router.add_event_handler(event_type: str, func: typing.Callable) -> None
  • added: method Router.on_event(event_type: str) -> typing.Callable
  • changed: constructor StaticFiles(*, directory: str=…, packages: typing.List[str]=…, html: bool=…, check_dir: bool=…) -> None → constructor StaticFiles(*, directory: PathLike=…, packages: typing.List[str]=…, html: bool=…, check_dir: bool=…) -> None
  • changed: method StaticFiles.file_response(full_path: str, stat_result: os.stat_result, scope: Scope, status_code: int=…) -> Response → method StaticFiles.file_response(full_path: PathLike, stat_result: os.stat_result, scope: Scope, status_code: int=…) -> Response
  • changed: method StaticFiles.get_directories(directory: str=…, packages: typing.List[str]=…) -> typing.List[str] → method StaticFiles.get_directories(directory: PathLike=…, packages: typing.List[str]=…) -> typing.List[PathLike]
  • added: variable PathLike
  • added: async method WebSocket.iter_bytes() -> typing.AsyncIterator[bytes]
  • added: async method WebSocket.iter_json() -> typing.AsyncIterator[typing.Any]
  • added: async method WebSocket.iter_text() -> typing.AsyncIterator[str]