Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Starlette to 0.21.0, including the new [TestClient based on HTTPX](https://github.com/encode/starlette/releases/tag/0.21.0) #5471

Merged
merged 2 commits into from Nov 13, 2022

Conversation

pawelrubin
Copy link
Contributor

@pawelrubin pawelrubin commented Oct 7, 2022

This PR updates the starlette version to the latest 0.21.0 release.

The latest starlette release comes with some breaking changes to the TestClient as mentioned in the release notes:

This release replaces the underlying HTTP client used on the TestClient (requests ➡️ httpx), and as those clients differ a bit on their API, your test suite will likely break. To make the migration smoother, you can use the bump-testclient tool.

I've used the bump-testclient tool and fixed other issues myself.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit b5a22a2 at: https://633ff3b942952d32ba54f470--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 3f447ff at: https://633ff566f692d72eb442e9b1--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit a682e85 at: https://633ff7ce2ec6962f37f8e7db--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 431f420 at: https://633ff94a4c600e2842d094a0--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit b4f7e87 at: https://633ffbea31944f35e7bcf770--fastapi.netlify.app

@pawelrubin pawelrubin force-pushed the update-starlette branch 2 times, most recently from 07d5cda to 359684e Compare October 7, 2022 10:18
@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (982e7ca) compared to base (cf73051).
Patch coverage: 100.00% of modified lines in pull request are covered.

Current head 982e7ca differs from pull request most recent head ce5b5f7. Consider uploading reports for the commit ce5b5f7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5471   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          540       540           
  Lines        13969     13958   -11     
=========================================
- Hits         13969     13958   -11     
Impacted Files Coverage Δ
fastapi/security/api_key.py 100.00% <100.00%> (ø)
fastapi/security/http.py 100.00% <100.00%> (ø)
fastapi/security/oauth2.py 100.00% <100.00%> (ø)
fastapi/security/open_id_connect_url.py 100.00% <100.00%> (ø)
fastapi/security/utils.py 100.00% <100.00%> (ø)
tests/test_enforce_once_required_parameter.py 100.00% <100.00%> (ø)
tests/test_extra_routes.py 100.00% <100.00%> (ø)
tests/test_get_request_body.py 100.00% <100.00%> (ø)
tests/test_param_include_in_schema.py 100.00% <100.00%> (ø)
tests/test_security_api_key_cookie.py 100.00% <100.00%> (ø)
... and 17 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 359684e at: https://633ffde84e2f313c833a0d36--fastapi.netlify.app

yezz123
yezz123 approved these changes Oct 7, 2022
Copy link

@yezz123 yezz123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks compatible with the changes in Starlette 🚀

pyproject.toml Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 7607ea7 at: https://63401cb41ade06008e6c0692--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 01c4960 at: https://63401dc0f8e580024f94ca9d--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit cf84079 at: https://634020f91ade0602a76c06ab--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit 5d8a327 at: https://634022871fbcbd077dc05162--fastapi.netlify.app

Copy link
Sponsor Contributor

@Kludex Kludex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiangolo You have the release notes, but remember that WebSocketException is included in this version. I guess you'd like to document that. 👀

pyproject.toml Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

📝 Docs preview for commit b0ec5cf at: https://634053cd241aac22df3cf2c9--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit e0a4aa9 at: https://6346755ac01af03a63982f2c--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 982e7ca at: https://63526d604b095122142240ab--fastapi.netlify.app

@pawelrubin
Copy link
Contributor Author

Hi @tiangolo, could you have a look at this PR? 🙏🏻

pyproject.toml Outdated Show resolved Hide resolved
@pawelrubin pawelrubin force-pushed the update-starlette branch 2 times, most recently from 54ca46f to 68fad0b Compare November 1, 2022 08:26
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

📝 Docs preview for commit 68fad0b at: https://6360d932a824d00074759e57--fastapi.netlify.app

- Adapt tests suite after breaking changes to the starlette's TestClient
- Fix issues found by mypy caused by more precise type annotations in starlette
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2022

📝 Docs preview for commit 175022a at: https://6364ac09c42e4e5066030b85--fastapi.netlify.app

@thomasleveil
Copy link

Since This release replaces the underlying HTTP client used on the TestClient (requests arrow_right httpx), should this be considered introducing breaking changes ?

@pawelrubin
Copy link
Contributor Author

pawelrubin commented Nov 4, 2022

@thomasleveil Yes, it does introduce a breaking change, but only to the TestClient. Assuming that the TestClient is not used in any application code, this change will break only the test suites, which shouldn't be a big deal.

Whether such a breaking change should result in a new major or minor version is up to @tiangolo I guess.

@Kludex
Copy link
Sponsor Contributor

Kludex commented Nov 4, 2022

It's going to be a minor.

@tiangolo tiangolo changed the title Update starlette to 0.21.0. Upgrade Starlette to 0.21.0, including the new [TestClient based on HTTPX](https://github.com/encode/starlette/releases/tag/0.21.0) Nov 13, 2022
@tiangolo
Copy link
Owner

Amazing, great job @pawelrubin, thanks! 🍰

And thanks for the help and comments everyone! 🤓

I just fixed a couple of tests and it's now ready. It will be available in the next version 0.87.0, released in the next hours. 🎉

@tiangolo tiangolo merged commit fdbd48b into tiangolo:master Nov 13, 2022
9 checks passed
diegoquintanav added a commit to diegoquintanav/datadis that referenced this pull request Jan 9, 2023
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#1376
tiangolo/fastapi#5471
tiangolo/fastapi#5749
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants