Blob Blame History Raw
From e5c934369bf8f47360ab31e3331f75ac386ec5db Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Wed, 26 Jan 2022 17:25:51 +0100
Subject: [PATCH 01/17] Bump starlette from 0.17.1 to 0.18.0

---
 fastapi/dependencies/utils.py | 11 ++++-------
 pyproject.toml                |  2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py
index d4028d067b..d0a4040ef7 100644
--- a/fastapi/dependencies/utils.py
+++ b/fastapi/dependencies/utils.py
@@ -462,13 +462,10 @@ async def solve_dependencies(
 ]:
     values: Dict[str, Any] = {}
     errors: List[ErrorWrapper] = []
-    response = response or Response(
-        content=None,
-        status_code=None,  # type: ignore
-        headers=None,  # type: ignore # in Starlette
-        media_type=None,  # type: ignore # in Starlette
-        background=None,  # type: ignore # in Starlette
-    )
+    if response is None:
+        response = Response()
+        del response.headers["content-length"]
+        response.status_code = None
     dependency_cache = dependency_cache or {}
     sub_dependant: Dependant
     for sub_dependant in dependant.dependencies:
diff --git a/pyproject.toml b/pyproject.toml
index 77c01322fe..867f545acd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 requires = [
-    "starlette ==0.17.1",
+    "starlette ==0.18.0",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 description-file = "README.md"

From 8d10fcabb93d201d57f376350e4a12ac8feaaf5a Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Wed, 26 Jan 2022 17:34:44 +0100
Subject: [PATCH 02/17] Fix linter

---
 fastapi/dependencies/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py
index d0a4040ef7..9dccd354ef 100644
--- a/fastapi/dependencies/utils.py
+++ b/fastapi/dependencies/utils.py
@@ -465,7 +465,7 @@ async def solve_dependencies(
     if response is None:
         response = Response()
         del response.headers["content-length"]
-        response.status_code = None
+        response.status_code = None  # type: ignore
     dependency_cache = dependency_cache or {}
     sub_dependant: Dependant
     for sub_dependant in dependant.dependencies:

From 7331e081679b1feba82aa848965baa6b8dcf85ac Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Wed, 26 Jan 2022 17:48:50 +0100
Subject: [PATCH 03/17] Fix mypy

---
 fastapi/concurrency.py | 4 ++--
 fastapi/routing.py     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fastapi/concurrency.py b/fastapi/concurrency.py
index 04382c69e4..11732dd063 100644
--- a/fastapi/concurrency.py
+++ b/fastapi/concurrency.py
@@ -1,5 +1,5 @@
 import sys
-from typing import AsyncGenerator, ContextManager, TypeVar
+from typing import AsyncGenerator, ContextManager, Optional, TypeVar
 
 from starlette.concurrency import iterate_in_threadpool as iterate_in_threadpool  # noqa
 from starlette.concurrency import run_in_threadpool as run_in_threadpool  # noqa
@@ -25,7 +25,7 @@ async def contextmanager_in_threadpool(
     try:
         yield await run_in_threadpool(cm.__enter__)
     except Exception as e:
-        ok = await run_in_threadpool(cm.__exit__, type(e), e, None)
+        ok: bool = await run_in_threadpool(cm.__exit__, type(e), e, None)
         if not ok:
             raise e
     else:
diff --git a/fastapi/routing.py b/fastapi/routing.py
index f6d5370d6a..1f5cab9c41 100644
--- a/fastapi/routing.py
+++ b/fastapi/routing.py
@@ -126,7 +126,7 @@ async def serialize_response(
         if is_coroutine:
             value, errors_ = field.validate(response_content, {}, loc=("response",))
         else:
-            value, errors_ = await run_in_threadpool(
+            value, errors_ = await run_in_threadpool(  # type: ignore[misc]
                 field.validate, response_content, {}, loc=("response",)
             )
         if isinstance(errors_, ErrorWrapper):

From fb2fdf5d17afb2cd436594cc7e1c5d924b7ab5a9 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Wed, 26 Jan 2022 17:50:14 +0100
Subject: [PATCH 04/17] Remove unused Optional import

---
 fastapi/concurrency.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fastapi/concurrency.py b/fastapi/concurrency.py
index 11732dd063..becac3f33d 100644
--- a/fastapi/concurrency.py
+++ b/fastapi/concurrency.py
@@ -1,5 +1,5 @@
 import sys
-from typing import AsyncGenerator, ContextManager, Optional, TypeVar
+from typing import AsyncGenerator, ContextManager, TypeVar
 
 from starlette.concurrency import iterate_in_threadpool as iterate_in_threadpool  # noqa
 from starlette.concurrency import run_in_threadpool as run_in_threadpool  # noqa

From c096ac6e58c72331d6d2218f83dd8bd978d0b1fb Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:22:54 +0100
Subject: [PATCH 05/17] Bump starlette from 0.18.0 to 0.19.0

---
 tests/test_extra_routes.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/test_extra_routes.py b/tests/test_extra_routes.py
index 6aba3e8dda..7b824f8874 100644
--- a/tests/test_extra_routes.py
+++ b/tests/test_extra_routes.py
@@ -32,12 +32,12 @@ def delete_item(item_id: str, item: Item):
 
 @app.head("/items/{item_id}")
 def head_item(item_id: str):
-    return JSONResponse(headers={"x-fastapi-item-id": item_id})
+    return JSONResponse(None, headers={"x-fastapi-item-id": item_id})
 
 
 @app.options("/items/{item_id}")
 def options_item(item_id: str):
-    return JSONResponse(headers={"x-fastapi-item-id": item_id})
+    return JSONResponse(None, headers={"x-fastapi-item-id": item_id})
 
 
 @app.patch("/items/{item_id}")
@@ -47,7 +47,7 @@ def patch_item(item_id: str, item: Item):
 
 @app.trace("/items/{item_id}")
 def trace_item(item_id: str):
-    return JSONResponse(media_type="message/http")
+    return JSONResponse(None, media_type="message/http")
 
 
 client = TestClient(app)

From a96de7f0cfb437227fdfc257665192edf0a1b667 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:23:58 +0100
Subject: [PATCH 06/17] Add starlette master branch

---
 pyproject.toml | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 867f545acd..23dc7dc1f9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 requires = [
-    "starlette ==0.18.0",
+    "starlette @ git+ssh://git@github.com/encode/starlette@master#egg=starlette",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 description-file = "README.md"
@@ -75,7 +75,7 @@ doc = [
     "mdx-include >=1.4.1,<2.0.0",
     "mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0",
     "typer-cli >=0.0.12,<0.0.13",
-    "pyyaml >=5.3.1,<6.0.0"
+    "pyyaml >=5.3.1,<6.0.0",
 ]
 dev = [
     "python-jose[cryptography] >=3.3.0,<4.0.0",
@@ -128,10 +128,7 @@ ignore_missing_imports = true
 check_untyped_defs = true
 
 [tool.pytest.ini_options]
-addopts = [
-  "--strict-config",
-  "--strict-markers",
-]
+addopts = ["--strict-config", "--strict-markers"]
 xfail_strict = true
 junit_family = "xunit2"
 filterwarnings = [

From cc64170f3ff2e20d9c3ece7f1ff057d3c7138860 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:25:31 +0100
Subject: [PATCH 07/17] Undo some changes

---
 pyproject.toml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 23dc7dc1f9..11bca9a624 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -128,7 +128,10 @@ ignore_missing_imports = true
 check_untyped_defs = true
 
 [tool.pytest.ini_options]
-addopts = ["--strict-config", "--strict-markers"]
+addopts = [
+    "--strict-config",
+    "--strict-markers"
+]
 xfail_strict = true
 junit_family = "xunit2"
 filterwarnings = [

From 03b0d4cbb1e0fd1cdd17bd643735a3cde1c87138 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:27:10 +0100
Subject: [PATCH 08/17] Add version on egg

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 11bca9a624..7bc0799a1b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 requires = [
-    "starlette @ git+ssh://git@github.com/encode/starlette@master#egg=starlette",
+    "starlette @ git+ssh://git@github.com/encode/starlette@master#egg=starlette-0.18.0",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 description-file = "README.md"

From facb6d8e25e4422fb97bb46f1dc911d90f3a64b7 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:29:25 +0100
Subject: [PATCH 09/17] Try with only link

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 7bc0799a1b..bf84faa26e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 requires = [
-    "starlette @ git+ssh://git@github.com/encode/starlette@master#egg=starlette-0.18.0",
+    "git+https://github.com/encode/starlette.git#master",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 description-file = "README.md"

From a659c2b9920fba1555ed6d41b8939d57f39f9d83 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:31:08 +0100
Subject: [PATCH 10/17] Add starlette back

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index bf84faa26e..eb2f17c4c4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@ classifiers = [
     "Topic :: Internet :: WWW/HTTP",
 ]
 requires = [
-    "git+https://github.com/encode/starlette.git#master",
+    "starlette @ git+https://github.com/encode/starlette.git#master",
     "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
 ]
 description-file = "README.md"

From 4305a0c5f9bcd1ece36ed858960326bb06d0627a Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:33:01 +0100
Subject: [PATCH 11/17] Remove HTTPException

---
 fastapi/exceptions.py | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py
index f4a837bb4e..0cc8efceba 100644
--- a/fastapi/exceptions.py
+++ b/fastapi/exceptions.py
@@ -1,20 +1,8 @@
-from typing import Any, Dict, Optional, Sequence, Type
+from typing import Any, Sequence, Type
 
 from pydantic import BaseModel, ValidationError, create_model
 from pydantic.error_wrappers import ErrorList
-from starlette.exceptions import HTTPException as StarletteHTTPException
-
-
-class HTTPException(StarletteHTTPException):
-    def __init__(
-        self,
-        status_code: int,
-        detail: Any = None,
-        headers: Optional[Dict[str, Any]] = None,
-    ) -> None:
-        super().__init__(status_code=status_code, detail=detail)
-        self.headers = headers
-
+from starlette.exceptions import HTTPException as HTTPException
 
 RequestErrorModel: Type[BaseModel] = create_model("Request")
 WebSocketErrorModel: Type[BaseModel] = create_model("WebSocket")

From b19e84832c95928870a2459e451bf4e2d39f4c64 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Thu, 27 Jan 2022 20:35:26 +0100
Subject: [PATCH 12/17] Add noqa on reimport

---
 fastapi/exceptions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py
index 0cc8efceba..628c2b742c 100644
--- a/fastapi/exceptions.py
+++ b/fastapi/exceptions.py
@@ -2,7 +2,7 @@
 
 from pydantic import BaseModel, ValidationError, create_model
 from pydantic.error_wrappers import ErrorList
-from starlette.exceptions import HTTPException as HTTPException
+from starlette.exceptions import HTTPException as HTTPException  # noqa
 
 RequestErrorModel: Type[BaseModel] = create_model("Request")
 WebSocketErrorModel: Type[BaseModel] = create_model("WebSocket")

From 09c70c43c79cc4820f4359f58c7ad68d2cad797d Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Sun, 30 Jan 2022 17:13:56 +0100
Subject: [PATCH 14/17] Update pyproject.toml

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index eb2f17c4c4..b1f6004f05 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -75,7 +75,7 @@ doc = [
     "mdx-include >=1.4.1,<2.0.0",
     "mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0",
     "typer-cli >=0.0.12,<0.0.13",
-    "pyyaml >=5.3.1,<6.0.0",
+    "pyyaml >=5.3.1,<6.0.0"
 ]
 dev = [
     "python-jose[cryptography] >=3.3.0,<4.0.0",

From 880dd0d2192b8677b274a3ccc6823c76380ad54c Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Tue, 1 Feb 2022 00:31:23 +0100
Subject: [PATCH 15/17] Update pyproject.toml

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index b1f6004f05..357338d476 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -129,7 +129,7 @@ check_untyped_defs = true
 
 [tool.pytest.ini_options]
 addopts = [
-    "--strict-config",
+  "--strict-config",
     "--strict-markers"
 ]
 xfail_strict = true

From c48a3993572fea39da012e8b5cf9e166a2364645 Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Tue, 1 Feb 2022 15:46:19 +0100
Subject: [PATCH 16/17] Update pyproject.toml

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 357338d476..f513254be7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -130,7 +130,7 @@ check_untyped_defs = true
 [tool.pytest.ini_options]
 addopts = [
   "--strict-config",
-    "--strict-markers"
+  "--strict-markers"
 ]
 xfail_strict = true
 junit_family = "xunit2"

From 7b519b80bf35aba73a39326b82d1b8be8ae45beb Mon Sep 17 00:00:00 2001
From: Marcelo Trylesinski <marcelotryle@gmail.com>
Date: Wed, 2 Feb 2022 00:03:09 +0100
Subject: [PATCH 17/17] Update pyproject.toml

---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index f513254be7..e10b424b67 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -130,7 +130,7 @@ check_untyped_defs = true
 [tool.pytest.ini_options]
 addopts = [
   "--strict-config",
-  "--strict-markers"
+  "--strict-markers",
 ]
 xfail_strict = true
 junit_family = "xunit2"