You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
FastAPI is integrated quite closely with starlette, and unfortunately starlette doesn't use semantic versioning, so it's easy for a breaking starlette change to break FastAPI. The latest version of starlette does this, for example
If Starlette released a change that FastAPI did not support and you did not pin the version every install would break and cause everyone to have to pin starlette which is not desirable.
Generally in library(which fastapi is) code you should pin your dependencies, or use a lock file to ensure that the library is getting a version of its dependencies that it is known to support. For a library having known working code for a specific version is more important than features.
I guess as long as both FastAPI and Starlette are in the 0.x.x series, we just have to live with that.
P.S. I kinda wish that FastAPI at least would graduate, because SemVer has a gotcha for 0.x.x that most devs are not aware of. At least I was not and my peers were not.
fix/upgrade dependencies
upgrades python version to 3.10.5
upgrades dependencies to their latest versions
this is needed because of pinned httpx version is outdated and TestClient breaks starlette and FastAPI
references
encode/starlette#1376tiangolo/fastapi#5471tiangolo/fastapi#5749
First Check
Commit to Help
Example Code
Description
FastAPI re-exports starlette
TestClient
which seems to be anhttpx.Client
connected to the asgi app under test.starlette has recently fixed the
TestClient.__init__
to followhttpx.Client.__init__
so that the earlier acceptsheaders=...
kwarg, just like the latter.encode/starlette#1966
starlette has made a release
0.23.0
, but the latest FastAPI pins a specific versionstarlette==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
The text was updated successfully, but these errors were encountered: