You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

548 lines
24 KiB

  1. Metadata-Version: 2.1
  2. Name: fastapi
  3. Version: 0.71.0
  4. Summary: FastAPI framework, high performance, easy to learn, fast to code, ready for production
  5. Home-page: https://github.com/tiangolo/fastapi
  6. Author: Sebastián Ramírez
  7. Author-email: tiangolo@gmail.com
  8. Requires-Python: >=3.6.1
  9. Description-Content-Type: text/markdown
  10. Classifier: Intended Audience :: Information Technology
  11. Classifier: Intended Audience :: System Administrators
  12. Classifier: Operating System :: OS Independent
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: Programming Language :: Python
  15. Classifier: Topic :: Internet
  16. Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
  17. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  18. Classifier: Topic :: Software Development :: Libraries
  19. Classifier: Topic :: Software Development
  20. Classifier: Typing :: Typed
  21. Classifier: Development Status :: 4 - Beta
  22. Classifier: Environment :: Web Environment
  23. Classifier: Framework :: AsyncIO
  24. Classifier: Framework :: FastAPI
  25. Classifier: Intended Audience :: Developers
  26. Classifier: License :: OSI Approved :: MIT License
  27. Classifier: Programming Language :: Python :: 3 :: Only
  28. Classifier: Programming Language :: Python :: 3.6
  29. Classifier: Programming Language :: Python :: 3.7
  30. Classifier: Programming Language :: Python :: 3.8
  31. Classifier: Programming Language :: Python :: 3.9
  32. Classifier: Programming Language :: Python :: 3.10
  33. Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
  34. Classifier: Topic :: Internet :: WWW/HTTP
  35. Requires-Dist: starlette ==0.17.1
  36. Requires-Dist: pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0
  37. Requires-Dist: requests >=2.24.0,<3.0.0 ; extra == "all"
  38. Requires-Dist: jinja2 >=2.11.2,<4.0.0 ; extra == "all"
  39. Requires-Dist: python-multipart >=0.0.5,<0.0.6 ; extra == "all"
  40. Requires-Dist: itsdangerous >=1.1.0,<3.0.0 ; extra == "all"
  41. Requires-Dist: pyyaml >=5.3.1,<6.0.0 ; extra == "all"
  42. Requires-Dist: ujson >=4.0.1,<5.0.0 ; extra == "all"
  43. Requires-Dist: orjson >=3.2.1,<4.0.0 ; extra == "all"
  44. Requires-Dist: email_validator >=1.1.1,<2.0.0 ; extra == "all"
  45. Requires-Dist: uvicorn[standard] >=0.12.0,<0.16.0 ; extra == "all"
  46. Requires-Dist: python-jose[cryptography] >=3.3.0,<4.0.0 ; extra == "dev"
  47. Requires-Dist: passlib[bcrypt] >=1.7.2,<2.0.0 ; extra == "dev"
  48. Requires-Dist: autoflake >=1.4.0,<2.0.0 ; extra == "dev"
  49. Requires-Dist: flake8 >=3.8.3,<4.0.0 ; extra == "dev"
  50. Requires-Dist: uvicorn[standard] >=0.12.0,<0.16.0 ; extra == "dev"
  51. Requires-Dist: mkdocs >=1.1.2,<2.0.0 ; extra == "doc"
  52. Requires-Dist: mkdocs-material >=8.1.4,<9.0.0 ; extra == "doc"
  53. Requires-Dist: mdx-include >=1.4.1,<2.0.0 ; extra == "doc"
  54. Requires-Dist: mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0 ; extra == "doc"
  55. Requires-Dist: typer-cli >=0.0.12,<0.0.13 ; extra == "doc"
  56. Requires-Dist: pyyaml >=5.3.1,<6.0.0 ; extra == "doc"
  57. Requires-Dist: pytest >=6.2.4,<7.0.0 ; extra == "test"
  58. Requires-Dist: pytest-cov >=2.12.0,<4.0.0 ; extra == "test"
  59. Requires-Dist: mypy ==0.910 ; extra == "test"
  60. Requires-Dist: flake8 >=3.8.3,<4.0.0 ; extra == "test"
  61. Requires-Dist: black ==21.9b0 ; extra == "test"
  62. Requires-Dist: isort >=5.0.6,<6.0.0 ; extra == "test"
  63. Requires-Dist: requests >=2.24.0,<3.0.0 ; extra == "test"
  64. Requires-Dist: httpx >=0.14.0,<0.19.0 ; extra == "test"
  65. Requires-Dist: email_validator >=1.1.1,<2.0.0 ; extra == "test"
  66. Requires-Dist: sqlalchemy >=1.3.18,<1.5.0 ; extra == "test"
  67. Requires-Dist: peewee >=3.13.3,<4.0.0 ; extra == "test"
  68. Requires-Dist: databases[sqlite] >=0.3.2,<0.6.0 ; extra == "test"
  69. Requires-Dist: orjson >=3.2.1,<4.0.0 ; extra == "test"
  70. Requires-Dist: ujson >=4.0.1,<5.0.0 ; extra == "test"
  71. Requires-Dist: python-multipart >=0.0.5,<0.0.6 ; extra == "test"
  72. Requires-Dist: flask >=1.1.2,<3.0.0 ; extra == "test"
  73. Requires-Dist: anyio[trio] >=3.2.1,<4.0.0 ; extra == "test"
  74. Requires-Dist: types-ujson ==0.1.1 ; extra == "test"
  75. Requires-Dist: types-orjson ==3.6.0 ; extra == "test"
  76. Requires-Dist: types-dataclasses ==0.1.7 ; extra == "test" and ( python_version<'3.7')
  77. Project-URL: Documentation, https://fastapi.tiangolo.com/
  78. Provides-Extra: all
  79. Provides-Extra: dev
  80. Provides-Extra: doc
  81. Provides-Extra: test
  82. <p align="center">
  83. <a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a>
  84. </p>
  85. <p align="center">
  86. <em>FastAPI framework, high performance, easy to learn, fast to code, ready for production</em>
  87. </p>
  88. <p align="center">
  89. <a href="https://github.com/tiangolo/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
  90. <img src="https://github.com/tiangolo/fastapi/workflows/Test/badge.svg?event=push&branch=master" alt="Test">
  91. </a>
  92. <a href="https://codecov.io/gh/tiangolo/fastapi" target="_blank">
  93. <img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
  94. </a>
  95. <a href="https://pypi.org/project/fastapi" target="_blank">
  96. <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
  97. </a>
  98. <a href="https://pypi.org/project/fastapi" target="_blank">
  99. <img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions">
  100. </a>
  101. </p>
  102. ---
  103. **Documentation**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a>
  104. **Source Code**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
  105. ---
  106. FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
  107. The key features are:
  108. * **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
  109. * **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
  110. * **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
  111. * **Intuitive**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging.
  112. * **Easy**: Designed to be easy to use and learn. Less time reading docs.
  113. * **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
  114. * **Robust**: Get production-ready code. With automatic interactive documentation.
  115. * **Standards-based**: Based on (and fully compatible with) the open standards for APIs: <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (previously known as Swagger) and <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>.
  116. <small>* estimation based on tests on an internal development team, building production applications.</small>
  117. ## Sponsors
  118. <!-- sponsors -->
  119. <a href="https://bit.ly/2QSouzH" target="_blank" title="Jina: build neural search-as-a-service for any kind of data in just minutes."><img src="https://fastapi.tiangolo.com/img/sponsors/jina.svg"></a>
  120. <a href="https://cryptapi.io/" target="_blank" title="CryptAPI: Your easy to use, secure and privacy oriented payment gateway."><img src="https://fastapi.tiangolo.com/img/sponsors/cryptapi.svg"></a>
  121. <a href="https://www.deta.sh/?ref=fastapi" target="_blank" title="The launchpad for all your (team's) ideas"><img src="https://fastapi.tiangolo.com/img/sponsors/deta.svg"></a>
  122. <a href="https://www.investsuite.com/jobs" target="_blank" title="Wealthtech jobs with FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/investsuite.svg"></a>
  123. <a href="https://www.vim.so/?utm_source=FastAPI" target="_blank" title="We help you master vim with interactive exercises"><img src="https://fastapi.tiangolo.com/img/sponsors/vimso.png"></a>
  124. <a href="https://talkpython.fm/fastapi-sponsor" target="_blank" title="FastAPI video courses on demand from people you trust"><img src="https://fastapi.tiangolo.com/img/sponsors/talkpython.png"></a>
  125. <a href="https://testdriven.io/courses/tdd-fastapi/" target="_blank" title="Learn to build high-quality web apps with best practices"><img src="https://fastapi.tiangolo.com/img/sponsors/testdriven.svg"></a>
  126. <a href="https://github.com/deepset-ai/haystack/" target="_blank" title="Build powerful search from composable, open source building blocks"><img src="https://fastapi.tiangolo.com/img/sponsors/haystack-fastapi.svg"></a>
  127. <!-- /sponsors -->
  128. <a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
  129. ## Opinions
  130. "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
  131. <div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
  132. ---
  133. "_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
  134. <div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div>
  135. ---
  136. "_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
  137. <div style="text-align: right; margin-right: 10%;">Kevin Glisson, Marc Vilanova, Forest Monsen - <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072" target="_blank"><small>(ref)</small></a></div>
  138. ---
  139. "_I’m over the moon excited about **FastAPI**. It’s so fun!_"
  140. <div style="text-align: right; margin-right: 10%;">Brian Okken - <strong><a href="https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855" target="_blank">Python Bytes</a> podcast host</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div>
  141. ---
  142. "_Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted **Hug** to be - it's really inspiring to see someone build that._"
  143. <div style="text-align: right; margin-right: 10%;">Timothy Crosley - <strong><a href="https://www.hug.rest/" target="_blank">Hug</a> creator</strong> <a href="https://news.ycombinator.com/item?id=19455465" target="_blank"><small>(ref)</small></a></div>
  144. ---
  145. "_If you're looking to learn one **modern framework** for building REST APIs, check out **FastAPI** [...] It's fast, easy to use and easy to learn [...]_"
  146. "_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
  147. <div style="text-align: right; margin-right: 10%;">Ines Montani - Matthew Honnibal - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> founders - <a href="https://spacy.io" target="_blank">spaCy</a> creators</strong> <a href="https://twitter.com/_inesmontani/status/1144173225322143744" target="_blank"><small>(ref)</small></a> - <a href="https://twitter.com/honnibal/status/1144031421859655680" target="_blank"><small>(ref)</small></a></div>
  148. ---
  149. ## **Typer**, the FastAPI of CLIs
  150. <a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a>
  151. If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>.
  152. **Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
  153. ## Requirements
  154. Python 3.6+
  155. FastAPI stands on the shoulders of giants:
  156. * <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
  157. * <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
  158. ## Installation
  159. <div class="termy">
  160. ```console
  161. $ pip install fastapi
  162. ---> 100%
  163. ```
  164. </div>
  165. You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
  166. <div class="termy">
  167. ```console
  168. $ pip install "uvicorn[standard]"
  169. ---> 100%
  170. ```
  171. </div>
  172. ## Example
  173. ### Create it
  174. * Create a file `main.py` with:
  175. ```Python
  176. from typing import Optional
  177. from fastapi import FastAPI
  178. app = FastAPI()
  179. @app.get("/")
  180. def read_root():
  181. return {"Hello": "World"}
  182. @app.get("/items/{item_id}")
  183. def read_item(item_id: int, q: Optional[str] = None):
  184. return {"item_id": item_id, "q": q}
  185. ```
  186. <details markdown="1">
  187. <summary>Or use <code>async def</code>...</summary>
  188. If your code uses `async` / `await`, use `async def`:
  189. ```Python hl_lines="9 14"
  190. from typing import Optional
  191. from fastapi import FastAPI
  192. app = FastAPI()
  193. @app.get("/")
  194. async def read_root():
  195. return {"Hello": "World"}
  196. @app.get("/items/{item_id}")
  197. async def read_item(item_id: int, q: Optional[str] = None):
  198. return {"item_id": item_id, "q": q}
  199. ```
  200. **Note**:
  201. If you don't know, check the _"In a hurry?"_ section about <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` and `await` in the docs</a>.
  202. </details>
  203. ### Run it
  204. Run the server with:
  205. <div class="termy">
  206. ```console
  207. $ uvicorn main:app --reload
  208. INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
  209. INFO: Started reloader process [28720]
  210. INFO: Started server process [28722]
  211. INFO: Waiting for application startup.
  212. INFO: Application startup complete.
  213. ```
  214. </div>
  215. <details markdown="1">
  216. <summary>About the command <code>uvicorn main:app --reload</code>...</summary>
  217. The command `uvicorn main:app` refers to:
  218. * `main`: the file `main.py` (the Python "module").
  219. * `app`: the object created inside of `main.py` with the line `app = FastAPI()`.
  220. * `--reload`: make the server restart after code changes. Only do this for development.
  221. </details>
  222. ### Check it
  223. Open your browser at <a href="http://127.0.0.1:8000/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1:8000/items/5?q=somequery</a>.
  224. You will see the JSON response as:
  225. ```JSON
  226. {"item_id": 5, "q": "somequery"}
  227. ```
  228. You already created an API that:
  229. * Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
  230. * Both _paths_ take `GET` <em>operations</em> (also known as HTTP _methods_).
  231. * The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`.
  232. * The _path_ `/items/{item_id}` has an optional `str` _query parameter_ `q`.
  233. ### Interactive API docs
  234. Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
  235. You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
  236. ![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
  237. ### Alternative API docs
  238. And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
  239. You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
  240. ![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
  241. ## Example upgrade
  242. Now modify the file `main.py` to receive a body from a `PUT` request.
  243. Declare the body using standard Python types, thanks to Pydantic.
  244. ```Python hl_lines="4 9-12 25-27"
  245. from typing import Optional
  246. from fastapi import FastAPI
  247. from pydantic import BaseModel
  248. app = FastAPI()
  249. class Item(BaseModel):
  250. name: str
  251. price: float
  252. is_offer: Optional[bool] = None
  253. @app.get("/")
  254. def read_root():
  255. return {"Hello": "World"}
  256. @app.get("/items/{item_id}")
  257. def read_item(item_id: int, q: Optional[str] = None):
  258. return {"item_id": item_id, "q": q}
  259. @app.put("/items/{item_id}")
  260. def update_item(item_id: int, item: Item):
  261. return {"item_name": item.name, "item_id": item_id}
  262. ```
  263. The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
  264. ### Interactive API docs upgrade
  265. Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
  266. * The interactive API documentation will be automatically updated, including the new body:
  267. ![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
  268. * Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
  269. ![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
  270. * Then click on the "Execute" button, the user interface will communicate with your API, send the parameters, get the results and show them on the screen:
  271. ![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
  272. ### Alternative API docs upgrade
  273. And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
  274. * The alternative documentation will also reflect the new query parameter and body:
  275. ![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
  276. ### Recap
  277. In summary, you declare **once** the types of parameters, body, etc. as function parameters.
  278. You do that with standard modern Python types.
  279. You don't have to learn a new syntax, the methods or classes of a specific library, etc.
  280. Just standard **Python 3.6+**.
  281. For example, for an `int`:
  282. ```Python
  283. item_id: int
  284. ```
  285. or for a more complex `Item` model:
  286. ```Python
  287. item: Item
  288. ```
  289. ...and with that single declaration you get:
  290. * Editor support, including:
  291. * Completion.
  292. * Type checks.
  293. * Validation of data:
  294. * Automatic and clear errors when the data is invalid.
  295. * Validation even for deeply nested JSON objects.
  296. * <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of input data: coming from the network to Python data and types. Reading from:
  297. * JSON.
  298. * Path parameters.
  299. * Query parameters.
  300. * Cookies.
  301. * Headers.
  302. * Forms.
  303. * Files.
  304. * <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of output data: converting from Python data and types to network data (as JSON):
  305. * Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc).
  306. * `datetime` objects.
  307. * `UUID` objects.
  308. * Database models.
  309. * ...and many more.
  310. * Automatic interactive API documentation, including 2 alternative user interfaces:
  311. * Swagger UI.
  312. * ReDoc.
  313. ---
  314. Coming back to the previous code example, **FastAPI** will:
  315. * Validate that there is an `item_id` in the path for `GET` and `PUT` requests.
  316. * Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.
  317. * If it is not, the client will see a useful, clear error.
  318. * Check if there is an optional query parameter named `q` (as in `http://127.0.0.1:8000/items/foo?q=somequery`) for `GET` requests.
  319. * As the `q` parameter is declared with `= None`, it is optional.
  320. * Without the `None` it would be required (as is the body in the case with `PUT`).
  321. * For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
  322. * Check that it has a required attribute `name` that should be a `str`.
  323. * Check that it has a required attribute `price` that has to be a `float`.
  324. * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
  325. * All this would also work for deeply nested JSON objects.
  326. * Convert from and to JSON automatically.
  327. * Document everything with OpenAPI, that can be used by:
  328. * Interactive documentation systems.
  329. * Automatic client code generation systems, for many languages.
  330. * Provide 2 interactive documentation web interfaces directly.
  331. ---
  332. We just scratched the surface, but you already get the idea of how it all works.
  333. Try changing the line with:
  334. ```Python
  335. return {"item_name": item.name, "item_id": item_id}
  336. ```
  337. ...from:
  338. ```Python
  339. ... "item_name": item.name ...
  340. ```
  341. ...to:
  342. ```Python
  343. ... "item_price": item.price ...
  344. ```
  345. ...and see how your editor will auto-complete the attributes and know their types:
  346. ![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
  347. For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
  348. **Spoiler alert**: the tutorial - user guide includes:
  349. * Declaration of **parameters** from other different places as: **headers**, **cookies**, **form fields** and **files**.
  350. * How to set **validation constraints** as `maximum_length` or `regex`.
  351. * A very powerful and easy to use **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** system.
  352. * Security and authentication, including support for **OAuth2** with **JWT tokens** and **HTTP Basic** auth.
  353. * More advanced (but equally easy) techniques for declaring **deeply nested JSON models** (thanks to Pydantic).
  354. * **GraphQL** integration with <a href="https://strawberry.rocks" class="external-link" target="_blank">Strawberry</a> and other libraries.
  355. * Many extra features (thanks to Starlette) as:
  356. * **WebSockets**
  357. * extremely easy tests based on `requests` and `pytest`
  358. * **CORS**
  359. * **Cookie Sessions**
  360. * ...and more.
  361. ## Performance
  362. Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <a href="https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=query&l=zijzen-7" class="external-link" target="_blank">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
  363. To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
  364. ## Optional Dependencies
  365. Used by Pydantic:
  366. * <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - for faster JSON <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>.
  367. * <a href="https://github.com/JoshData/python-email-validator" target="_blank"><code>email_validator</code></a> - for email validation.
  368. Used by Starlette:
  369. * <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
  370. * <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
  371. * <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
  372. * <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
  373. * <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
  374. * <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
  375. Used by FastAPI / Starlette:
  376. * <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
  377. * <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
  378. You can install all of these with `pip install "fastapi[all]"`.
  379. ## License
  380. This project is licensed under the terms of the MIT license.