Skip to content

Does FastAPI have to pin starlette? #5749

@dimaqq

Description

@dimaqq

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

from fastapi.testclient import TestClient

TestClient(app, headers={...})

Description

FastAPI re-exports starlette TestClient which seems to be an httpx.Client connected to the asgi app under test.

starlette has recently fixed the TestClient.__init__ to follow httpx.Client.__init__ so that the earlier accepts headers=... kwarg, just like the latter.

Kludex/starlette#1966

starlette has made a release 0.23.0, but the latest FastAPI pins a specific version starlette==0.22.0

Thus, as a dev, I can't use the latest "features" or more like reasonable expectations for the TestClient.

A newcomer would read the docs / source code and would expect TestClient to accept headers kwarg and get confused why that's rejected.

Thus, the question: is there a reason to pin a specific version of starlette?

Operating System

Other

Operating System Details

An issue with any OS.

FastAPI Version

0.88.0

Python Version

3.10, etc.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions