From 4d3ef06029fec473b2b185da55f6d355d052e1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 14 Jul 2024 12:46:40 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9E=96=20Remove=20orjson=20and=20ujson=20fro?= =?UTF-8?q?m=20default=20dependencies=20(#11842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++-- docs/en/docs/advanced/custom-response.md | 8 +++++++- docs/en/docs/index.md | 7 +++++-- pyproject.toml | 4 ---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ea722d57a..e344f97ad 100644 --- a/README.md +++ b/README.md @@ -468,12 +468,15 @@ Used by Starlette: Used by FastAPI / Starlette: * uvicorn - for the server that loads and serves your application. -* orjson - Required if you want to use `ORJSONResponse`. -* ujson - Required if you want to use `UJSONResponse`. * `fastapi-cli` - to provide the `fastapi` command. When you install `fastapi` it comes these standard dependencies. +Additional optional dependencies: + +* orjson - Required if you want to use `ORJSONResponse`. +* ujson - Required if you want to use `UJSONResponse`. + ## `fastapi-slim` If you don't want the extra standard optional dependencies, install `fastapi-slim` instead. diff --git a/docs/en/docs/advanced/custom-response.md b/docs/en/docs/advanced/custom-response.md index 45c7c7bd5..1d12173a1 100644 --- a/docs/en/docs/advanced/custom-response.md +++ b/docs/en/docs/advanced/custom-response.md @@ -39,7 +39,7 @@ But if you are certain that the content that you are returning is **serializable And it will be documented as such in OpenAPI. !!! tip - The `ORJSONResponse` is currently only available in FastAPI, not in Starlette. + The `ORJSONResponse` is only available in FastAPI, not in Starlette. ## HTML Response @@ -149,10 +149,16 @@ This is the default response used in **FastAPI**, as you read above. A fast alternative JSON response using `orjson`, as you read above. +!!! info + This requires installing `orjson` for example with `pip install orjson`. + ### `UJSONResponse` An alternative JSON response using `ujson`. +!!! info + This requires installing `ujson` for example with `pip install ujson`. + !!! warning `ujson` is less careful than Python's built-in implementation in how it handles some edge-cases. diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index 434c70893..8b54f175f 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -466,12 +466,15 @@ Used by Starlette: Used by FastAPI / Starlette: * uvicorn - for the server that loads and serves your application. -* orjson - Required if you want to use `ORJSONResponse`. -* ujson - Required if you want to use `UJSONResponse`. * `fastapi-cli` - to provide the `fastapi` command. When you install `fastapi` it comes these standard dependencies. +Additional optional dependencies: + +* orjson - Required if you want to use `ORJSONResponse`. +* ujson - Required if you want to use `UJSONResponse`. + ## `fastapi-slim` If you don't want the extra standard optional dependencies, install `fastapi-slim` instead. diff --git a/pyproject.toml b/pyproject.toml index a79845646..dbaa42149 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,10 +61,6 @@ standard = [ "jinja2 >=2.11.2", # For forms and file uploads "python-multipart >=0.0.7", - # For UJSONResponse - "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0", - # For ORJSONResponse - "orjson >=3.2.1", # To validate email fields "email_validator >=2.0.0", # Uvicorn with uvloop