Compare commits

...

1442 Commits

Author SHA1 Message Date
Sebastián Ramírez
0a38c51b9e 🔖 Release 0.66.1 2021-07-19 21:26:52 +02:00
Sebastián Ramírez
db5b2bdf56 📝 Update release notes 2021-07-19 21:21:40 +02:00
github-actions
5ac84120b3 📝 Update release notes 2021-07-19 19:15:35 +00:00
Thomas Grainger
2d296c5d07 🔧 Configure strict pytest options and update/refactor tests (#2790)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-19 21:14:58 +02:00
github-actions
71c96d9eb9 📝 Update release notes 2021-07-19 12:49:41 +00:00
Mark H
5342a0a00f 🌐 Add basic setup for German translations (#3522) 2021-07-19 14:49:09 +02:00
github-actions
163b086f21 📝 Update release notes 2021-07-19 12:47:20 +00:00
oandersonmagalhaes
0876d3df1d 🌐 Add Portuguese translation for docs/tutorial/security/index.md (#3507)
Co-authored-by: Izabela Guerreiro <izaguerreiro@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-19 14:46:39 +02:00
github-actions
50baf5e804 📝 Update release notes 2021-07-19 12:33:34 +00:00
Lucas
3d6da2c32d 🌐 Add Portuguese translation for docs/deployment/index.md (#3337) 2021-07-19 14:32:54 +02:00
github-actions
e721d04350 📝 Update release notes 2021-07-05 11:45:43 +00:00
Sebastián Ramírez
8cc6f9baac ⬆️ Upgrade python-jose dependency for tests (#3468) 2021-07-05 13:45:03 +02:00
Sebastián Ramírez
dfd453e001 📝 Update release notes 2021-07-04 21:18:45 +02:00
Sebastián Ramírez
7e9d5aacf8 🔖 Release version 0.66.0 2021-07-04 20:59:46 +02:00
Sebastián Ramírez
d27a218bc3 📝 Update release notes 2021-07-04 20:58:49 +02:00
github-actions
0c4ded88fe 📝 Update release notes 2021-07-04 18:54:19 +00:00
Rubikoid
0e0931d308 🐛 Fix include/exclude for dicts in jsonable_encoder (#2016)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-04 20:53:40 +02:00
github-actions
dcfa9eb8fe 📝 Update release notes 2021-07-04 17:35:19 +00:00
Camila Gutierrez
6ebf60b175 🌐 Add Spanish translation for tutorial/query-params.md (#2243)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-04 19:34:46 +02:00
github-actions
a4d0724a97 📝 Update release notes 2021-07-04 17:06:51 +00:00
Juan Funez
c235e9b78c 🌐 Add Spanish translation for advanced/response-directly.md (#1253)
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 19:06:18 +02:00
github-actions
5fa3e239db 📝 Update release notes 2021-07-04 14:15:04 +00:00
Juan Funez
3d1b107d70 🌐 Add Spanish translation for advanced/additional-status-codes.md (#1252)
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 16:14:29 +02:00
github-actions
18e0828daf 📝 Update release notes 2021-07-04 12:50:02 +00:00
Juan Funez
f16c7729bd 🌐 Add Spanish translation for advanced/path-operation-advanced-configuration.md (#1251)
Co-authored-by: Camila Gutierrez <mariacamilagl@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 14:49:31 +02:00
Sebastián Ramírez
9f3c8cd139 📝 Update release notes, add links to docs 2021-07-03 21:59:39 +02:00
github-actions
a7a35aee61 📝 Update release notes 2021-07-03 19:52:03 +00:00
Sebastián Ramírez
dc5a966548 Allow setting the response_class to RedirectResponse and returning the URL from the function (#3457) 2021-07-03 21:51:28 +02:00
github-actions
ea8d7f689e 📝 Update release notes 2021-07-03 17:16:33 +00:00
Jacob Magnusson
0ed6c92341 🐛 Support custom OpenAPI / JSON Schema fields in the generated output OpenAPI (#1429)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 19:15:59 +02:00
Sebastián Ramírez
79f52c76cf 🔖 Release version 0.65.3 2021-07-03 18:33:32 +02:00
Sebastián Ramírez
b725e9eb45 📝 Update release notes 2021-07-03 18:32:50 +02:00
Sebastián Ramírez
787e54b096 📝 Update release notes 2021-07-03 18:30:46 +02:00
github-actions
15fd60b29a 📝 Update release notes 2021-07-03 16:26:48 +00:00
Sebastián Ramírez
edf6b2d61f ♻ Assume request bodies contain JSON when no Content-Type header is provided (#3456) 2021-07-03 18:25:12 +02:00
github-actions
7eb17fc874 📝 Update release notes 2021-07-03 15:13:30 +00:00
Nasaruddin
7e4bfaf0e9 🌐 Initialize Indonesian translations (#3014)
Co-authored-by: Nasaruddin <nasaruddin@skorpoints.com>
2021-07-03 17:12:51 +02:00
github-actions
e1d4fc5325 📝 Update release notes 2021-07-03 14:47:21 +00:00
Camila Gutierrez
faec748ef6 🌐 Add Spanish translation of Tutorial - Path Parameters (#2219)
Co-authored-by: Pedro A. Moreno <pedabraham@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 16:46:49 +02:00
github-actions
afec8c4580 📝 Update release notes 2021-07-03 14:14:01 +00:00
Camila Gutierrez
8a1f0aa3b6 🌐 Add Spanish translation of Tutorial - First Steps (#2208)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 16:13:28 +02:00
github-actions
f784644510 📝 Update release notes 2021-07-02 15:18:24 +00:00
github-actions[bot]
710a2f745c 👥 Update FastAPI People (#3450)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 17:17:49 +02:00
github-actions
bd230fe473 📝 Update release notes 2021-07-02 15:00:53 +00:00
Mário Victor Ribeiro Silva
9c5b000956 🌐 Portuguese translation of Tutorial - Body - Fields (#3420)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 17:00:11 +02:00
github-actions
a9f2a25feb 📝 Update release notes 2021-07-02 14:54:56 +00:00
jaystone776
c00c2d1ecf 🌐 Add Chinese translation for Tutorial - Request - Forms - and - Files (#3249)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:54:22 +02:00
github-actions
dd7bbae837 📝 Update release notes 2021-07-02 14:44:04 +00:00
jaystone776
0a84d48a82 🌐 Add Chinese translation for Tutorial - Handling - Errors (#3299)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:43:28 +02:00
github-actions
e5d0b97dee 📝 Update release notes 2021-07-02 14:36:34 +00:00
jaystone776
811c3f873f 🌐 Add Chinese translation for Tutorial - Form - Data (#3248)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:35:58 +02:00
github-actions
662fc81544 📝 Update release notes 2021-07-02 14:27:36 +00:00
github-actions[bot]
5e2f2d541d 👥 Update FastAPI People (#3319)
Co-authored-by: github-actions <github-actions@github.com>
2021-07-02 16:27:02 +02:00
github-actions
8116d8158b 📝 Update release notes 2021-07-02 14:24:16 +00:00
jaystone776
e6836781d5 🌐 Add Chinese translation for Tutorial - Body - Updates (#3237)
Co-authored-by: Xie Wei <ampedee@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:23:41 +02:00
github-actions
098088c763 📝 Update release notes 2021-07-02 14:21:11 +00:00
Hareru
4bf9a52043 🌐 Add Chinese translation for FastAPI People (#3112)
Co-authored-by: Xie Wei <ampedee@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:20:36 +02:00
github-actions
eb6f964ede 📝 Update release notes 2021-07-02 14:18:44 +00:00
Sam Courtemanche
4473a9bcbf 🌐 Add French translation for Project Generation (#3197)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:18:06 +02:00
github-actions
fdc7c96ece 📝 Update release notes 2021-07-02 14:14:28 +00:00
Sam Courtemanche
a694be81ae 🌐 Add French translation for Python Types Intro (#3185) 2021-07-02 16:13:52 +02:00
github-actions
0abb743e9c 📝 Update release notes 2021-07-02 14:12:43 +00:00
Sam Courtemanche
acda3f06b0 🌐 Add French translation for External Links (#3103)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:12:05 +02:00
github-actions
3127bc4e05 📝 Update release notes 2021-07-02 14:06:45 +00:00
Ruidy
18b24df9c8 🌐 Add French translation for Alternatives, Inspiration and Comparisons (#3020)
Co-authored-by: Jérôme Fink <jerome.fink@student.unamur.be>
Co-authored-by: Sam Courtemanche <sam.courtemanche.ipod@gmail.com>
2021-07-02 16:06:10 +02:00
github-actions
b27758fe13 📝 Update release notes 2021-07-02 14:03:22 +00:00
BoYanZh
a0b2006230 🌐 Fix Chinese translation code snippet mismatch in Tutorial - Python Types Intro 2021-07-02 16:02:45 +02:00
github-actions
bd143ffa5a 📝 Update release notes 2021-07-02 13:43:04 +00:00
Fabio Serrao
77c1988a8b 🌐 Add Portuguese translation for Development Contributing (#1364) 2021-07-02 15:42:29 +02:00
github-actions
26a36f79fa 📝 Update release notes 2021-06-29 21:23:00 +00:00
Sebastián Ramírez
97d8d4016b ⬆ Upgrade docs development dependency on typer-cli to >=0.0.12 to fix conflicts (#3429) 2021-06-29 23:22:23 +02:00
github-actions
246e80512d 📝 Update release notes 2021-06-29 12:24:59 +00:00
jaystone776
fc6827d68a 🌐 Add Chinese translation for Tutorial - Request - Files (#3244)
Co-authored-by: Xie Wei <ampedee@gmail.com>
2021-06-29 14:24:19 +02:00
Sebastián Ramírez
4d91f978d2 🔖 Release version 0.65.2 2021-06-09 10:17:27 +02:00
Sebastián Ramírez
aabe2c7d66 📝 Update release notes 2021-06-09 10:16:25 +02:00
Sebastián Ramírez
377234ad8e 🔒 Create Security Policy 2021-06-07 14:55:40 +02:00
github-actions
38b785813f 📝 Update release notes 2021-06-07 10:46:59 +00:00
Patrick Wang
fa7e3c996e 🐛 Check Content-Type request header before assuming JSON (#2118)
Co-authored-by: Patrick Wang <patrickkwang@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-06-07 12:46:18 +02:00
github-actions
90120dd6e8 📝 Update release notes 2021-06-07 08:53:24 +00:00
Sebastián Ramírez
36772548b7 🔧 Update sponsors badge, course bundle (#3340)
* 🔧 Update sponsors badge, course bundle

* 🍱 Update course bundle SVG sizes
2021-06-07 10:52:44 +02:00
github-actions
40bb0c5f36 📝 Update release notes 2021-05-26 09:26:47 +00:00
Sebastián Ramírez
60918d25a1 🔧 Add new gold sponsor Jina 🎉 (#3291) 2021-05-26 11:26:06 +02:00
github-actions
3afce2c4b8 📝 Update release notes 2021-05-25 15:06:28 +00:00
Sebastián Ramírez
9f6f25d54c 🔧 Add new banner sponsor badge for FastAPI courses bundle (#3288) 2021-05-25 17:05:39 +02:00
Sebastián Ramírez
d5b09cd958 🔧 Add new banner sponsor badge for FastAPI courses bundle (#3288) 2021-05-25 17:05:04 +02:00
github-actions
aece74982d 📝 Update release notes 2021-05-16 18:28:24 +00:00
Sebastián Ramírez
2b1e5b9f82 👷 Upgrade Issue Manager GitHub Action (#3236) 2021-05-16 20:27:45 +02:00
Sebastián Ramírez
43df5d05ed 🔖 Release FastAPI version 0.65.1 2021-05-11 23:19:14 +02:00
github-actions
eaa49ebd20 📝 Update release notes 2021-05-11 21:17:51 +00:00
Sebastián Ramírez
a6293397bc 📌 Upgrade pydantic pin, to handle security vulnerability CVE-2021-29510 (#3213) 2021-05-11 23:17:17 +02:00
Sebastián Ramírez
b890bd1dc5 🔖 Release version 0.65.0 2021-05-10 17:45:21 +02:00
github-actions
3819a11b5f 📝 Update release notes 2021-05-10 14:09:42 +00:00
Hannes Küttner
4aed0411e9 ⬆️ Upgrade Starlette to 0.14.2, including internal UJSONResponse migrated from Starlette (#2335) 2021-05-10 16:09:04 +02:00
github-actions
04ac466748 📝 Update release notes 2021-05-10 08:11:22 +00:00
Sebastián Ramírez
d75126a4ce 👷 Add GitHub Action cache to speed up CI installs (#3204) 2021-05-10 10:10:48 +02:00
github-actions
c654e8384b 📝 Update release notes 2021-05-10 07:47:11 +00:00
Sebastián Ramírez
7c9d0168ff ⬆️ Upgrade setup-python GitHub Action to v2 (#3203) 2021-05-10 09:46:32 +02:00
github-actions
e956ba4d4a 📝 Update release notes 2021-05-10 07:27:43 +00:00
neternefer
85b32f51ff 🌐 Initialize new language Polish for translations (#3170)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-10 09:27:07 +02:00
github-actions
08fabb7b2e 📝 Update release notes 2021-05-10 07:16:15 +00:00
Sebastián Ramírez
273b2cd646 🐛 Fix docs script to generate a new translation language with overrides boilerplate (#3202) 2021-05-10 09:15:39 +02:00
github-actions
de1a5125f8 📝 Update release notes 2021-05-08 17:51:32 +00:00
Sebastián Ramírez
da86791224 Add new Deta banner badge with new sponsorship tier 🙇 (#3194) 2021-05-08 19:50:56 +02:00
Sebastián Ramírez
c646eaa6bb ✏️ Fix typo/order in release notes 2021-05-07 14:25:21 +02:00
github-actions
bf44b428dd 📝 Update release notes 2021-05-07 12:19:57 +00:00
github-actions[bot]
c2907b189c 👥 Update FastAPI People (#3189)
Co-authored-by: github-actions <github-actions@github.com>
2021-05-07 14:19:19 +02:00
github-actions
75317d230b 📝 Update release notes 2021-05-07 12:05:45 +00:00
Sebastián Ramírez
e662654c49 🔊 Update FastAPI People to allow better debugging (#3188) 2021-05-07 14:04:54 +02:00
Sebastián Ramírez
2a67321130 🔖 Release version 0.64.0 2021-05-07 10:15:26 +02:00
Sebastián Ramírez
8d9d2c0d3f 📝 Update release notes 2021-05-07 10:14:21 +02:00
github-actions
dc6a78c357 📝 Update release notes 2021-05-06 15:48:23 +00:00
T
73d1def114 📝 Add link to article in Russian "FastAPI: знакомимся с фреймворком" (#2564) 2021-05-06 17:47:49 +02:00
github-actions
3dc74ba29f 📝 Update release notes 2021-05-06 15:42:53 +00:00
dompatmore
d9d6031db5 📝 Add external link to blog post "Authenticate Your FastAPI App with Auth0" (#2172)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-06 17:42:14 +02:00
Sebastián Ramírez
6135417789 📝 Update release notes 2021-05-06 17:32:04 +02:00
github-actions
6d138f218b 📝 Update release notes 2021-05-05 18:21:32 +00:00
Austin Orr
e10a4375f9 Add support for adding multiple examples in request bodies and path, query, cookie, and header params (#1267)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-05 20:20:56 +02:00
github-actions
3e32eb55f0 📝 Update release notes 2021-05-04 09:03:02 +00:00
NiJia Lin
b3f139c0d9 🌐 Fix Chinese translation of Tutorial - Query Parameters, remove obsolete content (#3051) 2021-05-04 11:02:19 +02:00
github-actions
3b4c692534 📝 Update release notes 2021-05-04 09:01:17 +00:00
Sam Courtemanche
05c859f324 🌐 Add French translation for Tutorial - Background Tasks (#3098)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 11:00:43 +02:00
github-actions
48a33b0453 📝 Update release notes 2021-05-04 08:49:43 +00:00
SueNaeunYang
70746a7bf0 🌐 Fix Korean translation for docs/ko/docs/index.md (#3159) 2021-05-04 10:49:07 +02:00
github-actions
69e3c6e3d3 📝 Update release notes 2021-05-04 08:38:41 +00:00
Spike
388e5c0c25 🌐 Add Korean translation for Tutorial - Query Parameters (#2390)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 10:38:02 +02:00
github-actions
61db5ebcc2 📝 Update release notes 2021-05-04 08:28:21 +00:00
JulianMaurin
23845979ea 🌐 Add French translation for FastAPI People (#2232)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 10:27:49 +02:00
github-actions
83f7a36d05 📝 Update release notes 2021-05-04 08:25:39 +00:00
Spike
462014e296 🌐 Add Korean translation for Tutorial - Path Parameters (#2355) 2021-05-04 10:24:58 +02:00
github-actions
5da5ae5554 📝 Update release notes 2021-05-04 08:20:03 +00:00
Jérôme Fink
f3a985cb81 🌐 Add French translation for Features (#2157)
Co-authored-by: Jérôme Fink <jerome.fink@unamur.be>
2021-05-04 10:19:24 +02:00
github-actions
22528373bb 📝 Update release notes 2021-04-07 07:04:13 +00:00
github-actions[bot]
ce0ec06e8a 👥 Update FastAPI People (#3031)
Co-authored-by: github-actions <github-actions@github.com>
2021-04-07 09:03:39 +02:00
github-actions
10397ddc30 📝 Update release notes 2021-03-27 17:52:30 +00:00
Shucai.wang
6f72a27632 🌐 Add Chinese translation for Tutorial - Debugging (#2737)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:51:51 +01:00
Sebastián Ramírez
2783667f80 📝 Update release notes 2021-03-27 18:50:39 +01:00
github-actions
d8c1d040d4 📝 Update release notes 2021-03-27 17:39:13 +00:00
Xie Wei
7f037f1bdc 🌐 Add Chinese translation for Tutorial - Security - OAuth2 with Password (and hashing), Bearer with JWT tokens (#2642)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:38:33 +01:00
github-actions
f31104585f 📝 Update release notes 2021-03-27 17:36:52 +00:00
mode
5934a75ddd 🌐 Add Korean translation for Tutorial - Header Parameters (#2589)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:36:09 +01:00
github-actions
650abf091b 📝 Update release notes 2021-03-27 17:31:54 +00:00
Shucai.wang
66f18e9282 🌐 Add Chinese translation for Tutorial - Metadata and Docs URLs (#2559) 2021-03-27 18:31:11 +01:00
github-actions
f044f13121 📝 Update release notes 2021-03-27 17:30:24 +00:00
Spike
0250cfa398 🌐 Add Korean translation for Tutorial - First Steps (#2323)
Co-authored-by: Dahun Jeong <gnsgnsek@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:29:45 +01:00
github-actions
f4ce2510f3 📝 Update release notes 2021-03-27 17:28:52 +00:00
Shucai.wang
8f0a604a37 🌐 Add Chinese translation for Tutorial - CORS (Cross-Origin Resource Sharing) (#2540)
Co-authored-by: Xie Wei <ampedee@gmail.com>
2021-03-27 18:28:07 +01:00
github-actions
0f4c2b6ee0 📝 Update release notes 2021-03-27 17:26:01 +00:00
lpdswing
368d314e11 🌐 Add Chinese translation for Tutorial - Middleware (#2334)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:25:21 +01:00
github-actions
4e79cb0be4 📝 Update release notes 2021-03-27 17:23:26 +00:00
Spike
973595b3cb 🌐 Add Korean translation for Tutorial - Intro (#2317)
Co-authored-by: Dahun Jeong <gnsgnsek@gmail.com>
2021-03-27 18:22:50 +01:00
github-actions
fa779017d2 📝 Update release notes 2021-03-27 16:55:48 +00:00
Sebastián Ramírez
b2e27de2fc 🔧 Update top banner, point to newsletter (#3003) 2021-03-27 17:55:12 +01:00
github-actions
31a7bfd227 📝 Update release notes 2021-03-27 16:46:10 +00:00
Sebastián Ramírez
47dde41c6c 🔧 Disable sponsor WeTransfer (#3002) 2021-03-27 17:45:32 +01:00
github-actions
413a86998e 📝 Update release notes 2021-03-27 16:36:52 +00:00
Sebastián Ramírez
36721d4362 📌 Pin SQLAlchemy range, as it doesn't use SemVer (#3001) 2021-03-27 17:36:07 +01:00
github-actions
c09e950bd2 📝 Update release notes 2021-03-01 19:02:33 +00:00
Sebastián Ramírez
4d208b2b90 🎨 Add newly required type annotations for mypy (#2882)
* ⬆️ Upgrade mypy

* 🎨 Add extra type annotations, now required by mypy
2021-03-01 20:01:50 +01:00
github-actions
071c6a17dd 📝 Update release notes 2021-03-01 18:33:53 +00:00
github-actions[bot]
4ab79c679b 👥 Update FastAPI People (#2880)
Co-authored-by: github-actions <github-actions@github.com>
2021-03-01 19:33:08 +01:00
github-actions
33be5fc8ba 📝 Update release notes 2021-02-07 18:27:26 +00:00
Davide Fiocco
a7a353e1f5 📝 Fix broken link to article: Machine learning model serving in Python using FastAPI and Streamlit (#2557) 2021-02-07 19:26:44 +01:00
github-actions
c153d9b83e 📝 Update release notes 2021-02-07 18:26:07 +00:00
vjanz
2875d88ccf 📝 Add FastAPI Medium Article: Deploy a dockerized FastAPI application to AWS (#2515)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 19:25:27 +01:00
github-actions
9e0cca828d 📝 Update release notes 2021-02-07 18:19:21 +00:00
johnthagen
5dc3ec4a65 ✏ Fix typo in Tutorial - Handling Errors (#2486) 2021-02-07 19:18:37 +01:00
github-actions
bda392cba6 📝 Update release notes 2021-02-07 18:16:26 +00:00
water_lift
f22137346a 🎨 Remove internal "type: ignore", now unnecessary (#2424) 2021-02-07 19:15:43 +01:00
github-actions
f108741a82 📝 Update release notes 2021-02-07 18:14:23 +00:00
Jürgen Gmach
8433e8efe2 ✏ Fix typo in Security OAuth2 scopes (#2407) 2021-02-07 19:13:41 +01:00
github-actions
e6a1a9e193 📝 Update release notes 2021-02-07 18:06:49 +00:00
kangni
bbb22813e6 ✏ Fix typo/clarify docs for SQL (Relational) Databases (#2393)
By way of code example, I think this is a typo. btw, the tutorial is very well written.
2021-02-07 19:06:08 +01:00
github-actions
f0f8e287ec 📝 Update release notes 2021-02-07 18:02:41 +00:00
Xie Wei
0af6cbe990 🌐 Add Chinese translation for Tutorial - Bigger Applications - Multiple Files (#2453)
Co-authored-by: Shucai.wang <blt23@126.com>
2021-02-07 19:02:00 +01:00
github-actions
9e9e068762 📝 Update release notes 2021-02-07 18:01:12 +00:00
Xie Wei
9fda0149da 🌐 Add Chinese translation for Tutorial - Security - Security Intro (#2443) 2021-02-07 19:00:14 +01:00
github-actions
95a713b3e2 📝 Update release notes 2021-02-07 17:59:55 +00:00
maoyibo
2da3d62d37 🌐 Add Chinese translation for Tutorial - Header Parameters (#2412)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:59:12 +01:00
github-actions
7dd2e92d7e 📝 Update release notes 2021-02-07 17:52:50 +00:00
maoyibo
6d06e13284 🌐 Add Chinese translation for Tutorial - Extra Data Types (#2410)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:52:09 +01:00
github-actions
a2199c545b 📝 Update release notes 2021-02-07 17:47:02 +00:00
T. Tokusumi
08cbc6c8ff 🌐 Add Japanese translation for Deployment - Docker (#2312)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:46:22 +01:00
github-actions
f730160037 📝 Update release notes 2021-02-07 17:45:09 +00:00
T. Tokusumi
20360c207e 🌐 Add Japanese translation for Deployment - Versions (#2310)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:44:28 +01:00
github-actions
568a54dff2 📝 Update release notes 2021-02-07 17:43:14 +00:00
Alicrazy
91cacc9c92 🌐 Add Chinese translation for Tutorial - Cookie Parameters (#2261)
Co-authored-by: lijun <lijun@duozhuayu.net>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:42:34 +01:00
github-actions
b3899333f4 📝 Update release notes 2021-02-07 17:41:26 +00:00
Amit Chaudhary
6b6a310e54 📝 Add external link to "FastAPI for Flask Users" (#2280) 2021-02-07 18:40:42 +01:00
github-actions
cb2dce03c0 📝 Update release notes 2021-02-07 17:38:52 +00:00
T. Tokusumi
7122687f25 🌐 Add Japanese translation for Tutorial - Static files (#2260)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:38:10 +01:00
github-actions
af6fcf1413 📝 Update release notes 2021-02-07 17:32:12 +00:00
T. Tokusumi
cd8b90a5a4 🌐 Add Japanese translation for Tutorial - Testing (#2259)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:31:30 +01:00
github-actions
c88fb2eef0 📝 Update release notes 2021-02-07 17:26:15 +00:00
T. Tokusumi
17781e3596 🌐 Add Japanese translation for Tutorial - Debugging (#2256)
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:25:31 +01:00
github-actions
a381642558 📝 Update release notes 2021-02-07 17:24:39 +00:00
T. Tokusumi
5828043b69 🌐 Add Japanese translation for Tutorial - Middleware (#2255)
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:23:55 +01:00
github-actions
909a81f88a 📝 Update release notes 2021-02-07 17:21:27 +00:00
T. Tokusumi
faec713e0d 🌐 Add Japanese translation for Concurrency and async / await (#2058)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:20:43 +01:00
github-actions
60addbcdd5 📝 Update release notes 2021-02-01 14:49:57 +00:00
github-actions[bot]
a27a1bc53c 👥 Update FastAPI People (#2739)
Co-authored-by: github-actions <github-actions@github.com>
2021-02-01 15:49:09 +01:00
github-actions
41f291524d 📝 Update release notes 2021-01-19 20:13:46 +00:00
Sebastián Ramírez
6b3bc7384e 🔧 Add new Gold Sponsor Talk Python 🎉 (#2673) 2021-01-19 21:12:58 +01:00
github-actions
561bbfb5d2 📝 Update release notes 2021-01-18 15:35:35 +00:00
Sebastián Ramírez
8ce1c81398 🔧 Add new Gold Sponsor vim.so 🎉 (#2669) 2021-01-18 16:34:46 +01:00
github-actions
cb40e27db2 📝 Update release notes 2021-01-09 21:24:44 +00:00
Sebastián Ramírez
f031973848 🔧 Add FastAPI user survey banner (#2623)
* 🔧 Add FastAPI user survey banner

* 🔧 Make FastAPI user survey banner open new tab
2021-01-09 22:24:03 +01:00
github-actions
307d37d85c 📝 Update release notes 2021-01-09 21:11:58 +00:00
Sebastián Ramírez
bf290fa5f0 🔧 Add new Bronze Sponsor(s) 🥉🎉 (#2622)
* 🔧 Update FastAPI People sponsors, include new Bronze Sponsor 🎉

* 📝 Update FastAPI People in Japanese
2021-01-09 22:11:15 +01:00
github-actions
26f313d524 📝 Update release notes 2021-01-09 20:55:21 +00:00
Sebastián Ramírez
73021d7261 📝 Update social links: add Discord, fix GitHub (#2621) 2021-01-09 21:54:38 +01:00
github-actions
f54fb88ad5 📝 Update release notes 2021-01-09 19:00:40 +00:00
Xie Wei
b3d2f47bc8 🌐 Add Chinese translation for Tutorial - Security - Simple OAuth2 with Password and Bearer (#2514)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:59:56 +01:00
github-actions
52f170b3fe 📝 Update release notes 2021-01-09 18:59:33 +00:00
T. Tokusumi
9442845ca5 🌐 Add Japanese translation for Deployment - Deta (#2314)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:58:52 +01:00
github-actions
fe31b0caae 📝 Update release notes 2021-01-09 18:53:47 +00:00
Xie Wei
d2ca3df033 🌐 Add Chinese translation for Tutorial - Security - Get Current User (#2474) 2021-01-09 19:53:05 +01:00
github-actions
838ea752b2 📝 Update release notes 2021-01-09 18:52:30 +00:00
T. Tokusumi
2b49b8c70a 🌐 Add Japanese translation for Deployment - Manually (#2313)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:51:42 +01:00
github-actions
05b024d61b 📝 Update release notes 2021-01-09 18:47:49 +00:00
T. Tokusumi
c7742e3c56 🌐 Add Japanese translation for Deployment - Intro (#2309)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:47:08 +01:00
github-actions
4f9104ce97 📝 Update release notes 2021-01-09 18:43:08 +00:00
T. Tokusumi
07a8f7b5b5 🌐 Add Japanese translation for FastAPI People (#2254)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
2021-01-09 19:42:24 +01:00
github-actions
f2a28f4b5b 📝 Update release notes 2021-01-09 18:41:10 +00:00
atsumi
5a4a61ca67 🌐 Add Japanese translation for Advanced - Path Operation Advanced Configuration (#2124)
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
2021-01-09 19:40:27 +01:00
github-actions
71ac76c3cd 📝 Update release notes 2021-01-09 18:39:11 +00:00
T. Tokusumi
68dca8f42d 🌐 Add Japanese translation for External Links (#2070)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:38:20 +01:00
github-actions
a38e6f4e2c 📝 Update release notes 2021-01-09 18:33:53 +00:00
SwftAlpc
ca26f2274c 🌐 Add Japanese translation for Tutorial - Body - Updates (#1956)
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:33:07 +01:00
github-actions
8108cd89bb 📝 Update release notes 2021-01-09 18:28:54 +00:00
SwftAlpc
8560151090 🌐 Add Japanese translation for Tutorial - Form Data (#1943)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:28:15 +01:00
github-actions
91805cdf03 📝 Update release notes 2021-01-09 18:20:10 +00:00
SwftAlpc
48cba16578 🌐 Add Japanese translation for Tutorial - Cookie Parameters (#1933)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:19:26 +01:00
github-actions
7098e3b150 📝 Update release notes 2021-01-09 16:58:08 +00:00
Sebastián Ramírez
a7cc25eb11 🔧 Update FastAPI People GitHub Sponsors order (#2620) 2021-01-09 17:57:27 +01:00
github-actions
d2eb4a71ee 📝 Update release notes 2021-01-05 21:04:05 +00:00
Sebastián Ramírez
54eeb3161f 🔧 Update InvestSuite sponsor data (#2608) 2021-01-05 22:03:24 +01:00
github-actions
4fabcfa3ab 📝 Update release notes 2021-01-01 20:15:01 +00:00
github-actions[bot]
5c29daadcc 👥 Update FastAPI People (#2590)
Co-authored-by: github-actions <github-actions@github.com>
2021-01-01 21:14:17 +01:00
Sebastián Ramírez
5614b94ccc 📝 Update release notes 2020-12-20 20:18:06 +01:00
Sebastián Ramírez
e170c86412 🔖 Release version 0.63.0 2020-12-20 20:16:12 +01:00
github-actions
180bdf31ac 📝 Update release notes 2020-12-20 19:13:21 +00:00
Sebastián Ramírez
1e58a3e44c ⬆️ Upgrade Uvicorn when installing fastapi[all] to the latest version including uvloop (#2548)
* ⬆️ Upgrade Uvicorn when installing fastapi[all] to the latest version, including uvloop

* ⬆️ Relax Uvicorn version range to the minimum supported

in case anyone depends older versions somehow installed with FastAPI extras
2020-12-20 20:12:39 +01:00
Sebastián Ramírez
dfe3f614ed 📝 Update release notes 2020-12-20 19:57:11 +01:00
github-actions
97c747fe54 📝 Update release notes 2020-12-20 18:50:42 +00:00
Sebastián Ramírez
fdb6c9ccc5 Improve type annotations, add support for mypy --strict, internally and for external packages (#2547) 2020-12-20 19:50:00 +01:00
github-actions
4fdcdf341c 📝 Update release notes 2020-12-19 20:31:01 +00:00
Sebastián Ramírez
e2a6341c60 📝 Update Uvicorn installation instructions to use uvicorn[standard] (includes uvloop) (#2543) 2020-12-19 21:30:18 +01:00
github-actions
7046d80a23 📝 Update release notes 2020-12-19 19:54:43 +00:00
Sebastián Ramírez
9f89399f5e 🌐 Add docs lang selector widget (#2542)
*  Add language selector widget

* 🔧 Update script to re-generate MkDocs configs, including langs widget

* 🔧 Update languages MkDocs configs, with lang selector widget
2020-12-19 20:54:02 +01:00
github-actions
ed0fe9f369 📝 Update release notes 2020-12-19 18:55:37 +00:00
Sebastián Ramírez
6e9b771abf 🐛 Fix docs overrides directory for translations (#2541)
* 🙈 Add .gitignore files to keep overrides directories for translations to fix serving live locally during translations

* ♻️ Refactor docs scripts to handle language overrides (newsletter notification)
2020-12-19 19:54:54 +01:00
github-actions
4a93562a3d 📝 Update release notes 2020-12-19 18:17:19 +00:00
Xie Wei
3f478b7733 🌐 Add Chinese translation for Tutorial - Response Status Code (#2442)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-12-19 19:16:37 +01:00
github-actions
c660d96dce 📝 Update release notes 2020-12-19 18:06:59 +00:00
Sebastián Ramírez
6de9f5890d Remove Typer as a docs building dependency (covered by typer-cli) to fix pip resolver conflicts (#2539) 2020-12-19 19:06:19 +01:00
github-actions
a16ecf2f91 📝 Update release notes 2020-12-19 14:06:30 +00:00
vjanz
7a2c5526d4 🌐 Start translation of the documentation for the Albanian language (#2516) 2020-12-19 15:05:49 +01:00
github-actions
d6b5bc9401 📝 Update release notes 2020-12-13 15:34:30 +00:00
Sebastián Ramírez
e6f8aa8756 Add newsletter: FastAPI and friends (#2509)
*  Add newsletter: FastAPI and friends

* 🔧 Update MkDocs config for announcement

* 🔧 Update generation script to include overrides for announcements
2020-12-13 16:33:46 +01:00
github-actions
f0a14a9ab6 📝 Update release notes 2020-12-12 21:28:29 +00:00
Sebastián Ramírez
c3dbf4ef7c Add new Gold Sponsor: InvestSuite 🎉 (#2508) 2020-12-12 22:27:46 +01:00
github-actions
52dd5924d7 📝 Update release notes 2020-12-06 08:36:00 +00:00
Sebastián Ramírez
a960c42178 🔧 Add issue template configs (#2476)
🔧 Add issue template configs
2020-12-06 09:35:21 +01:00
github-actions
436b023fe4 📝 Update release notes 2020-12-03 17:38:21 +00:00
Xie Wei
f1759297c7 🌐 Add Chinese translation for Tutorial - Extra Models (#2416)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-12-03 18:36:46 +01:00
github-actions
f1ca8da6e1 📝 Update release notes 2020-12-03 17:28:44 +00:00
Xie Wei
478f157013 🌐 Add Chinese translation for Tutorial - Response Model (#2414)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-12-03 18:27:58 +01:00
github-actions
5c8b41abf2 📝 Update release notes 2020-12-03 17:08:59 +00:00
maoyibo
4236c99b7f 🌐 Add Chinese translation for Tutorial - Schema Extra Example (#2411) 2020-12-03 18:08:11 +01:00
github-actions
1a816fd6a0 📝 Update release notes 2020-12-03 17:06:04 +00:00
hard_coder
02b7d988ae 🌐 Add Korean translation for Index (#2192) 2020-12-03 18:05:19 +01:00
github-actions
1b70a1cbf6 📝 Update release notes 2020-12-03 17:01:38 +00:00
atsumi
259c55f7cd 🌐 Add Japanese translation for Advanced User Guide - Additional Status Codes (#2145)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
2020-12-03 18:00:54 +01:00
github-actions
6a05f1774e 📝 Update release notes 2020-12-03 16:58:32 +00:00
Sebastián Ramírez
6189aacd0f 📝 Update title for Deta tutorial (#2466) 2020-12-03 17:57:50 +01:00
github-actions
9e6b069c09 📝 Update release notes 2020-12-02 07:00:39 +00:00
github-actions[bot]
6ffc8a547f 👥 Update FastAPI People (#2454)
Co-authored-by: github-actions <github-actions@github.com>
2020-12-01 19:12:45 +01:00
Sebastián Ramírez
51e920e2fc 🔖 Release version 0.62.0 2020-11-29 19:36:38 +01:00
Sebastián Ramírez
c27b9dcf9d 📝 Update release notes, add breaking changes details 2020-11-29 19:35:10 +01:00
Sebastián Ramírez
c7e137c6e0 📝 Update release notes 2020-11-29 19:17:35 +01:00
github-actions
7e4d7fe895 📝 Update release notes 2020-11-29 18:04:51 +00:00
Sebastián Ramírez
2c57ea57bf 🔧 Update TestDriven link to course in sponsors (#2435) 2020-11-29 19:04:27 +01:00
Sebastián Ramírez
be7d15ce3a 📝 Update release notes 2020-11-29 18:55:48 +01:00
github-actions
afc2bb0801 📝 Update release notes 2020-11-29 17:32:46 +00:00
Sebastián Ramírez
313bbe802f Add support for shared/top-level parameters (dependencies, tags, etc) (#2434)
*  Add Default and DefaultPlaceholder data structures

to handle defaults and overrides

*  Add utils to get values by priority handling DefaultPlaceholders

*  Add support for top-level parameters in FastAPI, APIRouter, include_router

including: prefix, tags, dependencies, deprecated, include_in_schema, responses, default_response_class, callbacks

* ♻️ Update openapi utils to handle DefaultPlaceholder for response_class

* 📝 Update bigger-application example code to use top-level params

and showcase them in APIRouter, FastAPI, include_router

* 📝 Update docs for Bigger Applications, include diagrams, top-level params

* 🔥 Simplify code and docs for callbacks as default_response_class is no longer required

* 📝 Add docs for top-level dependencies, in FastAPI()

* 📝 Add docs reference to top-level dependencies in docs for decorator

*  Update/increase tests for Bigger Applications including shared parameters

*  Add tests for top-level dependencies in FastAPI()

*  Add tests for internal DefaultPlaceholder

*  Update/increase tests for callbacks with top-level parameters

*  Add LOTS of tests covering branches and cases for shared parameters

in top-level FastAPI, path operations, include_router, APIRouter, its path operations, nested include_router, nested APIRouter, and its path operations

* 🎨 Format/reorder parameters for consistency in FastAPI, APIRouter, include_router
2020-11-29 18:32:18 +01:00
github-actions
d550738fa2 📝 Update release notes 2020-11-25 17:48:13 +00:00
atsumi
cc99e23e82 🌐 Add Japanese translation for Advanced - Custom Response (#2193)
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:47:45 +01:00
github-actions
dbdcf86a11 📝 Update release notes 2020-11-25 17:46:45 +00:00
Spaceack
2434980968 🌐 Add Chinese translation for Benchmarks (#2119) 2020-11-25 18:35:39 +01:00
github-actions
ee27f7790f 📝 Update release notes 2020-11-25 17:35:19 +00:00
Xie Wei
d2cc2627ba 🌐 Add Chinese translation for Tutorial - Body - Nested Models (#1609)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:34:50 +01:00
github-actions
f6a285c13c 📝 Update release notes 2020-11-25 17:28:00 +00:00
Ikkyu
8af0b136b1 🌐 Add Chinese translation for Advanced - Custom Response (#1459)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:27:34 +01:00
github-actions
159a61d2b0 📝 Update release notes 2020-11-25 17:23:01 +00:00
Ikkyu
94fe5495fa 🌐 Add Chinese translation for Advanced - Return a Response Directly (#1452)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:22:34 +01:00
github-actions
8cc3ac1329 📝 Update release notes 2020-11-25 17:16:53 +00:00
Ikkyu
6b49f67d11 🌐 Add Chinese translation for Advanced - Additional Status Codes (#1451)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:16:20 +01:00
github-actions
9972b76efa 📝 Update release notes 2020-11-25 17:12:26 +00:00
Ikkyu
410da16a14 🌐 Add Chinese translation for Advanced - Path Operation Advanced Configuration (#1447)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:11:59 +01:00
github-actions
8997f96540 📝 Update release notes 2020-11-25 17:07:41 +00:00
Ikkyu
b8331b13d7 🌐 Add Chinese translation for Advanced User Guide - Intro (#1445)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-25 18:07:17 +01:00
github-actions
7a3c244c07 📝 Update release notes 2020-11-25 16:40:33 +00:00
Sebastián Ramírez
7a692d2c7b 🍱 Update sponsor logos (#2418) 2020-11-25 17:40:07 +01:00
github-actions
b53c443a06 📝 Update release notes 2020-11-10 19:52:19 +00:00
Sebastián Ramírez
7d7289aeb8 💚 Fix disabling install of Material for MkDocs Insiders in forks, strike 1 (#2340) 2020-11-10 20:51:56 +01:00
github-actions
24b638faf6 📝 Update release notes 2020-11-10 19:38:22 +00:00
Sebastián Ramírez
2561a17225 🐛 Fix disabling Material for MkDocs Insiders install in forks (#2339) 2020-11-10 20:37:55 +01:00
github-actions
d8cfa8ac87 📝 Update release notes 2020-11-10 19:25:07 +00:00
Sebastián Ramírez
76083559f0 Add silver sponsor WeTransfer (#2338) 2020-11-10 20:24:42 +01:00
github-actions
df56655361 📝 Update release notes 2020-11-08 17:27:00 +00:00
Louis Guitton
2e67f2fa6d 📝 Add FastAPI monitoring blog post to External Links (#2324)
https://github.com/tiangolo/fastapi/issues/1828#issuecomment-723541832
2020-11-08 18:26:34 +01:00
github-actions
ac073b2f5f 📝 Update release notes 2020-11-08 11:43:23 +00:00
Sebastián Ramírez
4bcdbc5673 Set up and enable Material for MkDocs Insiders for the docs (#2325)
* ⬆️ Upgrade Material for MkDocs

* ⬆️ Install Material for MkDocs Insiders on CI

* 🔧 Update MkDocs configs to use Material for MkDocs Insiders

*  Use the lightbulb because it looks nice 💡

* 💚 Fix GitHub Action workflow syntax for building docs

* 🐛 Fix GitHub Actions workflow syntax, strike one 
2020-11-08 12:42:55 +01:00
github-actions
97adeca0a4 📝 Update release notes 2020-11-07 20:48:48 +00:00
Sebastián Ramírez
ac99792762 Add Discord chat (#2322)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2020-11-07 21:48:25 +01:00
github-actions
d01e0a10d8 📝 Update release notes 2020-11-07 18:55:35 +00:00
Sebastián Ramírez
de0f466ef8 ✏️ Fix typo in Deta tutorial (#2320) 2020-11-07 19:55:12 +01:00
Sebastián Ramírez
77f7447ee8 📝 Update release notes 2020-11-06 00:14:52 +01:00
github-actions
48827eb7fc 📝 Update release notes 2020-11-05 23:13:28 +00:00
Sebastián Ramírez
5786d2ef78 📝 Fix image links for sponsors (#2304) 2020-11-06 00:13:04 +01:00
Sebastián Ramírez
166088775a 🔖 Release version 0.61.2 2020-11-06 00:04:32 +01:00
Sebastián Ramírez
1052914c20 📝 Update release notes 2020-11-06 00:03:52 +01:00
github-actions
7bdc86b6b4 📝 Update release notes 2020-11-05 22:53:41 +00:00
Camila Gutierrez
733218f199 ✏️ Fix typo in Tutorial - Path Parameters (#2231) 2020-11-05 23:53:10 +01:00
github-actions
3fb6d2982f 📝 Update release notes 2020-11-05 22:52:49 +00:00
David Dobrinskiy
b323726d86 ✏ Fix a stylistic error in docs (#2206) 2020-11-05 23:52:17 +01:00
github-actions
2db2381b68 📝 Update release notes 2020-11-05 22:51:01 +00:00
atsumi
d31648c82e 🌐 Add Japanese translation for Advanced Tutorial - Response Directly (#2191)
* Add Japanese translation for Advanced - response-directly

* Apply suggestions from code review

Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>

Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-05 23:50:38 +01:00
github-actions
e6c2343691 📝 Update release notes 2020-11-05 22:45:29 +00:00
谭九鼎
ab0379ee52 ✏ Fix capitalizaiton typo in docs (#2204) 2020-11-05 23:44:56 +01:00
github-actions
790fa217f7 📝 Update release notes 2020-11-05 22:42:49 +00:00
Ammar Asmro
b892b5e028 ✏ Fix typo in docs (#2179) 2020-11-05 23:42:07 +01:00
github-actions
39eedb31f7 📝 Update release notes 2020-11-05 22:39:33 +00:00
谭九鼎
8355832c7c 📝 Update/fix links in docs to use HTTPS (#2165)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-05 23:39:09 +01:00
github-actions
5821ea8a69 📝 Update release notes 2020-11-05 22:34:08 +00:00
nukopy
3dbdc74366 ✏ Fix typos and add rewording in docs (#2159)
* docs: fix typo in chapter "Request Body" in "Tutorial - User Guide"

* docs: modify a sentence in chapter "Query Parameters and String Validations" in "Tutorial - User Guide"

* docs: fix two grammatical mistakes in chapter "Path Parameters and Numeric Validations" in "Tutorial - User Guide"
2020-11-05 23:33:06 +01:00
github-actions
939acef803 📝 Update release notes 2020-11-05 22:31:20 +00:00
nukopy
22a5960d36 📝 Fix code consistency in examples for Tutorial - User Guide - Path Parameters (#2158) 2020-11-05 23:30:09 +01:00
github-actions
8c5efe0b4b 📝 Update release notes 2020-11-05 22:29:07 +00:00
Teofilo Zosa
730ded2870 📝 Fix renamed parameter content_type typo (#2135) 2020-11-05 23:26:28 +01:00
github-actions
1a000d7e5f 📝 Update release notes 2020-11-05 22:24:33 +00:00
Taki Komiyama
104ee630fc 📝 Add Japanese translation for Tutorial - Security - First Steps (#2153)
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
2020-11-05 23:24:05 +01:00
github-actions
ea69c373ac 📝 Update release notes 2020-11-05 22:21:54 +00:00
Teofilo Zosa
9118749128 ✏ Fix minor typos in docs (#2122) 2020-11-05 23:20:55 +01:00
github-actions
87ad6a46e8 📝 Update release notes 2020-11-05 22:14:40 +00:00
Adrian
75c64b6e4c ✏ Fix typos in docs and source examples (#2102)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-05 23:14:17 +01:00
github-actions
ccd3b97f03 📝 Update release notes 2020-11-05 22:03:04 +00:00
Nutchanon Ninyawee
074d39fa17 ✏ Fix incorrect Celery URLs in docs (#2100) 2020-11-05 23:02:07 +01:00
github-actions
f1419322b3 📝 Update release notes 2020-11-05 21:58:33 +00:00
John Riebold
b8e6d18385 📌 Relax Swagger UI version pin (#2089) 2020-11-05 22:57:16 +01:00
github-actions
82a1300257 📝 Update release notes 2020-11-05 21:56:17 +00:00
Aaron Christianson
13d9de4a49 📝 Simplify intro to Python Types, all currently supported Python versions include type hints 🎉 (#2085) 2020-11-05 22:53:44 +01:00
github-actions
f931dd0717 📝 Update release notes 2020-11-05 21:44:18 +00:00
Sebastián Ramírez
24d2226326 Fix tags's declare (#2054) 2020-11-05 22:43:28 +01:00
github-actions
0c895f1eaf 📝 Update release notes 2020-11-05 21:42:54 +00:00
hitrust
c041c52d91 📝 Fix example code with sets in Tutorial - Body - Nested Models 2 (#2053) 2020-11-05 22:41:45 +01:00
github-actions
cc9e6b3484 📝 Update release notes 2020-11-05 21:39:59 +00:00
hitrust
dfcc6bc154 📝 Fix example code with sets in Tutorial - Body - Nested Models (#2052) 2020-11-05 22:38:59 +01:00
github-actions
7e708f7411 📝 Update release notes 2020-11-05 21:32:20 +00:00
Alejo Carballude
e09646441d ✏ Fix typo in Benchmarks (#1995) 2020-11-05 22:31:38 +01:00
github-actions
1631f981af 📝 Update release notes 2020-11-05 21:22:25 +00:00
Yurii Karabas
4ce18167e7 🐛 Fix bug overriding custom HTTPException and RequestValidationError from exception_handlers (#1924) 2020-11-05 22:21:40 +01:00
github-actions
a676899557 📝 Update release notes 2020-11-05 21:10:35 +00:00
Marcelo Trylesinski
b299792ebf ✏️ Fix typo on dependencies utils and cleanup unused variable (#1912) 2020-11-05 22:09:17 +01:00
github-actions
9fcec3abe9 📝 Update release notes 2020-11-05 21:05:15 +00:00
Daniel Murrell
5df00f3ec4 📝 Add note in CORS tutorial about allow_origins with ["*"] and allow_credentials (#1895) 2020-11-05 22:03:45 +01:00
github-actions
20ba6e8b97 📝 Update release notes 2020-11-05 20:51:04 +00:00
Sebastián Ramírez
a42c690496 📝 Add deployment to Deta, the first gold sponsor 🎉 (#2303)
* 📝 Add docs for sponsors

* 📝 Add docs for deploying on Deta

* 🍱 Add Deta docs screenshots

* ♻️ Refactor and separate deployment docs

* 📝 Update internal docs links to Deployment

* 📝 Update links in Deta tutorial

* 🍱 Update sponsors images

* 🔧 Use sponsors data from YAML

* 📝 Update sponsors in languages docs

*  Update docs generation scripts

*  Update README.md testing

* 📝 Update main README

* 🔧 Update fastapi-people action handling individual sponsors

* ✏️ Fix typos in Deta tutorial
2020-11-05 21:50:37 +01:00
github-actions
bed0f065fa 📝 Update release notes 2020-11-01 21:54:32 +00:00
SwftAlpc
76632fcf24 🌐 Add Japanese translation for Tutorial - Query Parameters and String Validations (#1901)
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
2020-11-01 22:54:05 +01:00
github-actions
32a010394f 📝 Update release notes 2020-11-01 21:40:13 +00:00
github-actions[bot]
8d572faa24 👥 Update FastAPI People (#2282)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-11-01 22:39:51 +01:00
github-actions
f495d98fae 📝 Update release notes 2020-10-25 18:48:12 +00:00
Camila Gutierrez
3702cef08d ✏️ Fix uppercase in Tutorial - Query Parameters (#2245) 2020-10-25 19:47:46 +01:00
github-actions
9474706ec2 📝 Update release notes 2020-10-25 18:46:59 +00:00
Sebastián Ramírez
e1755f4fa6 🔥 Cleanup after upgrade for Docs Previews GitHub Action (#2248)
* 🔧 Upload docs artifacts even on push to avoid breaking Preview Docs

* 🔥 Remove replaced GitHub Action get-artifact

* 🔥 Remove GitHub Action Watch Docs Previews, replaced with Preview Docs

* 🔥 Remove commented backup configs in Preview Docs GitHub Action

* 🔥 Remove no longer needed utils scripts
2020-10-25 19:46:32 +01:00
github-actions
c75c13c3b0 📝 Update release notes 2020-10-25 18:25:55 +00:00
Sebastián Ramírez
8673e1c127 📝 Add articles to External Links (#2247) 2020-10-25 19:25:31 +01:00
github-actions
360868fe25 📝 Update release notes 2020-10-25 18:12:21 +00:00
Sebastián Ramírez
b46b3f00bf 🐛 Fix unzip docs preview in CI (#2246) 2020-10-25 19:12:00 +01:00
github-actions
c6e950dc9c 📝 Update release notes 2020-10-25 17:54:58 +00:00
Sebastián Ramírez
4e74d40736 Add instant docs deploy previews for PRs from forks (#2244)
* 🔥 Disable action Watch Docs Previews

* 🔧 Use predefined name for docs artifacts for previews

*  Add new GitHub Action Comment Docs Preview in PR

* 🔧 Refactor GitHub Action Preview Docs to work as workflow_run using new action to extract where to comment
2020-10-25 18:54:36 +01:00
github-actions
612d114f3a 📝 Update release notes 2020-10-25 11:59:34 +00:00
Sebastián Ramírez
f88ffd1a0b ️ Build docs for languages in parallel in subprocesses to speed up CI (#2242) 2020-10-25 12:59:13 +01:00
github-actions
cdf0f8a933 📝 Update release notes 2020-10-24 11:33:24 +00:00
Sebastián Ramírez
8650dee4bc 🐛 Fix docs order generation for partial translations (#2238) 2020-10-24 13:32:59 +02:00
github-actions
dca9cc3ec5 📝 Update release notes 2020-10-18 20:19:45 +00:00
github-actions[bot]
d6f37b2138 👥 Update FastAPI People (#2202)
Co-authored-by: github-actions <github-actions@github.com>
2020-10-18 22:19:01 +02:00
github-actions
5a13f78078 📝 Update release notes 2020-10-18 20:16:53 +00:00
Sebastián Ramírez
d625963cc5 ♻️ Update FastAPI People GitHub Action to send the PR as github-actions (#2201) 2020-10-18 22:16:12 +02:00
github-actions
142710a0f3 📝 Update release notes 2020-10-18 20:05:19 +00:00
Sebastián Ramírez
47fcacd4d6 🔧 Update FastAPI People GitHub Action config, run monthly (#2199) 2020-10-18 22:04:32 +02:00
github-actions
00104c9259 📝 Update release notes 2020-10-18 19:57:42 +00:00
Sebastián Ramírez
8386e61f17 🐛 Fix FastAPI People GitHub Action Docker dependency, strike 1 (#2198) 2020-10-18 21:57:02 +02:00
github-actions
9b7125f66b 📝 Update release notes 2020-10-18 19:52:30 +00:00
Sebastián Ramírez
68dc9bd5ac 🐛 Fix FastAPI People GitHub Action Docker dependencies (#2197) 2020-10-18 21:51:51 +02:00
github-actions
7a02d862aa 📝 Update release notes 2020-10-18 19:45:51 +00:00
Sebastián Ramírez
479e87e467 🐛 Fix FastAPI People GitHub Action when there's nothing to change (#2196) 2020-10-18 21:45:10 +02:00
github-actions
1ea24e1813 📝 Update release notes 2020-10-18 19:36:23 +00:00
Sebastián Ramírez
492c0924c4 👥 Add new section FastAPI People (#2195)
* 👥 Update FastAPI People

*  Add first version of FastAPI People GitHub action code

* 🐳 Add Docker and configs for the FastAPI People GitHub Action

* 👷 Add GitHub Action workflow for FastAPI People

* 📝 Add FastAPI People to docs

* 💄 Add custom CSSs for FastAPI People
2020-10-18 21:35:42 +02:00
github-actions
048355f01d 📝 Update release notes 2020-10-18 07:05:30 +00:00
Fabio Serrao
fe889f38e8 🌐 Add Portuguese translation for External Links (#1443)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 09:04:47 +02:00
github-actions
1dd2bc7675 📝 Update release notes 2020-10-18 06:03:03 +00:00
T. Tokusumi
91ffa0ed27 🌐 Add Japanese translation for Tutorial - CORS (#2125)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 08:02:19 +02:00
github-actions
6ab0f89858 📝 Update release notes 2020-10-18 05:57:45 +00:00
Taki Komiyama
bfc9733660 🌐 Add Japanese translation for Contributing (#2067)
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 07:57:05 +02:00
github-actions
9c00618710 📝 Update release notes 2020-10-18 05:48:25 +00:00
T. Tokusumi
beedd199e8 🌐 Add Japanese translation for Project Generation (#2050)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 07:47:45 +02:00
github-actions
ae580deaea 📝 Update release notes 2020-10-18 05:38:53 +00:00
atsumi
e1231eeef1 🌐 Add Japanese translation for Alternatives (#2043)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 07:38:09 +02:00
github-actions
8a1ebb38e2 📝 Update release notes 2020-10-18 05:30:50 +00:00
Juan Sebastian Avila Rodriguez
e9413f2711 ✏ Fix typo in Spanish tutorial index (#2020) 2020-10-18 07:28:44 +02:00
github-actions
7434d2bec7 📝 Update release notes 2020-10-18 05:26:55 +00:00
Taki Komiyama
f2c565d8e4 🌐 Add Japanese translation for History Design and Future (#2002)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-18 07:26:14 +02:00
github-actions
cb55d7cdde 📝 Update release notes 2020-10-17 18:44:24 +00:00
Taki Komiyama
d513680005 🌐 Add Japanese translation for Benchmarks (#1992)
Co-authored-by: atsumi <atsumi.tatsuya@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 20:43:43 +02:00
github-actions
a5ee4d93d2 📝 Update release notes 2020-10-17 13:56:21 +00:00
SwftAlpc
3a2d4434ce 🌐 Add Japanese translation for Tutorial - Header Parameters (#1935)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 15:55:39 +02:00
github-actions
d1dfc812f1 📝 Update release notes 2020-10-17 13:46:12 +00:00
Sebastián Ramírez
0b76b675db ⬆️ Upgrade GitHub Action Latest Changes (#2190) 2020-10-17 15:45:33 +02:00
github-actions
5a776fbff5 📝 Update release notes 2020-10-17 13:40:03 +00:00
Sebastián Ramírez
7667605520 ⬆️ Upgrade GitHub Action Label Approved (#2189) 2020-10-17 15:39:24 +02:00
github-actions
642762564d 📝 Update release notes 2020-10-17 10:43:35 +00:00
Jéssica Paz
78ead585f8 🌐 Add Portuguese translation for Tutorial - First Steps (#1861)
Co-authored-by: deniscapeto <deniscapeto@gmail.com>
2020-10-17 12:41:44 +02:00
github-actions
48bf243050 📝 Update release notes 2020-10-17 06:43:16 +00:00
Sebastián Ramírez
0e920e6f02 🌐 Add Portuguese translation for Python Types (#1796)
* Portuguese translation python-types

* Change 'dicas de tipo' to 'type hints'
2020-10-17 08:40:31 +02:00
github-actions
afac22dfd2 📝 Update release notes 2020-10-17 06:39:20 +00:00
T. Tokusumi
2836e10e2d 🌐 Add Japanese translation for Help FastAPI (#1692)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:38:37 +02:00
github-actions
aa62d9212f 📝 Update release notes 2020-10-17 06:32:39 +00:00
T. Tokusumi
620bffc2b4 🌐 Add Japanese translation for Tutorial - Body (#1683)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:31:55 +02:00
github-actions
b56cf6c08f 📝 Update release notes 2020-10-17 06:24:33 +00:00
T. Tokusumi
cead6ba887 🌐 Add Japanese translation for Tutorial - Query Params (#1674)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:23:51 +02:00
github-actions
23772f3c49 📝 Update release notes 2020-10-17 06:15:44 +00:00
T. Tokusumi
45304562a6 🌐 Add Japanese translation for tutorial/path-params.md (#1671)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:15:05 +02:00
github-actions
3d767008df 📝 Update release notes 2020-10-17 06:09:43 +00:00
T. Tokusumi
5c6811c4ef Add Japanese translation for tutorial/first-steps.md (#1658)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:09:01 +02:00
github-actions
25e1a2602d 📝 Update release notes 2020-10-17 06:03:36 +00:00
T. Tokusumi
b6272a36af 🌐 Add Japanese translation for tutorial/index.md (#1656)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 08:02:56 +02:00
github-actions
db91255ede 📝 Update release notes 2020-10-17 05:51:31 +00:00
Fabio Serrao
ab52e1c7e4 🌐 Add translation to Portuguese for Project Generation (#1602)
* Portuguese translation project-generation

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/pt/docs/project-generation.md

* ✏ Fix typo in docs/pt/docs/project-generation.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-10-17 07:50:32 +02:00
github-actions
4924d08e7e 📝 Update release notes 2020-10-16 20:35:50 +00:00
Sebastián Ramírez
a7c65271ac 🔧 Update GitHub Action Label Approved, run at 12:00 (#2185) 2020-10-16 22:35:07 +02:00
github-actions
030f1f2ae2 📝 Update release notes 2020-10-16 20:09:35 +00:00
T. Tokusumi
74f13e522b 🌐 Add Japanese translation for Features (#1625)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
2020-10-16 22:08:18 +02:00
github-actions
a4f88f74f2 📝 Update release notes 2020-10-16 20:04:38 +00:00
Sebastián Ramírez
3826129b16 👷 Upgrade GitHub Action Latest Changes (#2184) 2020-10-16 22:04:12 +02:00
Sebastián Ramírez
636f06cd6b 📝 Update release notes 2020-10-15 07:26:26 +02:00
hard_coder
c8365bd339 🌐 Initialize new language Korean for translations (#2018) 2020-10-15 07:21:41 +02:00
Sebastián Ramírez
df38e53723 📝 Update release notes 2020-10-11 17:04:21 +02:00
Fabio Serrao
c606407929 🌐 Add Portuguese translation of Deployment (#1374) 2020-10-11 12:46:20 +02:00
github-actions
f59f85d755 📝 Update release notes 2020-10-11 10:41:42 +00:00
Sebastián Ramírez
42bb15de22 👷 Set GitHub Action Label Approved to run daily, not every minute (#2163) 2020-10-11 12:41:16 +02:00
Sebastián Ramírez
e96b002599 📝 Update release notes 2020-10-11 12:06:07 +02:00
github-actions
75b83ce3aa 📝 Update release notes 2020-10-11 10:04:35 +00:00
Sebastián Ramírez
ad5aa33864 🔥 Remove pr-approvals GitHub Action as it's not compatible with forks. Use the new one (#2162)
as it is not compatible with forks
2020-10-11 12:04:04 +02:00
Sebastián Ramírez
952cd736ac 👷 Add GitHub Action Label Approved (#2161) 2020-10-11 11:53:25 +02:00
Sebastián Ramírez
026039cae2 📝 Update release notes 2020-10-11 11:51:49 +02:00
Sebastián Ramírez
e2609dff95 👷 Add GitHub Action Latest Changes (#2160) 2020-10-11 11:50:04 +02:00
hitrust
8486b41349 Fix tags's declare 2020-09-15 14:40:49 +08:00
Sebastián Ramírez
e77ea63577 🔖 Release version 0.61.1 2020-08-29 16:30:50 +02:00
Sebastián Ramírez
097df92c1c 📝 Update release notes 2020-08-29 16:06:32 +02:00
Brock Friedrich
be669059fb 🎨 Simplify docs hl_lines ranges and standardize 2 spaces between each range (#1863) 2020-08-29 16:02:58 +02:00
Sebastián Ramírez
dfdd371c52 📝 Update release notes 2020-08-29 15:38:44 +02:00
ryuckel
e1e8627168 🌐 Add Japanese translation for index.md (#1571) 2020-08-29 15:34:08 +02:00
Sebastián Ramírez
0916c1c3ef 📝 Update release notes 2020-08-29 14:32:08 +02:00
Facundo Maero
11656f7bd5 ✏ Fix typo in nosql-databases.md (#1980)
Co-authored-by: Facundo Maero <facundo.maero@deepvisionai.com>
2020-08-29 14:30:23 +02:00
Sebastián Ramírez
483d092af8 📝 Update release notes 2020-08-29 14:29:00 +02:00
JulianMaurin
60aa63b68a 🌐 Initialize translations for French (#1975)
Co-authored-by: JulianMaurin <julian.maurin.perso@pm.me>
2020-08-29 14:27:34 +02:00
Sebastián Ramírez
eb547bd4fd 📝 Update release notes 2020-08-29 14:24:24 +02:00
Sebastián Ramírez
0dfde6e284 🐛 Fix issues introduced by removing sqlalchemy safeguard in jsonable_encoder (#1987) 2020-08-29 14:21:00 +02:00
Sebastián Ramírez
2d7038e03e 📝 Update release notes 2020-08-29 11:47:13 +02:00
Yağızcan Değirmenci
4f0a3a9e4d 🌐 Initialize Turkish translations (#1905) 2020-08-29 11:43:29 +02:00
Izabela Guerreiro
1701930c86 Change 'dicas de tipo' to 'type hints' 2020-08-11 10:23:23 -03:00
Sebastián Ramírez
a6897963d5 🔖 Release version 0.61.0 2020-08-09 22:36:47 +02:00
Sebastián Ramírez
c14803e3fa 📝 Update release notes 2020-08-09 22:34:50 +02:00
Sebastián Ramírez
cdba8481c2 🔥 Remove old/unused parameter sqlalchemy_safe from jsonable_encoder (#1864) 2020-08-09 22:32:59 +02:00
Sebastián Ramírez
64ca596a11 📝 Update release notes 2020-08-09 22:19:46 +02:00
Sebastián Ramírez
e1758d107e ⬆ Require Pydantic > 1.0 (#1862)
* 🔥 Remove support for Pydantic < 1.0

* 🔥 Remove deprecated skip_defaults from jsonable_encoder and set default for exclude to None, as in Pydantic

* ♻️ Set default of response_model_exclude=None as in Pydantic

* ⬆️ Require Pydantic >=1.0.0 in requirements
2020-08-09 22:17:08 +02:00
Sebastián Ramírez
3390182fc9 📝 Update release notes 2020-08-09 17:04:35 +02:00
Sebastián Ramírez
912a43ee3d 📝 Add link to TestDriven.io course in docs (#1860) 2020-08-09 17:02:51 +02:00
Sebastián Ramírez
4020304945 📝 Update release notes 2020-08-09 16:43:07 +02:00
Elliana May
0a2fc78fea ✏️ Update docs to remove gender-specific references (#1824)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-09 16:35:44 +02:00
Sebastián Ramírez
b91acfb457 📝 Update release notes 2020-08-09 15:58:58 +02:00
Nik
b9a0179a03 Add support for injecting HTTPConnection (#1827) 2020-08-09 15:56:41 +02:00
Rupsi Kaushik
5ed48ccdc8 Export WebSocketDisconnect and add example handling disconnections to docs (#1822)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-09 15:52:19 +02:00
Sebastián Ramírez
f32d67c8b9 📝 Update release notes 2020-08-09 13:12:09 +02:00
manlix
0752c7242d 🔊 Fix empty log message in docs example about raised exceptions (#1815) 2020-08-09 13:10:33 +02:00
Sebastián Ramírez
be855c696b 📝 Update release notes 2020-08-09 12:56:09 +02:00
Nima Mashhadi M. Reza
da9b5201c4 🔧 Add Flake8 linting (#1774)
Co-authored-by: nimashadix <nimashadix@pop-os.localdomain>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-09 12:54:05 +02:00
Sebastián Ramírez
4daa6ef4e4 📝 Update release notes 2020-08-09 11:08:29 +02:00
Sebastián Ramírez
4ad7c55618 💚 Disable Gitter notification as it's currently broken (#1853)
...no idea why yet. 😔
2020-08-08 20:43:31 +02:00
Sebastián Ramírez
79e08a2541 🔖 Release version 0.60.2 2020-08-08 20:23:16 +02:00
Sebastián Ramírez
1c9c80ba93 📝 Update release notes 2020-08-08 20:21:03 +02:00
Yağızcan Değirmenci
25cb05c876 ✏ Fix documentation typo in Query Parameters and String Validations (#1832) 2020-08-08 20:19:14 +02:00
Sebastián Ramírez
694fbab074 📝 Update release notes 2020-08-08 20:07:03 +02:00
Felix Böhm
2fd28434dd 📝 Add documentation about async tests (pytest-asyncio and httpx) (#1619)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-08 20:01:18 +02:00
Sebastián Ramírez
d15556b152 📝 Update release notes 2020-08-08 09:20:37 +02:00
Sebastián Ramírez
38d8bab770 Raise early when using form data without installing python-multipart (#1851)
* Check if Form exists and multipart is in virtual environment

* Remove unused import

* Move BodyFieldInfo check to separate helper function

* Fix type UploadFile to File for BodyFieldInfo check

* Working solution. Kind of nasty though.

* Use better method of determing if correct package imported

* Use better method of determing if correct package imported

* Add raising exceptions, update error messages

* Check if Form exists and multipart is in virtual environment

* Move BodyFieldInfo check to separate helper function

* Fix type UploadFile to File for BodyFieldInfo check

* Use better method of determing if correct package imported

* Add raising exceptions, update error messages
* Removed unused import, added comments

Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>

* Updated what kind of exception will be thrown

* Add type annotations

Adds annotations to is_form_data

* Fix import order

* Add basic tests

* Fixed Travis tests

* Replace logging with fastapi logger

* Change AttributeError to ImportError to fix exception handling

* Fixing tests

* Catch ModuleNotFoundError first

Fix code coverage

* Update fastapi/dependencies/utils.py

Remove error spaces when printing

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update fastapi/dependencies/utils.py

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Removed spaces in error printing

* ♻️ Refactor form data detection

*  Update/increase tests for incorrect multipart install

* 🔥 Remove deprecated Travis (moved to GitHub Actions)

Co-authored-by: yk396 <yk396@cornell.edu>
Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>
Co-authored-by: Kai Chen <kaichen120@gmail.com>
Co-authored-by: Chris N <hello@chris-nguyen.me>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2020-08-08 09:14:10 +02:00
Sebastián Ramírez
52f0f8657e 📝 Update release notes 2020-08-03 19:28:49 +02:00
Sebastián Ramírez
aedf5c895a 👷 Re-enable Gitter releases bot (#1831) 2020-08-03 19:28:02 +02:00
Sebastián Ramírez
117f9e4abe 📝 Update release notes 2020-08-03 18:38:27 +02:00
s2s
604fea9fc1 📝 Add link in sql-databases.md tutorial to async-sql-databases.md in advanced section. (#1813)
* Add link in sql-databases.md tutorial section to async-sql-databases.md in advanced section.

* 🎨 Update note format

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 18:37:02 +02:00
Sebastián Ramírez
994bfd4591 📝 Update release notes 2020-08-03 18:27:03 +02:00
Eduard Iskandarov
02722923b1 ✏ Fix documentation typo in behind a proxy tutorial (#1807) 2020-08-03 18:25:01 +02:00
Sebastián Ramírez
d63a93429b 📝 Update release notes 2020-08-03 18:14:15 +02:00
Izabela Guerreiro
b93e216dc7 ✏ Fix typo in portuguese docs (#1795) 2020-08-03 18:12:30 +02:00
Sebastián Ramírez
95a29b6e67 📝 Update release notes 2020-08-03 18:05:05 +02:00
Sebastián Ramírez
272f01a153 🌐 Add Ukrainian language setup, without index translation (#1830) 2020-08-03 18:04:05 +02:00
Sebastián Ramírez
1a345ae7fc 📝 Update release notes 2020-08-03 17:41:50 +02:00
Marcelo Trylesinski
c5c138b8eb 📝 Update external links (#1786)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 17:39:48 +02:00
Sebastián Ramírez
da20e33414 📝 Update release notes 2020-08-03 17:26:12 +02:00
Henry Betts
7fbe3737bc 🐛 Fix encoding a Pydantic model that inherits from another with json_encoders (#1769) 2020-08-03 17:24:29 +02:00
Sebastián Ramírez
f63cec9c95 📝 Update release notes 2020-08-03 15:32:03 +02:00
Nima Mashhadi M. Reza
3063ad83ec Simplify and improve jsonable_encoder (#1754)
Co-authored-by: nimashadix <nimashadix@pop-os.localdomain>
2020-08-03 15:30:23 +02:00
Sebastián Ramírez
78680e5bee 📝 Update relase notes 2020-08-03 15:19:33 +02:00
Yurii Karabas
55b9faeb48 ♻ Simplify code syntax in several places (#1753)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 15:16:51 +02:00
Sebastián Ramírez
72645dfeab 📝 Update release notes 2020-08-03 14:30:25 +02:00
Nima Mashhadi M. Reza
3223de5598 🎨 Add typing.Optional to variables that accept None as value (#1731)
Co-authored-by: nimashadix <nimashadix@pop-os.localdomain>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 14:29:07 +02:00
Sebastián Ramírez
1afa4e8e75 📝 Update release notes 2020-08-03 13:50:22 +02:00
नवुले पवन कुमार राव
6fd3736da2 📝 Add article: Deploy FastAPI on Azure App Service (#1726) 2020-08-03 13:48:30 +02:00
Sebastián Ramírez
7e043e5e6f 📝 Update release notes 2020-08-03 10:46:33 +02:00
Smart
d1585c42b9 📝 Add external link to starlette docs for WebSocket testing (#1717)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 10:45:22 +02:00
Sebastián Ramírez
fc494e3527 📝 Update release notes 2020-08-03 10:34:05 +02:00
Bloodielie
b344cc9415 ♻ Refactor and merge for loops in dependant creation (#1714)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 10:32:06 +02:00
Sebastián Ramírez
38b71a9298 📝 Update release notes 2020-08-03 09:55:21 +02:00
Francesco Frassinelli
769ee73240 📝 Add HTML media type to template docs (#1690)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 09:53:56 +02:00
Sebastián Ramírez
1df2f14c64 📝 Update release notes 2020-08-03 09:28:03 +02:00
Nils Lindemann
eab9a0e139 ✏ Fix typos and rewording in docs for security (#1678)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 09:27:02 +02:00
Sebastián Ramírez
b86ac6739a 📝 Update release notes 2020-08-03 09:13:17 +02:00
Nils Lindemann
9840d9e59d ✏ Fix typos in docs for dependencies (#1675)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 09:12:07 +02:00
Sebastián Ramírez
0ec52157df 📝 Update release notes 2020-08-03 08:46:50 +02:00
Bar Harel
f1c5330b65 🐛 Fix app.extra type annotation (#1659)
Co-authored-by: bar.harel <bar.harel@biocatch.com>
2020-08-03 08:43:04 +02:00
Sebastián Ramírez
306ec8de04 📝 Update release notes 2020-08-03 08:35:05 +02:00
Adrien Cacciaguerra
6d7c9893d4 ⬆️ Bump mkdocs-material (#1789) 2020-08-03 08:33:43 +02:00
Sebastián Ramírez
6264709054 📝 Update release notes 2020-08-03 08:11:00 +02:00
Sebastián Ramírez
76c2077f47 👷 Update docs previews, remove commit comments (#1826)
as previews use the latest commit from master
2020-08-03 08:09:58 +02:00
Izabela Guerreiro
9cc4428de3 Portuguese translation python-types 2020-07-26 23:00:28 -03:00
Sebastián Ramírez
a63b1efc29 📝 Update release notes 2020-07-22 10:29:49 +02:00
Sebastián Ramírez
9863c3fca8 🐛 Update GitHub action context var for Gitter bot (#1766) 2020-07-22 10:28:27 +02:00
Sebastián Ramírez
6fb97f44cf 📝 Update release notes 2020-07-22 08:47:48 +02:00
Sebastián Ramírez
f64c448329 🔖 Release version 0.60.1 2020-07-22 08:44:44 +02:00
Sebastián Ramírez
df6cbc5ec6 📝 Update release notes 2020-07-22 08:44:13 +02:00
Sebastián Ramírez
0f0af751e4 🔊 Add debugging logs for GitHub actions to introspect GitHub hidden context (#1764) 2020-07-22 08:43:26 +02:00
Sebastián Ramírez
6c9dca55bc 📝 Update release notes 2020-07-22 08:32:22 +02:00
Adrien Cacciaguerra
d71e807401 💄 Use OS preference theme for docs (#1760) 2020-07-22 08:30:12 +02:00
Sebastián Ramírez
7df9ddfe4e 📝 Update release notes 2020-07-22 08:28:31 +02:00
James Alford-Golojuch
4170659359 ⬆ Updates Starlette to version 0.13.6 (#1759)
Co-authored-by: jalfordgolojuch <jalfordgolojuch@activecampaign.com>
2020-07-22 08:25:32 +02:00
Sebastián Ramírez
2940a7fdfa 📝 Update release notes 2020-07-22 08:23:36 +02:00
Sebastián Ramírez
dadd6650ed 📌 Pin Swagger UI temporarily 2020-07-22 08:19:26 +02:00
Sebastián Ramírez
c5a21354af 📝 Update release notes 2020-07-21 23:10:52 +02:00
Sebastián Ramírez
8bafe2a482 🚀 GitHub Actions update, use commit from PR, not pre-merge (#1761)
* 🔥 Remove deploy badge that won't show correctly until next release

after the fixes to the Gitter bot

* 🐛 Fix GitHub Action to upload docs artifacts with commit from PR, not pre-merge

* ♻️ Run zip docs and artifact upload only on PRs
2020-07-21 23:08:14 +02:00
Sebastián Ramírez
42f1716b48 📝 Update release notes 2020-07-20 18:57:01 +02:00
Sebastián Ramírez
6ab2841dbb ♻ Update GitHub actions (#1746)
* 🐛 Fix Gitter notification, use development gitter room until next release

* 🔥 Remove trigger docs preview step from build-docs workflow

as it requires a more privileged token, so it's now triggered by the preview docs watcher

* 🔊 Dump context when building to allow debugging how to refactor the Gitter bot
2020-07-20 18:56:13 +02:00
Sebastián Ramírez
0f54657377 🔖 Release version 0.60.0 2020-07-20 18:26:56 +02:00
Sebastián Ramírez
79e5b36551 📝 Update release notes (#1745)
* 📝 Update release notes

* 📝 Update release notes
2020-07-20 18:22:29 +02:00
Sebastián Ramírez
074868d77e Run watch docs previews every hour 2020-07-20 17:55:02 +02:00
Sebastián Ramírez
3dd16a9458 Fetch artifacts only once in preview docs GitHub action 2020-07-20 17:48:43 +02:00
Sebastián Ramírez
62c23ab5fa 🔒 Use personal access token to trigger docs previews 2020-07-20 17:45:28 +02:00
Sebastián Ramírez
11c05beece 🔊 Add more logging to Watch Preview when artifact is not found 2020-07-20 17:13:27 +02:00
Sebastián Ramírez
7b3ef43127 🐛 Fix Watch Preview Docs GitHub Action, strike 2 2020-07-20 16:59:09 +02:00
Sebastián Ramírez
e0080e5f75 🐛 Fix Watch Previews action 2020-07-20 16:47:48 +02:00
Sebastián Ramírez
e1ba54bd12 🔧 Update Watch Docs Previews GitHub action 2020-07-20 16:35:26 +02:00
Sebastián Ramírez
7032dfb4f1 Add GitHub Action to watch for missing preview docs (#1740)
* 📝 Update release notes

* 🔊 Make curl verbose when triggering docs preview

* 🔧 Update GitHub Actions circus to use commit hash

*  Add PR docs preview watcher
2020-07-20 16:33:17 +02:00
Sebastián Ramírez
14e7f7c1f4 ⬆ Upgrade Deploy to Netlify action 2020-07-19 22:27:32 +02:00
Sebastián Ramírez
9ed6f1e419 🐛 Fix custom GitHub action 2020-07-19 22:22:25 +02:00
Sebastián Ramírez
b268c39758 Add internal GitHub action to deploy docs previews (#1739)
* 📝 Update release notes

*  Add internal GitHub action to pull docs artifact

* 🙈 Add archive.zip to gitignore
2020-07-19 22:11:28 +02:00
Sebastián Ramírez
4dd386b807 🚀 Preview docs for external PRs (#1738)
* 🍱 Save docs zip when building docs

* 🙈 Add docs.zip artifact to .gitignore

* 🚀 Update deploy artifact name

* ♻️ Upload artifact directory

*  Add WIP trigger docs preview

* ♻️ Update trigger docs preview

* 👷 Update env vars for docs preview

* 👷 Update PR extraction

* 👷 Try to show GitHub event

* 💚 Try to see if GitHub context templates is causing the problem

* 💚 Try to debug context GitHub event

* 🔊 Debug GitHub event context

* 👷 Update debugging action

* 👷 Update debug

* 👷 Update Action

* ♻️ Update script to trigger docs preview

* ️ Try to use Zip again to improve speed

* 🔧 Update zip scripts

*  Add preview docs on event

* 🚀 Trigger deploy preview on PRs

* 🐛 Fix trigger script env vars
2020-07-19 20:49:52 +02:00
Sebastián Ramírez
b7251f1654 📝 Update release notes 2020-07-19 14:25:28 +02:00
Sebastián Ramírez
780d3e65ad Add XML coverage report for GitHub Actions (#1737) 2020-07-19 14:24:24 +02:00
Sebastián Ramírez
cc8cac200f 📝 Update release notes 2020-07-19 14:10:51 +02:00
Sebastián Ramírez
e7be5c8ac5 💄 Update badges, remove Travis (#1736)
* 💄 Update badges

* 🔥 Remove Travis
2020-07-19 14:09:55 +02:00
Sebastián Ramírez
8f52864899 📝 Update release notes 2020-07-19 14:04:45 +02:00
Sebastián Ramírez
47a630721a 👷 Add GitHub Actions, move from Travis (#1735) 2020-07-19 14:03:38 +02:00
Sebastián Ramírez
10ae6de111 📝 Update release notes 2020-07-19 12:19:39 +02:00
JAYATI SHRIVASTAVA
2b47f3e56b Add support for adding OpenAPI schema for GET requests with a body (#1626)
* add test for get request body's openapi schema

* 📝 Update docs note for GET requests with body

*  Update test for GET request with body, test it receives the body

* 🔇 Temporary type ignore while it's handled in Pydantic

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-19 12:17:50 +02:00
Sebastián Ramírez
d60dd1b60e 🔖 Release version 0.59.0 2020-07-10 20:41:35 +02:00
Sebastián Ramírez
2822f7ca64 📝 Update release notes 2020-07-10 20:32:16 +02:00
tomarv2
ff6afeaf78 ✏ Fix docstring typo for oauth2 utils (#1621) 2020-07-10 20:31:15 +02:00
Sebastián Ramírez
74852d406c 📝 Update release notes 2020-07-10 20:26:29 +02:00
Brian Mboya
921642dc7b 📝 Update JWT docs to use python-jose (#1610)
* 📝 Update JWT docs with python-jose

* 📝 Update format and use python-jose in docs

*  Add Python-jose to dependencies

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-10 20:24:38 +02:00
Sebastián Ramírez
5c01d44ee9 📝 Update release notes 2020-07-10 19:46:36 +02:00
Sebastián Ramírez
135704dcc8 🐛 Re-enable search bar after adding markdown-data plugin (#1703) 2020-07-10 19:45:47 +02:00
Sebastián Ramírez
88793bb6c2 📝 Update release notes 2020-07-10 19:34:22 +02:00
Rupsi Kaushik
70a51b3aff Auto-generate OpenAPI servers from root_path (#1596)
* root_path included in servers object instead of path prefix

* ♻️ Refactor implementation of auto-including root_path in OpenAPI servers

* 📝 Update docs and examples for Behind a Proxy, including servers

* 📝 Update Extending OpenAPI as openapi_prefix is no longer needed

*  Add extra tests for root_path in servers and root_path_in_servers=False

* 🍱 Update security docs images with relative token URL

* 📝 Update security docs with relative token URL

* 📝 Update example sources with relative token URLs

*  Update tests with relative tokens

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-10 19:28:18 +02:00
Sebastián Ramírez
340a582be7 📝 Update release notes 2020-07-10 14:48:42 +02:00
Sebastián Ramírez
5f66b5466f ✏️ Fix external links typo/link (#1702) 2020-07-10 14:47:56 +02:00
Sebastián Ramírez
d2169ee567 📝 Update release notes 2020-07-10 14:35:28 +02:00
Sebastián Ramírez
a5c03ba1b7 External links in docs with data file (#1701)
*  Add mkdocs-markdownextradata-plugin for docs

* 🔧 Update MkDocs config file(s) to include external data

*  Add external links data file

* 📝 Use external data file in External Links

* ♻️ Update data files for langs

The cost is some duplication 😔, these files are updated by the script, but to be able to serve locally they have to be duplicated

*  Update docs script to copy data files

* 🔥 Remove needed duplication of data files for live docs in translations
2020-07-10 14:31:44 +02:00
Sebastián Ramírez
e4ea6426dc 📝 Update release notes 2020-07-10 12:24:03 +02:00
Davide Fiocco
8bf7cd1dc6 📝 Fix link to edit External Links, add additional link (#1669)
Added a link to the correct link to editing the en docs, plus an additional example (of mine!) which got some buzz on social media:
https://twitter.com/monodavide/status/1276913357388382212
https://madewithml.com/projects/1649/model-serving-using-fastapi-and-streamlit/
2020-07-10 12:21:46 +02:00
Sebastián Ramírez
92feb3ade7 📝 Update release notes 2020-07-10 11:18:28 +02:00
Katherine Bancroft
d0e739d8f2 📝 Add note in docs on order in Pydantic Unions (#1591)
* Add note on order in Unions

* Add an example of Union order

Co-authored-by: kbanc <katherine.bancoft@gmail.com>
2020-07-10 11:16:46 +02:00
Sebastián Ramírez
4efa6bd75e 📝 Update release notes 2020-07-10 11:09:43 +02:00
Sebastián Ramírez
600f15faa0 ✔ Improve support for tests in editor (#1699)
* ♻️ Remove required extra steps to test in editor

* 🎨 Format lint script

* 📝 Remove obsolete extra steps required to test in editor from docs

* 🐛 Fix coverage
2020-07-10 11:08:19 +02:00
Sebastián Ramírez
250fa519f9 📝 Update release notes 2020-07-10 00:16:35 +02:00
Sebastián Ramírez
3c6dafcc8e 📌 Pin dependencies (#1697)
* 📌 Pin dependencies

* 🐛 Fix config in pyproject.toml
2020-07-10 00:15:39 +02:00
Sebastián Ramírez
8447000eee 📝 Update release notes 2020-07-09 20:09:38 +02:00
Brian Mboya
fe453f80ed ⬆ Upgrade isort to version 5.x.x (#1670)
* Update isort script to match changes in the new release, isort v5.0.2

* Downgrade isort to version v4.3.21

* Add an alternative flag to --recursive in isort v5.0.2

* Add isort config file

* 🚚 Import from docs_src for tests

* 🎨 Format dependencies.utils

* 🎨 Remove isort combine_as_imports, keep black profile

* 🔧 Update isort config, use pyproject.toml, Black profile

* 🔧 Update format scripts to use explicit directories to format

otherwise it would try to format venv env directories, I have several with different Python versions

* 🎨 Format NoSQL tutorial after re-sorting imports

* 🎨 Fix format for __init__.py

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-09 20:06:12 +02:00
Sebastián Ramírez
3ff504f03f 🔖 Release version 0.58.1 2020-06-28 23:48:30 +02:00
Sebastián Ramírez
eea9ab6106 📝 Update release notes 2020-06-28 23:43:30 +02:00
Sebastián Ramírez
e9e07c41bb 🎨 Add format, finishing period 2020-06-28 23:42:32 +02:00
Eyitayo Ogunbiyi
17a5e18f46 📝 Add link to all valid pydantic data types (#1612) 2020-06-28 23:40:45 +02:00
Sebastián Ramírez
9148bd8b6f 📝 Update release notes 2020-06-28 23:38:49 +02:00
Dmytro Petruk
39766d0f96 🐛 Fix link in warning logs (#1611)
Co-authored-by: Dmytro Petruk <petruk@ebu.ch>
2020-06-28 23:37:42 +02:00
Sebastián Ramírez
2d9bca56b2 📝 Update release notes 2020-06-28 23:35:21 +02:00
molto
f158d95ce9 📝 Fix bad link in docs (#1603)
Co-authored-by: lookyun <lookyun0504@outlook.com>
2020-06-28 23:34:28 +02:00
Sebastián Ramírez
7a4164ef60 📝 Update release notes 2020-06-28 23:30:22 +02:00
Brian Mboya
f3730a79af 🙈 Add vim temporary files to gitignore (#1590)
Co-authored-by: asheux <brianashiundu000@gmail.com>
2020-06-28 23:28:35 +02:00
Sebastián Ramírez
42eff23a79 📝 Update release notes 2020-06-28 23:27:40 +02:00
Andreas Schlapbach
25bc33350d ✏ Fix typo in sub-applications (#1578) 2020-06-28 23:26:35 +02:00
Sebastián Ramírez
b84d082005 📝 Update release notes 2020-06-28 20:21:38 +02:00
Sebastián Ramírez
1f01ce9615 📝 Use Optional in docs (#1644)
* Updated .py files with Optional tag (up to body_nested_models)

* Update optionals

* docs_src/ all updates, few I was unsure of

* Updated markdown files with Optional param

* es: Add Optional typing to index.md

* Last of markdown files updated with Optional param

* Update highlight lines

* it: Add Optional typings

* README.md: Update with Optional typings

* Update more highlight increments

* Update highlights

* schema-extra-example.md: Update highlights

* updating highlighting on website to reflect .py changes

* Update highlighting for query-params & response-directly

* Address PR comments

* Get rid of unnecessary comment

*  Revert Optional in Chinese docs as it probably also requires changes in text

* 🎨 Apply format

*  Revert modified example

* ♻️ Simplify example in docs

* 📝 Update OpenAPI callback example to use Optional

*  Add Optional types to tests

* 📝 Update docs about query params, default to using Optional

* 🎨 Update code examples line highlighting

* 📝 Update nested models docs to use "type parameters" instead of "subtypes"

* 📝 Add notes about FastAPI usage of None

including:

= None

and

= Query(None)

and clarify relationship with Optional[str]

* 📝 Add note about response_model_by_alias

* ♻️ Simplify query param list example

* 🔥 Remove test for removed example

*  Update test for updated example

Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>
Co-authored-by: yk396 <yk396@cornell.edu>
Co-authored-by: Kai Chen <kaichen120@gmail.com>
2020-06-28 20:13:30 +02:00
Sebastián Ramírez
352c5f5ecc 📝 Update release notes 2020-06-28 13:59:20 +02:00
Sebastián Ramírez
e5594e860f Update response_model_by_alias (#1642)
* Make openapi models honor response_model_by_alias

* Add test for response_model_by_alias working with openapi models

*  Revert changes

*  Update and extend tests for response_model_by_alias

*  Revert test name change

* 📌 Pin Pytest and Pytest-Cov

Co-authored-by: Martin Zaťko <martin.zatko@kiwi.com>
2020-06-28 13:58:21 +02:00
Sebastián Ramírez
50926faead 📝 Update release notes 2020-06-27 20:32:34 +02:00
Sebastián Ramírez
a303afc0e5 📝 Update release notes 2020-06-27 20:32:34 +02:00
Sebastián Ramírez
12607e85e3 📝 Update release notes 2020-06-27 20:32:34 +02:00
Xie Wei
38fd363e89 🌐 Add chinese translation for body-fields.md (#1569)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-27 20:29:41 +02:00
Xie Wei
7f62cfd231 🌐 Update Chinese translation for index.md (#1564)
* keep up-to-date with main version

* fix 2 ignored quotes
2020-06-27 20:24:10 +02:00
Xie Wei
c5168bd036 🌐 Add Chinese translation for body-multiple-params.md (#1532)
* add chinese translation for body-multiple-params.md

* improve translations

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-27 20:18:10 +02:00
Sebastián Ramírez
be472c5215 📝 Update release notes 2020-06-27 20:13:07 +02:00
Xie Wei
adac38ecea Add Chinese translation for path-params-numeric-validations.md (#1506)
* add chinese translation for path-params-numeric-validations.md

* improve translations
2020-06-27 20:10:32 +02:00
Sebastián Ramírez
c8b634226e 📝 Update release notes 2020-06-27 20:00:21 +02:00
Sebastián Ramírez
ca4cf7cc70 Add GitHub action to label approved PRs (#1638) 2020-06-27 19:59:10 +02:00
Sebastián Ramírez
b87072bc12 🔖 Release version 0.58.0 2020-06-15 13:18:36 +02:00
Sebastián Ramírez
04e2bfafbc 📝 Update release notes 2020-06-15 13:13:53 +02:00
Sebastián Ramírez
181a32236a Deep merge OpenAPI responses (#1577)
* override successful response

*  Add deep_dict_udpate

*  Merge additional responses with generated responses

* 🍱 Update docs screenshot

Co-authored-by: rkbeatss <rkaus053@uottawa.ca>
2020-06-15 13:12:12 +02:00
Sebastián Ramírez
1f54a8e0a1 📝 Update release notes 2020-06-15 12:42:48 +02:00
Andrew
d63475bb7d 📝 Mention in docs that subapps don't fire events (#1554)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-14 18:25:10 +02:00
Sebastián Ramírez
5a3c5f1523 📝 Update release notes 2020-06-14 18:12:51 +02:00
Andrew
12bc9285f7 🐛 Fix body validation error response, remove variable name when it is not embedded (#1553) 2020-06-14 18:07:39 +02:00
Sebastián Ramírez
31df2ea940 📝 Update release notes 2020-06-14 17:56:12 +02:00
Sebastián Ramírez
50b90dd6a4 📝 Update release notes 2020-06-14 17:55:13 +02:00
Andrew
7dd881334d 🐛 Fix testing security scopes when using dependency overrides (#1549)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-14 17:54:46 +02:00
Vinny Do
530fc8ff3f 🐛 Fix JSON Schema "not" keyword (#1548) 2020-06-14 15:46:49 +02:00
Sebastián Ramírez
ef460b4d23 📝 Update release notes 2020-06-14 15:40:18 +02:00
mikaello
b591de2ace Add support for OpenAPI servers metadata (#1547)
* feat: add servers option for OpenAPI

Closes #872

*  Use dicts for OpenAPI servers

* ♻️ Update OpenAPI Server model to support relative URLs

*  Add tests for OpenAPI servers

* ♻️ Re-order parameter location of servers for OpenAPI

* 🎨 Format code

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-14 15:38:29 +02:00
Sebastián Ramírez
34c857b7cb 🔖 Release version 0.57.0 2020-06-13 23:13:25 +02:00
Sebastián Ramírez
c78bc0c82d 📝 Update release notes 2020-06-13 23:08:20 +02:00
JAYATI SHRIVASTAVA
194446e51a 🔥 Remove broken external link (#1565) 2020-06-13 23:07:11 +02:00
Sebastián Ramírez
777e2151e6 📝 Update release notes 2020-06-13 22:55:30 +02:00
Sebastián Ramírez
5ce5bdba0b 📝 Update release notes 2020-06-13 22:52:59 +02:00
Chih Sean Hsu
e4300769ac 📝 Update tutorial for WebSockets with dependencies (#1540)
* fix websockets/tutorial002.py

* fix tutorial002 in ws to correspond with test case

* reformat websocket tutorial002

* fix websocket tutorial002 coverage

* 📝 Update example for WebSockets with Depends

*  Update and refactor tests for WebSockets with dependencies

* 👷 Trigger Travis, as it's not reporting to Codecov

*  Update WebSocket tests to raise coverage

Co-authored-by: Chih Sean Hsu <Sean@Sean-Mac.local>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 22:51:34 +02:00
retnikt
c6dd627bdd Add support for Python's http.HTTPStatus in status_code (#1534)
* Normalise IntEnums to ints for route status codes

Closes #1349

* add tests for status code enum support

* add docs for status code enum support

* add endpoint test for enum status code

* 📝 Update note about http.HTTPStatus

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 19:40:10 +02:00
Sebastián Ramírez
6576f724bb 📝 Update release notes 2020-06-13 19:22:08 +02:00
Sebastián Ramírez
91a6736d0e 📝 Update release notes 2020-06-13 19:20:48 +02:00
Patrick Wang
8fb755703d When using Pydantic models with __root__ use the internal value in jsonable_encoder (#1524) 2020-06-13 19:20:11 +02:00
Yankee
748bedd37c 📝 Updated docs for path-params (#1521)
* Added response example; URL for quick access; typo fixes

* Added line breaks for readability

* Fix typo on redoc url

* 📝 Update format, links, rewordings

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 19:14:23 +02:00
Sebastián Ramírez
bf58788f29 📝 Update release notes 2020-06-13 18:54:47 +02:00
Yankee
5f78ba4a31 📝 Update docs for first-steps, links, rewordings (#1518)
* ✏️ Typo/readability fixes for first-steps documentation

* 📝 Update link and small rewordings

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 18:53:31 +02:00
Sebastián Ramírez
db9f827263 📝 Update release notes 2020-06-13 18:18:27 +02:00
TiewKH
dd9e94cf21 Enable showCommonExtensions and showExtensions in SwaggerUI (#1466)
* Set showExtensions and showCommonExtensions to true

* Clean up comma

Co-authored-by: tiewkeehui <keehuitiew@airasia.com>
2020-06-13 18:16:34 +02:00
Sebastián Ramírez
e482d74241 📝 Update release notes 2020-06-13 18:13:06 +02:00
Richard Hoekstra
bd2acbcabb Export OAuth2PasswordRequestFormStrict from security (#1462)
* Update __init__.py

Fixes an import error:     

from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestFormStrict
ImportError: cannot import name 'OAuth2PasswordRequestFormStrict'

* Simplify import of OAuth2PasswordRequestFormStrict

* Simplify import of OAuth2PasswordRequestFormStrict
2020-06-13 18:08:08 +02:00
Sebastián Ramírez
f913d469a8 📝 Update release notes 2020-06-13 18:05:22 +02:00
Roman Tezikov
66cb266641 📝 Add docs for default_response_class (#1455)
*  Add docs to default_response_class

*  create a tip

*  fixing the tip

* 🚑 grammar

* 📝 Update docs for default response class

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 18:02:45 +02:00
Sebastián Ramírez
74954894c5 📝 Update release notes 2020-06-13 15:26:42 +02:00
William Hayes
ceedfccde0 📝 Document additional parameters for response_model (#1427)
* Documented additional parameters

These are included in a recent PR (https://github.com/tiangolo/fastapi/pull/1166) but not in the docs yet.
* response_model_exclude_none
* response_model_exclude_defaults

* 📝 Update note about response_model_exclude_defaults and response_model_exclude_none

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 15:23:29 +02:00
Sebastián Ramírez
2ee0eedf23 📝 Update release notes 2020-06-13 15:08:10 +02:00
Koudai Aono
c0f3019764 📝 Add PyCharm Pydantic plugin to docs (#1420)
* add pydantic pycharm plugin in document

* 📝 Update PyCharm Pydantic plugin note

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 15:05:59 +02:00
Sebastián Ramírez
dd6d0cb23c 📝 Update release notes 2020-06-13 14:51:21 +02:00
Chen Rotem Levy
fe15620df3 🎨 Update and clarify testing function name (#1395)
test_create_existing_token -> test_create_existing_item
2020-06-13 14:50:14 +02:00
Sebastián Ramírez
6af857f206 📝 Update release notes 2020-06-13 14:47:03 +02:00
obataku
7ce756f9dd 🐛 Fix duplicated headers set by indirect dependencies (#1386)
* Added test for repeating cookies in response headers

* update `response` headers, status code to match `sub_response` in `solve_dependencies` only if necessary; fix formatting of scottsmith2gmail's test

* restore code coverage, remove dead code from `solve_dependencies`

Co-authored-by: Scott Smith <scott.smith.2@gmail.com>
2020-06-13 14:44:51 +02:00
Sebastián Ramírez
c0b1fddb31 📝 Update release notes 2020-06-13 14:39:58 +02:00
Nick Rushton
9aea85a84e ⬆ Upgrade Starlette dependency to 0.13.4 (#1361) 2020-06-13 14:38:08 +02:00
Sebastián Ramírez
fddd1c12de 📝 Update release notes 2020-06-13 14:36:27 +02:00
Aviram Hassan
b13a4baf32 Add better JSON decode error handling, improve feedback for client after invalid JSON requests (#1354)
* Request body error, raise RequestValidationError instead of HTTPException in case JSON decode failure

* add missing test case for body general exception
2020-06-13 14:33:27 +02:00
Sebastián Ramírez
5ffa18f10f 📝 Update release notes 2020-06-13 14:06:12 +02:00
Sebastián Ramírez
828915baf5 📝 Update Tags metadata title 2020-06-13 14:02:58 +02:00
Thomas Maschler
a071ddf3cd Add support for tag metadata in OpenAPI (#1348)
* Allow to add OpenAPI tag descriptions

* fix type hint

* fix type hint 2

* refactor test to assure 100% coverage

* 📝 Update tags metadata example

* 📝 Update docs for tags metadata

*  Move tags metadata test to tutorial subdir

* 🎨 Update format in applications

* 🍱 Update docs UI image based on new example

* 🎨 Apply formatting after solving conflicts

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 13:58:06 +02:00
Sebastián Ramírez
3651b8a30f 📝 Update release notes 2020-06-13 12:27:00 +02:00
Sebastián Ramírez
0d73b9ff1c 🔧 Add basic setup for Russian translations (#1566) 2020-06-13 12:26:15 +02:00
Sebastián Ramírez
43235cf236 📝 Update release notes 2020-06-13 09:47:36 +02:00
Xie Wei
269a155583 🔥 Remove obsolete Chinese articles after translations (#1510) 2020-06-13 09:45:48 +02:00
Sebastián Ramírez
12433d51dd 📝 Update release notes 2020-06-13 01:25:29 +02:00
Rupsi Kaushik
3699e17212 Implement __repr__ methods for path parameters to simplify debugging (#1560)
* repr description added to Depends class

* repr description added to Security subclass

* get rid of __repr__ in security since it will inherit from super

* make code format consistent with rest

* add desc for rest of the classes

* Update fastapi/params.py

remove trailing whitespace

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Implement __repr__

* fix formatting

* formatting again

* ran formatting

* added basic testing

* basic tests added to rest of the classes

* added more test coverage and simplified test file

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Jayati Shrivastava <gaurijove@gmail.com>
2020-06-13 01:22:30 +02:00
Sebastián Ramírez
8231fbede4 🔖 Release version 0.56.1 2020-06-13 01:17:06 +02:00
Sebastián Ramírez
50bc14b835 📝 Update release notes 2020-06-13 01:14:58 +02:00
Kai Chen
4310c89c83 📝 Add link to Advanced User Guide: response status code (#1512) 2020-06-13 01:12:59 +02:00
Sebastián Ramírez
d39dd06a22 📝 Update release notes 2020-06-13 00:57:34 +02:00
kota matsuoka
a0ab47e89e 🎨 Remove unused f-string (#1526) 2020-06-13 00:56:00 +02:00
Sebastián Ramírez
5cbcb9a965 📝 Update release notes 2020-06-13 00:55:30 +02:00
Xie Wei
801ceaec80 🌐 Add Chinese translation for query-params-str-validations.md (#1500)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 00:53:00 +02:00
Sebastián Ramírez
c7334ae9f8 📝 Update release notes 2020-06-13 00:50:22 +02:00
Xie Wei
d737599a2c 🌐 Add Chinese translation for body.md (#1492)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 00:47:50 +02:00
Sebastián Ramírez
d2d72a8e4a 📝 Update release notes 2020-06-13 00:43:07 +02:00
Xie Wei
7895c12fa1 🌐 Add Chinese translation for help-fastapi.md (#1465)
* add chinese translation for help-fastapi.md

* improve translations

Co-authored-by: Waynerv <wei.xie@woqutech.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 00:40:05 +02:00
Sebastián Ramírez
5f6a14c413 📝 Update release notes 2020-06-13 00:29:43 +02:00
Xie Wei
2b4e88fa98 🌐 Add Chinese translation for query-params.md (#1454)
Co-authored-by: Waynerv <wei.xie@woqutech.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 00:26:40 +02:00
Sebastián Ramírez
11723bca27 📝 Update release notes 2020-06-13 00:21:53 +02:00
Xie Wei
b49517a64f 🌐 Add Chinese translation for contributing.md (#1460)
Co-authored-by: Waynerv <wei.xie@woqutech.com>
2020-06-13 00:18:57 +02:00
Sebastián Ramírez
f910e0c96c 📝 Update release notes 2020-06-13 00:18:20 +02:00
Xie Wei
c1ba2a3127 🌐 Add Chinese translation for path-params.md (#1453)
* add chinese translation for path-params.md

* improve translations

* improve translations

Co-authored-by: Waynerv <wei.xie@woqutech.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 00:14:58 +02:00
Sebastián Ramírez
28396173c7 📝 Update release notes 2020-06-13 00:09:41 +02:00
Kabir Khan
69974b792e 📝 Add cookiecutter-spacy-fastapi to docs (#1390) 2020-06-13 00:06:53 +02:00
Sebastián Ramírez
352412a3cb 📝 Update release notes 2020-06-12 23:46:05 +02:00
yaegassy
745ab48d65 📝 Add docs in Python Types for Optional (#1377)
* docs: Fix pydantic example in python-types.md

* 📝 Update Python Types Intro to include Optional

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 23:44:23 +02:00
Sebastián Ramírez
4a5cda0d77 📝 Update release notes 2020-06-12 23:00:09 +02:00
Micah Rosales
b90bf2da9e 🐛 Fix callable class generator dependencies (#1365)
* Fix callable class generator dependencies

* workaround to support asynccontextmanager backfill for pre python3.7

Co-authored-by: Micah Rosales <mrosales@users.noreply.github.com>
2020-06-12 22:57:59 +02:00
Sebastián Ramírez
a552cbdf59 📝 Update release notes 2020-06-12 22:47:37 +02:00
Dylan Anthony
2351fb5623 🔇 Remove error log when parsing malformed JSON body as it's a client error (#1351) 2020-06-12 22:44:40 +02:00
Sebastián Ramírez
807522c616 📝 Update release notes 2020-06-12 22:42:40 +02:00
Xie Wei
81a529c251 🌐 Translate doc first steps to Chinese (#1323)
* WIP:add Chinese translation for first steps doc

* add Chinese translation for first steps doc

* improve translations

Co-authored-by: Waynerv <wei.xie@woqutech.com>
2020-06-12 22:39:26 +02:00
Sebastián Ramírez
7efc15aeef 📝 Update release notes 2020-06-12 22:37:34 +02:00
Nik
d66d8379c0 🐛 Fix OpenAPI generation when using callbacks with routers including Pydantic models (#1322)
* drop model class from additional responses when generating openapi

* ♻️ Copy response to be mutated early in get_openapi_path

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 22:35:59 +02:00
Sebastián Ramírez
5a00467951 📝 Update release notes 2020-06-12 22:01:22 +02:00
Kazantcev Andrey
434d32b891 Optimize regexp pattern in get_path_param_names (#1243) 2020-06-12 21:59:32 +02:00
Sebastián Ramírez
535247ffc4 📝 Update release notes 2020-06-12 21:43:17 +02:00
Pankaj Giri
7e2518350a 📝 Remove *, from functions where it's not needed #1234 (#1239)
* Fix for - [FEATURE] Remove *, where it's not needed #1234

* 🔥 Remove unnecessary arg *,

* 🎨 Update docs format highlight lines

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 21:41:44 +02:00
Sebastián Ramírez
1b2a7546af 📝 Update release notes 2020-06-12 18:58:15 +02:00
Cesare De Cal
2d9bb64047 🌐 Generated new translation directory to support Italian docs (#1557)
* Generated new translation directory to support Italian docs

* ⬆️ Upgrade/pin pytest to >= 5.4.3

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 18:53:52 +02:00
Sebastián Ramírez
072c2bc7f9 🔖 Release version 0.56.0 2020-06-12 00:22:17 +02:00
Sebastián Ramírez
da7826b0eb 📝 Update release notes 2020-06-12 00:05:17 +02:00
Ingmar Steen
2f478eeca6 Add support for ASGI root_path for openapi docs (#1199)
* Use ASGI root_path when it is provided and openapi_prefix is empty.

* Strip trailing slashes from root_path.

* Please mypy.

* Fix extending openapi test.

* 📝 Add docs and tutorial for using root_path behind a proxy

* ♻️ Refactor application root_path logic, use root_path, deprecate openapi_prefix

*  Add tests for Behind a Proxy with root_path

* ♻️ Refactor test

* 📝 Update/add docs for Sub-applications and Behind a Proxy

* 📝 Update Extending OpenAPI with openapi_prefix parameter

*  Add test for deprecated openapi_prefix

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-11 23:53:19 +02:00
Sebastián Ramírez
543ef7753a 📝 Update release notes 2020-06-07 22:02:36 +02:00
Sebastián Ramírez
88a887329e 📝 Update help and issue templates (#1531)
* 📝 Update help docs: Gitter, issues, links

also fix Gitter tab padding

* 📝 Update new GitHub issue templates

* 📝 Add note about extra help required for new issues
2020-06-07 22:00:15 +02:00
Sebastián Ramírez
8cfe254400 📝 Update release notes 2020-06-05 17:35:39 +02:00
Sebastián Ramírez
bfd46e562b 🔧 Update issue-manager GitHub action (#1520) 2020-06-05 17:34:43 +02:00
Sebastián Ramírez
a0e4d38bea 📝 Update release notes 2020-05-24 08:48:52 +02:00
Sebastián Ramírez
b0414b9929 📝 Add new links (#1467)
* 📝 Update opinions including Netflix and add format

* 📝 Add new external links

* 📝 Update README
2020-05-24 08:48:09 +02:00
Sebastián Ramírez
3b4413f9f5 📝 Update release notes 2020-05-24 07:47:19 +02:00
Xie Wei
374cdf29a9 🌐 Add Chinese translation for docs/python-types.md (#1197)
* Add Chinese tranlation for docs/python-types.md

* improve translation
2020-05-24 07:43:26 +02:00
Sebastián Ramírez
8d844bc5cf 🔖 Release version 0.55.1 2020-05-23 18:59:14 +02:00
Sebastián Ramírez
1092261ae1 📝 Update release notes 2020-05-23 18:59:14 +02:00
Sebastián Ramírez
5984233223 🐛 Fix Enum handling with their own schema definitions (#1463)
* 🐛 Fix extra support for enum with its own schema

*  Fix/update test for enum with its own schema

* 🐛 Fix type declarations

* 🔧 Update format and lint scripts to support locally installed Pydantic and Starlette

* 🐛 Add temporary type ignores while enum schemas are merged
2020-05-23 18:56:18 +02:00
Sebastián Ramírez
98bb9f13da 🔖 Release version 0.55.0 2020-05-23 16:06:32 +02:00
Sebastián Ramírez
d375dc6ebe 📝 Update release notes 2020-05-23 16:06:32 +02:00
Sebastián Ramírez
ee335bca82 Add test to support Enums with their own re-usable schema (#1461) 2020-05-23 16:04:25 +02:00
Sebastián Ramírez
601d8eb809 📝 Update release notes 2020-05-17 16:04:35 +02:00
Sebastián Ramírez
b99f350a18 📝 Add links to GitHub sponsors 💸 (#1425)
* 📝 Add links to GitHub sponsors

* ✏ Update link to sponsors
2020-05-17 16:03:53 +02:00
Sebastián Ramírez
c1b0e796c6 📝 Update release notes 2020-05-17 13:51:46 +02:00
retnikt
d9e65147c7 ✏ Fix minor erratum in Question issue template (#1344) 2020-05-17 13:50:42 +02:00
Sebastián Ramírez
6001513c4f 📝 Update release notes 2020-05-17 13:50:05 +02:00
Stavros Korokithakis
3fa033d8d5 📝 Add warning about storing user passwords (#1336) 2020-05-17 13:48:05 +02:00
Sebastián Ramírez
59f7e66ac3 📝 Update release notes 2020-05-17 13:41:12 +02:00
Chen Rotem Levy
08e8dfccbe ✏️ Fix typo in [en] tutorial: exception handeling (#1326)
* Fix typo

* ✏️ Fix typo

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-17 13:40:55 +02:00
Sebastián Ramírez
fc70a2f36f 📝 Update release notes 2020-05-17 13:36:04 +02:00
Fabio Serrao
f5c5dbb739 🌐 Add Portuguese translation for alternatives.md (#1325)
* Portuguese translation for alternatives.md

* 🔥 Remove file not yet translated

* ✏️ Add small format and wording changes

* 🔧 Update Portuguese MkDocs

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-17 13:32:44 +02:00
Sebastián Ramírez
ca939fabf7 📝 Update release notes 2020-05-17 12:59:17 +02:00
Xie Wei
cc3d795bea ✏ Fix 2 typos in docs (#1324) 2020-05-17 12:56:57 +02:00
Sebastián Ramírez
7fc1bac54b 📝 Update release notes 2020-05-17 12:50:00 +02:00
Sebastián Ramírez
27367df90c 📝 Update release notes 2020-05-17 12:49:02 +02:00
Derek Bekoe
f93861e321 📝 Update cors.md - CORS max_age 600 (#1301)
Update max_age documentation from 60 to the actual default value of 600.
https://github.com/encode/starlette/blob/master/starlette/middleware/cors.py#L23

Related PR https://github.com/encode/starlette/pull/909
2020-05-17 12:48:02 +02:00
Fabio Serrao
30e56ec835 🌐 Add Portuguese translation for index.md (#1300)
* Portuguese Translation for index.md

* ✏️ Update * for consistency with recent changes

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-17 12:46:22 +02:00
Sebastián Ramírez
48ccef9ad2 📝 Update release notes 2020-05-17 12:38:10 +02:00
Chris Allnutt
b79e002635 ✏ Re-word and clarify docs for extra info in body-fields (#1299)
* Fixed Typo in [EN] tutorial: body-fields
- remove duplicate of examples text

* ✏️ Re-word and clarify extra info docs

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-17 12:37:15 +02:00
Sebastián Ramírez
1fa28b7cb6 📝 Update release notes 2020-05-17 12:30:00 +02:00
Sebastián Ramírez
22f7eae3f2 ✏️ Make sure the * in the README is consistent in the docs (#1424) 2020-05-17 12:28:37 +02:00
Sebastián Ramírez
ae93773465 📝 Update release notes 2020-05-17 12:15:58 +02:00
Sebastián Ramírez
0f387553d1 📝 Update release notes 2020-05-17 12:15:08 +02:00
Beau Barker
d53a253c8d 📝 Update location of get_db in SQL docs (#1293) 2020-05-17 12:14:14 +02:00
Sebastián Ramírez
f8f0a6e462 ✏️ Fix typos in async docs (#1423) 2020-05-17 12:11:17 +02:00
Sebastián Ramírez
f7eea768f6 🔖 Release 0.54.2 2020-05-16 21:00:28 +02:00
Sebastián Ramírez
53d316f706 📝 Update release notes 2020-05-16 20:56:58 +02:00
Alvaro Pernas
741de7f927 🌐 Add Spanish translation for Concurrency and async / await (#1290)
* final touches to async section ES translation

* minor fixes

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* Update docs/es/docs/async.md

Co-Authored-By: Camila Gutierrez <mariacamilagl@users.noreply.github.com>

* 📝 Update async/await docs in EN with emojis

* 📝 Update wording, format, and emojis for async/await in ES

* 🔧 Add async.md to MkDocs for Spanish

Co-authored-by: Camila Gutierrez <mariacamilagl@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 20:53:40 +02:00
Sebastián Ramírez
16b3669adf 📝 Update release notes 2020-05-16 18:03:17 +02:00
Donghui Wang
c5807fdaa4 🔥 Remove vote link (#1289)
remove 'Vote to include FastAPI in awesome-python', because the PR was closed
2020-05-16 18:02:05 +02:00
Sebastián Ramírez
897b7d1b99 📝 Update release notes 2020-05-16 17:47:26 +02:00
Sebastián Ramírez
409264960e Allow disabling docs UIs by disabling OpenAPI (#1421)
*  Allow disabling docs UIs by disabling openapi_url

* 📝 Add docs for disabling OpenAPI and docs in prod or other environments

*  Add tests for disabling OpenAPI and docs
2020-05-16 17:45:12 +02:00
Sebastián Ramírez
cfb72eec5a 📝 Update release notes 2020-05-16 15:41:21 +02:00
Fabio Serrao
778822bd9a 🌐 Add Portuguese translation for benchmarks (#1274)
* Translation benchmarks

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* Update docs/pt/docs/benchmarks.md

Co-Authored-By: Marcos Monteiro <marcosmmb90@gmail.com>

* 🔧 Include benchmark translation in MkDocs for Portuguese

Co-authored-by: Marcos Monteiro <marcosmmb90@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 15:37:57 +02:00
Sebastián Ramírez
cfd2c3017f 📝 Update release notes 2020-05-16 15:31:21 +02:00
Marcos Monteiro
caed37a08f 🌐 Add Portuguese translation for the tutorial/index page (#1259)
* Translate tutorial/index.md to Portuguese

* ✏️ Update capitalization

* 🔧 Update docs section title in Portuguese

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 15:28:26 +02:00
Sebastián Ramírez
4c1b54e209 📝 Update release notes 2020-05-16 15:18:18 +02:00
Sebastián Ramírez
e4f0947821 Allow Unicode in MkDocs for translations instead of escaped chars (#1419) 2020-05-16 15:17:24 +02:00
Sebastián Ramírez
22e858f65c 📝 Update release notes 2020-05-16 15:01:10 +02:00
Juan Funez
046d6b7fa0 🌐 Add Spanish translation for advanced/index.md (#1250)
* spanish translation for advanced/index.md

* Ajustes sugeridos

* ✏️ Capitalize docs title

* 🔧 Add config to MkDocs for spanish

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 14:58:00 +02:00
Sebastián Ramírez
89f36371b9 📝 Update release notes 2020-05-16 14:48:56 +02:00
Marcos Monteiro
406b3ac805 🌐 Add Portuguese translation for the history-design-future page (#1249)
* Translate history-design-future.md to Portuguese

* Update docs/pt/docs/history-design-future.md

Co-Authored-By: Cássio Botaro <cassiobotaro@gmail.com>

* 📝 Capitalize title

Co-authored-by: Cássio Botaro <cassiobotaro@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 14:46:49 +02:00
Sebastián Ramírez
f71ba8885e 📝 Update release notes 2020-05-16 14:39:54 +02:00
Marcos Monteiro
121e87b3e0 🌐 Add Portuguese translation for Features (#1248)
* Translate features.md file to Portuguese

* Changes word of features.md translation to Portuguese

* Fixing typos and bad wording

Thanks @Serrones for the kind review
2020-05-16 14:37:17 +02:00
Sebastián Ramírez
2d013b8340 📝 Update release notes 2020-05-16 13:06:28 +02:00
Sebastián Ramírez
761e5ff01d 🐛 Fix Spanish MkDocs title 2020-05-16 13:05:21 +02:00
MartinEliasQ
9812684178 🌐 Add Spanish translation for the tutorial-user-guide index page (#1244)
* Spanish translation for the tutorial-user-guide index page

* Improve some parts of the text in terms of writing

* Change the wording to keep the documentation consistent.

* 📝 Add small wording and consistency changes

* 🎨 Apply the same consistency changes to EN 🤷

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 13:02:20 +02:00
Sebastián Ramírez
f7a87cd6ba 📝 Update release notes 2020-05-16 12:47:44 +02:00
Ikkyu
f67bc3ffe8 🌐 Add Chinese translations for docs: deployment.md (#1203)
* Add new language of docs: zh

* Add deployment.md Chinese trans

* add "or"

* rm index.md

* updates Chinese translations of deployement.md

* update translations of deployment.md

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 12:45:04 +02:00
Sebastián Ramírez
dff644abe0 📝 Update release notes 2020-05-16 12:38:13 +02:00
Xie Wei
fc7b4ab880 🌐 Add Chinese translation for tutorial intro doc (#1202)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 12:32:31 +02:00
Sebastián Ramírez
1d0f909ca5 📝 Update release notes 2020-05-16 12:21:06 +02:00
Dustyposa
a0cdbe449b 🌐 Add translation of features.md to Chinese (#1192)
* translation features.md to Chinese

* update review data

* :DOCS: update with review

* 🔥 Remove double link in build mkdocs.yml for other languages

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-16 12:18:04 +02:00
Sebastián Ramírez
44bd64d797 📝 Update release notes 2020-05-16 12:04:32 +02:00
Xie Wei
bfa78db458 🌐 Add Chinese translation for index docs (#1191)
* Add Chinese tranlation for docs/index.md

* Fix syntax issue

* Update resource address of zh docs

* Optimize typography in zh docs

* improve translations

Co-authored-by: Waynerv <wei.xie@woqutech.com>
2020-05-16 11:58:10 +02:00
Sebastián Ramírez
4e77737a3f 📝 Update release notes 2020-04-18 17:57:50 +02:00
Sebastián Ramírez
d03c197c80 📝 Update project generation docs (#1287) 2020-04-18 17:56:35 +02:00
Sebastián Ramírez
06e42a4e5d 📝 Update release notes 2020-04-11 19:22:35 +02:00
Camila Gutierrez
bd1e85a8d3 📝 Add Spanish translation for the Python Types Intro page (#1237)
* Spanish translation Python Types Intro page

* 📝 Fix tuple docs in Types intro

* ✏️ Fix typos and wording nitpicks

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-11 19:20:32 +02:00
Sebastián Ramírez
506d5dce39 📝 Update release notes 2020-04-11 18:49:52 +02:00
Camila Gutierrez
a7b4c73663 📝 Add Spanish translation for the Features page (#1220)
* Spanish translation for the Features page

* ✏️ Fix small typos and wording nitpicks

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-11 18:46:46 +02:00
Sebastián Ramírez
d4f3ca1c1b 🔖 Release 0.54.1 2020-04-08 07:51:26 +02:00
Sebastián Ramírez
471d703611 📝 Update release notes 2020-04-08 07:50:30 +02:00
Sebastián Ramírez
a46bbc54cd Update database setup for tests (#1226)
* 🗃️ Update database setup for tests

*  Add pragmas and update db handling for tests
2020-04-08 07:41:53 +02:00
Sebastián Ramírez
a4405bbed2 📝 Update release notes 2020-04-08 06:39:40 +02:00
Samuel Colvin
e9b189e9f2 Improve test debugging (#1222) 2020-04-08 06:37:38 +02:00
Sebastián Ramírez
483bce3ae1 ⬆️ Upgrade to MkDocs Material 5 and update docs scripts (#1225)
* ⬆️ Upgrade mkdocs.yml configs for MkDocs Material 5

*  Update docs.py to always update mkdocs.yml

* 🌐 Update mkdocs.yml for translations

* 🔧 Update MkDocs config

*  Add tabs for alternative options

* ⬆️ Update termynal setup with new CSS classes

* 🔧 Sync / Update mkdocs.yml for languages
2020-04-08 06:25:01 +02:00
Sebastián Ramírez
7372f6ba11 🔖 Release version 0.54.0 2020-04-05 16:50:16 +02:00
Sebastián Ramírez
8d92557e53 📝 Update relase notes 2020-04-05 16:47:33 +02:00
Mickey Pashov
c56342bf79 ✏️ Fix minor grammatical mistakes in the async docs (#1188)
* Fix minor grammatical mistakes in the async docs.

* ✏️ Update wording and clarify with emojis

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-05 16:46:22 +02:00
Harsha Laxman
07e094fd50 📝 Add note about Alembic in project generator in SQL docs (#1183)
* Update sql-databases alembic docs

Was helpful to refer to the full-stack project when integrating alembic into my own project

* 📝 Update Alembic note in docs

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-05 15:15:39 +02:00
Sebastián Ramírez
1cc30de32f 📝 Update release notes 2020-04-05 15:07:00 +02:00
voegtlel
3397d4d69a Implement response_model_exclude_defaults and response_model_exclude_none (#1166)
* Implemented response_model_exclude_defaults and response_model_exclude_none to be compatible pydantic options.

* 🚚 Rename and invert include_none to exclude_none to keep in sync with Pydantic

Co-authored-by: Lukas Voegtle <lukas.voegtle@sick.de>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-05 15:04:46 +02:00
Sebastián Ramírez
766157bfb4 📝 Update release notes 2020-04-05 13:57:45 +02:00
duganchen
d96223460b 📝 Add an example of setting up a test database (#1144)
* Add an example of setting up a test database.

* 📝 Add/update docs for testing a DB with dependency overrides

* 🔧 Update test script, remove line removing test file as it is removed during testing

*  Update testing coverage pragma

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-05 13:53:09 +02:00
Sebastián Ramírez
fd99dfc95b 📝 Update release notes 2020-04-04 22:38:17 +02:00
Sebastián Ramírez
10fb7ace04 📝 Update contributing guidelines to review translation PRs (#1215) 2020-04-04 22:36:10 +02:00
Sebastián Ramírez
a1a19b103c 📝 Update release notes 2020-04-04 22:16:12 +02:00
Sebastián Ramírez
5c111caf40 📝 Update release notes 2020-04-04 22:14:55 +02:00
Gao Chao
651ee5e4d2 🎨 Update log style in main page, for GitHub Markdown compatibility (#1200)
* Update README.md

fix string format

* 🎨 Update log style in main page, for GitHub Markdown compatibility

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-04 22:13:55 +02:00
Cássio Botaro
c398ac87d9 🙈 Add Python venv "env" to gitignore (#1212) 2020-04-04 22:03:17 +02:00
Cássio Botaro
0a77c613b0 🌐 Add new language on docs: pt (#1210) 2020-04-04 22:01:19 +02:00
Sebastián Ramírez
70bc469373 📝 Update release notes 2020-04-04 21:39:52 +02:00
Sebastián Ramírez
b76334f544 📝 Settings using lru_cache (#1214)
*  Update settings examples to use lru_cache

* 📝 Update docs for Settings, using @lru_cache

* 🎨 Update lru_cache colors to show difference in stored values
2020-04-04 21:39:15 +02:00
Sebastián Ramírez
14b467db06 📝 Update release notes 2020-04-02 07:03:00 +02:00
Camila Gutierrez
3a0c22ce7d 🌐 Translate index to Spanish (#1201) 2020-04-02 07:00:50 +02:00
Sebastián Ramírez
3b7e4e0544 📝 Update release notes 2020-04-02 06:59:19 +02:00
alexmitelman
d4d5b21b2e 📝 Add documentation about settings and env vars (#1118)
* Add doc and example for env var config

* Syntax highlight for .env file

* Add test for configuration docs

* 📝 Update settings docs, add more examples

*  Add tests for settings

* 🚚 Rename "Application Configuration" to "Metadata and Docs URLs"

to disambiguate between that and settings

* 🔥 Remove replaced example file

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-02 06:55:20 +02:00
Sebastián Ramírez
6e1cd45a46 🔖 Release version 0.53.2 2020-03-30 21:49:50 +02:00
Sebastián Ramírez
b86d130eb6 📝 Update release notes 2020-03-30 21:47:11 +02:00
Toan Vuong
90afc72e64 🐛 Fix automatic embedding with dependencies and sub-dependencies (#1079)
* Handle automatic embedding with Depends

* 🐛 Fix body embeds for sub-dependencies and simplify implementation

*  Add/update tests for body embeds in dependencies

* 👷 Trigger Travis

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-30 21:44:43 +02:00
Sebastián Ramírez
042c697b6b 📝 Update release notes 2020-03-30 20:49:24 +02:00
amitlissack
02441ff031 🐛 Fix dependency overrides in WebSockets (#1122)
* add tests to test_ws_router to test dependencies and dependency overrides.

* supply dependency_overrides_provider to APIWebSocketRoute upon creation
2020-03-30 20:45:05 +02:00
Sebastián Ramírez
210af1fd3d 📝 Update release notes 2020-03-30 20:42:46 +02:00
Sebastián Ramírez
06eaa32bf0 🔧 Update docs script to make sure languages are always sorted (#1189) 2020-03-30 20:41:50 +02:00
Sebastián Ramírez
4f88a5fddb 📝 Update release notes 2020-03-30 20:26:07 +02:00
Ikkyu
eb6be1d725 💬 Add new language of docs: zh (#1187) 2020-03-30 20:14:58 +02:00
Sebastián Ramírez
1d99681fd4 📝 Update release notes 2020-03-30 12:01:30 +02:00
Sebastián Ramírez
618be44023 🔧 Add .env to git, to simplify VS Code development 2020-03-30 12:00:55 +02:00
Sebastián Ramírez
544afaff97 📝 Add docs for adding example to schema (#1185) 2020-03-30 11:58:48 +02:00
Sebastián Ramírez
e6b3b994be 🔖 Release version 0.53.1 2020-03-29 22:08:54 +02:00
Sebastián Ramírez
67f148ff83 📝 Update release notes 2020-03-29 22:06:02 +02:00
Sebastián Ramírez
6c34600599 🐛 Fix include docs example file (#1182) 2020-03-29 22:05:24 +02:00
John Paton
016a4b7491 📝 Add documentation of example kwarg of Field (#1106)
* Add documentation of example kwarg of Field

* 📝 Update info about schema examples

* 🚚 Move example file to new directory

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-29 21:43:31 +02:00
Sebastián Ramírez
be21b74ad5 📝 Update release notes 2020-03-29 19:28:53 +02:00
voegtlel
0f152b4e97 🐛 Check already cloned fields in create_cloned_field to support recursive models (#1164)
* FIX: #894
Include recursion check for create_cloned_field.
Added test for recursive model.

* ♻️ Refactor and format create_cloned_field()

Co-authored-by: Lukas Voegtle <lukas.voegtle@sick.de>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-29 19:26:29 +02:00
Sebastián Ramírez
0d165d1efa 📝 Update release notes 2020-03-29 18:52:33 +02:00
YangQuan
9d54215a3a 📝 Add example of Pycharm in tutorial/debugging.md (#1096)
* add example of pycharm in tutorial/debugging.md

* 📝 Update PyCharm debug instructions and screenshot

* 🚚 Move image to new location in docs

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-29 18:50:29 +02:00
Sebastián Ramírez
8ab916baed 📝 Update release notes 2020-03-29 17:53:49 +02:00
Paul-Louis NECH
c83c50b27d ✏️ Fix typo (#1148) 2020-03-29 17:51:58 +02:00
Sebastián Ramírez
c2ad214a84 📝 Update release notes 2020-03-29 17:05:03 +02:00
Sebastián Ramírez
459f0e11e5 🏁 Update Windows development environment and tests (#1179)
* 🏁 Fix ./scripts/docs.py encoding for Windows

* 🔥 Remove ujson from tests as it prevents Windows development

It's still tested by Starlette anyway

* 📝 Update development instructions for Windows

* 🎨 Update format for WSGIMiddleware example

*  Update tests to run on Windows
2020-03-29 17:04:04 +02:00
Sebastián Ramírez
56e43ba204 🔖 Release version 0.53.0 2020-03-27 17:56:41 +01:00
Sebastián Ramírez
10485cad5a 📝 Update release notes 2020-03-27 17:52:33 +01:00
Sebastián Ramírez
53a7798e58 🎨 Update badge for coverage (#1175)
from shields.io, as Codecov's one shows coverage for the last PR from a fork at master
2020-03-27 17:51:58 +01:00
Sebastián Ramírez
372ed58677 📝 Update release notes 2020-03-27 17:33:51 +01:00
Michael Oliver
3f8bfd62b7 Add orjson to pip install fastapi[all] (#1161) 2020-03-27 17:32:35 +01:00
Sebastián Ramírez
02a6fcad98 📝 Update release notes 2020-03-27 17:29:11 +01:00
Ari Bajo
651ced68bf 🐛 Fix GZipMiddleware code block linking to TrustedHostMiddleware in docs (#1138) 2020-03-27 17:27:57 +01:00
Sebastián Ramírez
670b64360d 📝 Update release notes 2020-03-27 17:20:01 +01:00
adg-mh
1f53fef70a ✏️ Update doc string with correct class name (#1126) 2020-03-27 17:18:23 +01:00
Sebastián Ramírez
d1f067dc5b 📝 Update release notes 2020-03-27 17:16:45 +01:00
Tomoya Yoshioka
15241b53a8 📝 Clarify function name in example (#1121) 2020-03-27 17:15:26 +01:00
Sebastián Ramírez
38fd8a674b 📝 Update release notes 2020-03-27 17:04:25 +01:00
Ben
bd37d8d04f 📝 Add new external link (#1112)
* Added new external link

I added an article in which I briefly explain how to build an Apache Kafka producer / consumer with FastAPI and aiokafka.

* 📝 Update format

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-27 17:02:18 +01:00
Sebastián Ramírez
bc99ad0ad1 📝 Update release notes 2020-03-27 16:21:28 +01:00
juhovh-aiven
aea04ee32e 🐛 Fix exclude_unset and aliases in response model validation (#1074)
* Fix exclude_unset and aliases in response model validation.

*  Use by_alias from param 🤷

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-27 16:19:17 +01:00
Sebastián Ramírez
869c7389e2 📝 Update release notes 2020-03-27 15:34:16 +01:00
Aakash Nand
2738df3801 Add Gitter chat to docs (#1061)
* implemented chat feature using sidecar from starlette docs

* 🔥 Use external Gitter sidecar JS

*  Re-implement Gitter chat after multi-lang

* 🔥 Remove moved file

Co-authored-by: Aakash Nand <aakashnand@nttv6.jp>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-27 15:32:15 +01:00
Sebastián Ramírez
433d7862ea 📝 Update release notes 2020-03-27 10:21:40 +01:00
Sebastián Ramírez
7625e1e386 📝 Update and simplify translations docs (#1171) 2020-03-27 10:20:39 +01:00
Sebastián Ramírez
53e773a2e1 📝 Update release notes 2020-03-26 22:24:36 +01:00
Camila Gutierrez
c13b54ad0e 🏁 Change docs address to localhost for Windows (#1169) 2020-03-26 22:22:34 +01:00
Sebastián Ramírez
71c2abb41d 📝 Update release notes 2020-03-26 20:13:03 +01:00
Sebastián Ramírez
6205935323 Add support for docs translations (#1168)
* 🌐 Refactor file structure to support internationalization

*  Update tests changed after i18n

* 🔀 Merge Typer style from master

* 🔧 Update MkConfig with Typer-styles

* 🎨 Format mkdocs.yml with cannonical form

* 🎨 Format mkdocs.yml

* 🔧 Update MkDocs config

*  Add docs translation scripts dependencies

*  Add Typer scripts to handle translations

*  Add missing translation snippet to include

*  Update contributing docs, add docs for translations

* 🙈 Add docs_build to gitignore

* 🔧 Update scripts with new locations and docs scripts

* 👷 Update docs deploy action with translations

* 📝 Add note about languages not supported in the theme

*  Add first translation, for Spanish
2020-03-26 20:09:53 +01:00
Sebastián Ramírez
5fd5b6e72d 📝 Update release notes 2020-03-24 20:39:47 +01:00
Sebastián Ramírez
faf88cea0b 🎨 Update terminal examples and Typer note (#1139)
* 🎨 Update terminal examples with Termynal

* 🍱 Add Termynal scripts and styles from Typer for terminal examples
2020-03-19 14:39:29 +01:00
Sebastián Ramírez
025b38df40 🔖 Release version 0.52.0 2020-03-01 22:34:38 +01:00
Sebastián Ramírez
ac60cba75f 📝 Update release notes 2020-03-01 22:33:11 +01:00
Sebastián Ramírez
94ee932351 Add ORJSONResponse (#1065)
*  Add ORJSONResponse

* 📝 Add tutorial using ORJSONResponse

*  Add test for ORJSONResponse

* 📝 Update index.md
2020-03-01 22:30:58 +01:00
Sebastián Ramírez
cf760d6802 🔖 Release version 0.51.0 2020-03-01 22:02:51 +01:00
Sebastián Ramírez
c65fdc4bed 📝 Update release notes 2020-03-01 21:58:36 +01:00
Sebastián Ramírez
0ac9b3ee5c Re-export utils from Starlette (#1064)
*  Re-export main features used from Starlette to simplify developer's code

* ♻️ Refactor Starlette exports

* ♻️ Refactor tutorial examples to use re-exported utils from Starlette

* 📝 Add examples for all middlewares

* 📝 Add new docs for middlewares

* 📝 Add examples for custom responses

* 📝 Extend docs for custom responses

* 📝 Update docs and add notes explaining re-exports from Starlette everywhere

* 🍱 Update screenshot for HTTP status

* 🔧 Update MkDocs config with new content

* ♻️ Refactor tests to use re-exported utils from Starlette

*  Re-export WebSocketDisconnect from Starlette for tests

*  Add extra tests for extra re-exported middleware

*  Add tests for re-exported responses from Starlette

*  Add docs about mounting WSGI apps

*  Add Flask as a dependency to test WSGIMiddleware

*  Test WSGIMiddleware example
2020-03-01 21:49:20 +01:00
Sebastián Ramírez
f2bd2c44e2 🔖 Release version 0.50.0 2020-02-29 21:49:09 +01:00
Sebastián Ramírez
f0beab1778 📝 Update release notes 2020-02-29 21:48:11 +01:00
Sebastián Ramírez
95f2dc065e 📝 Add link to the Release Notes from the section about pinning versions for deployment (#1058) 2020-02-29 21:47:46 +01:00
Sebastián Ramírez
4e8080f290 📌 Upgrade Starlette version (#1057) 2020-02-29 21:28:23 +01:00
Sebastián Ramírez
fbbed6fe81 📝 Update release notes 2020-02-29 19:22:08 +01:00
Sebastián Ramírez
2d5a5d0d9e 📝 Add docs about pinning versions for deployment (#1056) 2020-02-29 19:20:18 +01:00
Sebastián Ramírez
d4ddf4e62a 🔖 Release 0.49.2 2020-02-29 18:19:52 +01:00
Sebastián Ramírez
cb25dab986 📝 Update release notes 2020-02-29 18:01:40 +01:00
Sebastián Ramírez
7aa1628336 📝 Update release notes 2020-02-29 18:00:57 +01:00
sattosan
1dbd3d7aa7 ✏️ Fix broken links in release notes (#1052) 2020-02-29 18:00:40 +01:00
sattosan
24e73e01c7 ✏️ Fix typo in release notes (#1051) 2020-02-29 17:56:41 +01:00
Patrick McKenna
e26f94018c ♻️ Refactor serialize_response parameter name (#1031) 2020-02-29 17:33:02 +01:00
sm-Fifteen
1ce67887b9 ♻️ Refactor function calling a path operation function to simplify profiling (#1027) 2020-02-29 17:28:30 +01:00
Sebastián Ramírez
8e0200607f 📝 Update release notes 2020-02-29 17:16:00 +01:00
sm-Fifteen
bd407ca705 Add testing dependencies #1026 2020-02-29 14:23:41 +01:00
Sebastián Ramírez
48b5ef1681 📝 Update release notes 2020-02-29 14:06:45 +01:00
Patrick McKenna
afad59dfbb 🐛 Admit valid types for Pydantic fields as responses models (#1017) 2020-02-29 14:04:35 +01:00
Sebastián Ramírez
0f9be1d2e7 📝 Update release notes 2020-02-29 13:16:20 +01:00
Vegard Stikbakke
48c2406495 🎨 Fix markdown code section rendering error in SQL tutorial (#1015) 2020-02-29 12:40:09 +01:00
Sebastián Ramírez
9958d93120 🔖 Release 0.49.1 2020-02-28 22:48:03 +01:00
Sebastián Ramírez
b63512cd92 📝 Update release notes 2020-02-28 22:46:55 +01:00
merowinger92
74c4d1c1db 🐛 Fix declaring a single parameter per name (#994) 2020-02-28 22:36:30 +01:00
Sebastián Ramírez
7ccd81f706 🚀 Update Netlify deploy action (#1047) 2020-02-28 17:27:43 +01:00
Taneli Hukkinen
1da8d3f1e6 🔧 Move all mypy configurations to configuration file (#987) 2020-02-27 21:03:03 +01:00
Camila Gutierrez
92016da962 💚 Do not deploy preview to Netlify on external PRs while GitHub actions are solved (#1046) 2020-02-27 20:59:26 +01:00
Sebastián Ramírez
9c3c9b6e78 🔖 Release version 0.49.0 2020-02-16 21:11:28 +01:00
Sebastián Ramírez
687871e46a 📝 Update release notes 2020-02-16 21:08:58 +01:00
Patrick McKenna
3c1803897f 🐛 Fix path encoding (#978) 2020-02-16 21:06:41 +01:00
T. Tokusumi
1c3289f115 📝 Add link: JP articles related to fastapi (#974) 2020-02-16 21:00:42 +01:00
Taras Sotnikov
35d41adc7b 📝 Fix broken link in docs (#949) 2020-02-16 20:57:29 +01:00
Sebastián Ramírez
9a3dd91030 📝 Update release notes 2020-02-16 20:55:07 +01:00
Sebastián Ramírez
017eae63b1 📝 Update release notes 2020-02-16 20:53:50 +01:00
Nikita Kolesov
8af4454251 ✏️ Fix typo (#941) 2020-02-16 20:51:18 +01:00
Sebastián Ramírez
adf252768c 📝 Update docs for dependencies with yield (#986) 2020-02-16 20:49:12 +01:00
Sebastián Ramírez
3705bdefd5 📝 Update release notes 2020-02-16 19:48:52 +01:00
Sebastián Ramírez
25e94d6344 Add mermaid.js support in Markdown fenced blocks for diagrams (#985) 2020-02-16 19:48:20 +01:00
Sebastián Ramírez
26c345b766 📝 Update release notes 2020-02-15 13:26:01 +01:00
Sebastián Ramírez
9ce50b4684 👷 Add GitHub actions to deploy to Netlify (#983) 2020-02-15 13:24:34 +01:00
Sebastián Ramírez
66954c7ded 📝 Update release notes 2020-02-12 21:37:05 +01:00
Sebastián Ramírez
e0c3519b94 Allow callables (as functools.partial) in path operations (#977) 2020-02-12 21:36:14 +01:00
Sebastián Ramírez
d91b2b3ee8 🔖 Release version 0.48.0 2020-02-04 05:43:07 +01:00
Sebastián Ramírez
1623b26855 📝 Update release notes 2020-02-04 05:42:12 +01:00
Sebastián Ramírez
9573130630 Lint first in tests, to error out faster (#948) 2020-02-04 05:41:42 +01:00
Sebastián Ramírez
2e0a102565 🔇 Log email-validator not installed only when used (#946) 2020-02-04 05:31:01 +01:00
Sebastián Ramírez
636ce6b3f7 📝 Update Peewee docs, simplify with double dependency with yield (#947) 2020-02-04 05:28:19 +01:00
नवुले पवन कुमार राव
1fd1e8733a 📝 Add link: Create and Deploy FastAPI app to Heroku (#942) 2020-02-04 05:25:00 +01:00
raphaelauv
44b45caf65 📝 Update Sanic description as it is now ASGI too 🎉 (#932) 2020-02-04 05:14:07 +01:00
Maciej Marzęta
e6da96fbb7 ✏️ Fix typos (#920) 2020-02-04 05:04:32 +01:00
David Montague
c425509d57 🐛 Fix body parsing (#918) 2020-02-04 05:01:59 +01:00
adursun
d8451f75a4 ✏️ Fix typo (#916) 2020-02-04 04:57:18 +01:00
李冬冬
a448bd63bd 🐛 Allow Any type for enums in OpenAPI (#906) 2020-02-04 04:37:47 +01:00
Ben
27fb2b358c 📝 Add article to external links (#901) 2020-02-04 04:25:52 +01:00
Timothée Mazzucotelli
68723d5291 📝 Add note about Body parameters without Pydantic (#900) 2020-02-04 04:17:20 +01:00
Andy Smith
70bdade23b 🐛 Fix Pydantic field clone logic with validators (#899) 2020-02-04 04:03:51 +01:00
linchiwei123
4f964939a1 🐛 Fix middleware docs link (#893) 2020-02-04 03:27:10 +01:00
Sebastián Ramírez
55afb70b37 📝 Update release notes 2020-01-18 19:08:24 +01:00
Sebastián Ramírez
b307d38897 ♻️ Update default API title from "Fast API" to "FastAPI" for consistency (#890) 2020-01-18 19:07:42 +01:00
Sebastián Ramírez
a085898309 🔖 Release version 0.47.1 2020-01-18 18:06:47 +01:00
Sebastián Ramírez
3b40c557ce 📝 Update release notes 2020-01-18 18:06:20 +01:00
Sebastián Ramírez
75a07f24bf 🔒 Fix clone field implementation to handle sub-models in response_model (#889) 2020-01-18 18:03:51 +01:00
Sebastián Ramírez
7cea84b74c 🐛 Fix FastAPI serialization of Pydantic ORM mode blocking the event loop (#888) 2020-01-18 17:32:57 +01:00
Sebastián Ramírez
3a5158a784 🔖 Release version 0.47.0 2020-01-18 17:14:59 +01:00
Sebastián Ramírez
bd581c5337 📝 Update release notes 2020-01-18 17:14:03 +01:00
Sebastián Ramírez
22982287ff 📝 Refactor docs, "Tutorial - User Guide" and "Advanced User Guide" (#887) 2020-01-18 16:21:54 +01:00
Sebastián Ramírez
a41a729682 🎨 Tweak external links, Markdown format, typos (#881) 2020-01-17 16:24:05 +01:00
Pavel Isaev
174e7b1730 🔒 Check both username and password in security tutorial (#865) 2020-01-17 12:49:54 +01:00
Nik
874d24181e 🐛 Fix validating form params declared with classes (list, tuple, set, etc) (#856) 2020-01-17 12:45:55 +01:00
Aviram Hassan
5db99a27cf add body to RequestValidationError for easier debugging (#853) 2020-01-17 12:37:44 +01:00
Sebastián Ramírez
180b842a1e 📝 Add external links, dynamic GitHub topic projects, and formatting (#850) 2020-01-17 10:46:44 +01:00
Sebastián Ramírez
3f53deebc9 🐛 Fix Peewee contextvars handling in docs (#879) 2020-01-17 09:59:38 +01:00
Sebastián Ramírez
e5d7878856 Use venv with Flit for local development, instead of requiring Flit and Pipenv (#877) 2020-01-17 09:51:03 +01:00
Sebastián Ramírez
3eca945bd1 📝 Udpate release notes 2020-01-12 20:43:46 +01:00
Zachary Wasserman
ba9c9a3f78 🔒 Update HTTP Basic Auth docs fixing timing attacks (#807) 2020-01-12 20:38:39 +01:00
Sebastián Ramírez
a9673f145a 🔖 Release version 0.46.0 2020-01-08 23:28:03 +01:00
Sebastián Ramírez
aa28784f6b 📝 Update release notes 2020-01-08 23:26:15 +01:00
Sebastián Ramírez
7b3319ddab ✏️ Tweak typos and configs (#837) 2020-01-08 23:25:29 +01:00
Sebastián Ramírez
6a20078259 📝 Update release notes 2020-01-08 23:03:08 +01:00
wxq0309
d0ab909544 📝 Add link to Chinese FastAPI posts (#810) 2020-01-08 23:01:58 +01:00
Sebastián Ramírez
13da029dca 📝 Update release notes 2020-01-08 22:51:55 +01:00
Jesse P. Johnson
91fe90e8e6 Implement OAuth2 authorization_code integration (#797) 2020-01-08 22:47:19 +01:00
Sebastián Ramírez
a0c8f93231 📝 Update release notes 2020-01-08 22:35:33 +01:00
Christoph Deil
cad6a6e0c1 📝 Highlight all new lines in docs example upgrade (#795) 2020-01-08 22:34:14 +01:00
Sebastián Ramírez
fd5ba77b83 📝 Update release notes 2020-01-08 22:23:54 +01:00
James Kaplan
cb1410426e 🐛 Fix callback handling in sub-routers (#792) 2020-01-08 22:22:14 +01:00
Sebastián Ramírez
7b31e52766 📝 Update release notes 2020-01-08 22:02:32 +01:00
Ken Kinder
4151616681 ✏️ Fix typos (#784) 2020-01-08 22:01:22 +01:00
Sebastián Ramírez
462e24e864 📝 Update release notes 2020-01-08 22:00:44 +01:00
Xucong ZHAN
9f9ed7a6bd 📝 Add four JP articles to external links (#783) 2020-01-08 21:58:33 +01:00
Sebastián Ramírez
b6ea9ea2ca 📝 Update release notes 2020-01-08 21:53:14 +01:00
Roald Storm
b85b2e3942 Add support for subtypes of main types in jsonable_encoder 2020-01-08 21:50:21 +01:00
Sebastián Ramírez
08fc2a41ca 📝 Update release notes 2020-01-08 19:16:57 +01:00
Dustyposa
8d3dcbcd1b fix type UrlStr -> HttpUrl (#832) 2020-01-08 00:08:43 -08:00
Justin DuJardin
861ed37c97 📝 update twitter compose tweet links (#813)
The links to post @tiangolo were not working
2019-12-30 15:22:11 -07:00
Sebastián Ramírez
7a445402d4 📝 Update release notes 2019-12-13 11:32:17 +01:00
Sebastián Ramírez
04c8502cc7 📝 Add docs for correctly using Peewee (#789) 2019-12-13 11:29:18 +01:00
Sebastián Ramírez
c7c69586ae 🔖 Release version 0.45.0 2019-12-11 18:05:19 +01:00
Sebastián Ramírez
4e09feda9e 📝 Update release notes 2019-12-11 18:02:53 +01:00
Ben Dayan
73260971b5 Add support for OpenAPI Callbacks (#722) 2019-12-11 17:58:00 +01:00
Sebastián Ramírez
b36bfff56e 📝 Update release notes 2019-12-09 20:04:04 +01:00
Sebastián Ramírez
83d04df8a6 🔊 Refactor logging (#781) 2019-12-09 20:02:44 +01:00
Sebastián Ramírez
7bc78c5fd3 📝 Update release notes 2019-12-09 19:15:37 +01:00
prostomarkeloff
ae8fa3aacd 📝 Add article about FastAPI to external links (#766) 2019-12-09 19:13:28 +01:00
Sebastián Ramírez
08bc120771 📝 Update release notes 2019-12-09 19:01:40 +01:00
Sebastián Ramírez
a39efb029f 💬 Rephrase handling-errors to remove gender while keeping readability (#780) 2019-12-09 18:59:29 +01:00
Sebastián Ramírez
58ca98285f 📝 Update release notes 2019-12-09 18:43:09 +01:00
prostomarkeloff
3f5f81bbdc 📝 Change 'Schema' to 'Field' in docs (#746) 2019-12-09 14:48:54 +01:00
Sebastián Ramírez
90236c8135 🔖 Release version 0.44.1 2019-12-05 00:17:04 +01:00
Sebastián Ramírez
c200bc2240 📝 Update release notes 2019-11-29 09:02:21 +01:00
Sebastián Ramírez
e9861cd918 🍱 Add GitHub social preview assets to git (#752) 2019-11-29 08:52:03 +01:00
Sebastián Ramírez
202fa11d50 📝 Update release notes 2019-11-29 08:30:10 +01:00
Sebastián Ramírez
4b6e09296c 🔧 Update PyPI trove classifiers (#751) 2019-11-29 08:29:37 +01:00
Sebastián Ramírez
9bd0d6fa96 👷 Enable full Travis for Python 3.8 (#750) 2019-11-29 07:45:09 +01:00
Sebastián Ramírez
35510a5ea7 📝 Update the "new issue" templates (#749)
* 🔧 Update the "new issue" templates

* 💚 Trigger Travis CI after Travis migration
2019-11-29 07:35:25 +01:00
Sebastián Ramírez
c1788a25c7 📝 Update release notes 2019-11-29 07:04:01 +01:00
dmontagu
19c77e35bd 🐛 Fix issue with exotic pydantic error serialization (#748) 2019-11-29 07:02:10 +01:00
Sebastián Ramírez
cc4c13e4ae 🔖 Release 0.44.0, with support for Pydantic v1 and above! 🎉 2019-11-27 22:16:29 +01:00
Sebastián Ramírez
4f3764faa9 📝 Update release notes 2019-11-27 22:14:36 +01:00
Sebastián Ramírez
c27ad0dc26 💚 Make GitHub action Issue Manager run once every night 2019-11-27 22:14:01 +01:00
Sebastián Ramírez
6d0caf7522 👷 Add GitHub action Issue Manager (#742) 2019-11-27 21:43:56 +01:00
Sebastián Ramírez
06df32e84c 📝 Update release notes 2019-11-27 21:29:14 +01:00
bundabrg
28c089c029 ✏️ Fix typos in docs (#734) 2019-11-27 21:27:56 +01:00
Sebastián Ramírez
44b26bb64c 📝 Update release notes 2019-11-27 21:25:09 +01:00
Stéphane Wirtel
e04bae2286 🐛 Fix the usage of custom_encoder for jsonable_encoder #714 (#715) 2019-11-27 21:23:23 +01:00
Sebastián Ramírez
23f5940e8b 📝 Update release notes 2019-11-27 21:08:37 +01:00
OcasoProtal
4915cf0561 🐛 Fix XML example (#710) 2019-11-27 21:06:50 +01:00
Sebastián Ramírez
a1c9eff041 📝 Update release notes 2019-11-27 21:05:39 +01:00
Nicolas Marier
57cb3f3089 📝 Fix typos and wording in deployment docs (#700) 2019-11-27 21:03:41 +01:00
Sebastián Ramírez
bd6b3b07c5 📝 Update release notes 2019-11-27 21:01:56 +01:00
Nicolas Marier
3cf8b86dc1 📝 Clarify docs for APIRouter dependencies (#698) 2019-11-27 21:00:34 +01:00
Sebastián Ramírez
55165f292a 📝 Update release notes 2019-11-27 20:53:00 +01:00
François Voron
f3ddc7bdeb 🐛 Allow async class methods as dependencies (#681) 2019-11-27 20:51:30 +01:00
Sebastián Ramírez
4356cc9588 📝 Update release notes 2019-11-27 20:45:49 +01:00
euri10
cd9e87e60e 📝 Add FastAPI cheatsheet to links (#671) 2019-11-27 20:43:23 +01:00
Sebastián Ramírez
4834d87dcd 📝 Update release notes 2019-11-27 20:40:26 +01:00
Forest Monsen
7781cc0936 ✏️ Fix protocol separator typo (#647) 2019-11-27 20:37:19 +01:00
Sebastián Ramírez
23459d4a35 📝 Update release notes 2019-11-27 20:36:37 +01:00
dmontagu
ab2b86fe2c Add support for Pydantic v1 and above 🎉 (#646)
* Make compatible with pydantic v1

* Remove unused import

* Remove unused ignores

* Update pydantic version

* Fix minor formatting issue

*  Revert removing iterate_in_threadpool

*  Add backwards compatibility with Pydantic 0.32.2

with deprecation warnings

*  Update tests to not break when using Pydantic < 1.0.0

* 📝 Update docs for Pydantic version 1.0.0

* 📌 Update Pydantic range version to support from 0.32.2

* 🎨 Format test imports

*  Add support for Pydantic < 1.2 for populate_validators

*  Add backwards compatibility for Pydantic < 1.2.0 with required fields

* 📌 Relax requirement for Pydantic to < 2.0.0 🎉 🚀

* 💚 Update pragma coverage for older Pydantic versions
2019-11-27 20:32:02 +01:00
Sebastián Ramírez
90a5796b94 🔖 Release 0.43.0 2019-11-24 18:56:11 +01:00
Sebastián Ramírez
bb8a630fc3 📝 Update release notes 2019-11-24 15:12:56 +01:00
Nicolas Delaby
f5a503afae 📝 Replace guys by developers when a group of people is targeted (#645)
Just to make sure we include everyone, disregarding their gender.
2019-11-24 15:09:45 +01:00
Sebastián Ramírez
49fba853c2 📝 Update release notes 2019-11-24 15:06:31 +01:00
Steven Kalt
bac2f587b7 📝 Document overriding operationId for all path operations using their function names (#642) 2019-11-24 15:00:51 +01:00
Sebastián Ramírez
e1fd6785aa 📝 Update release notes 2019-11-24 14:25:51 +01:00
James Addison
4e50f53459 🐛 Fixing validator-caused incorrect output key order (#637) 2019-11-24 14:23:33 +01:00
Sebastián Ramírez
933d4327fb 📝 Update release notes 2019-11-24 14:18:03 +01:00
Daniel Brotsky
c7902dd23a Generate correct OpenAPI docs for responses with no content (#621) 2019-11-24 14:15:39 +01:00
Sebastián Ramírez
c5f5e63810 📝 Update release notes 2019-11-23 23:00:52 +01:00
Nico Stapelbroek
c3cc077fa9 📝 Remove $ sign from bash codeblocs in markdown (#613) 2019-11-23 22:59:15 +01:00
Sebastián Ramírez
c6f98c009f 📝 Update release notes 2019-11-23 22:57:47 +01:00
Sebastián Ramírez
e4206772cb 📝 Update release notes 2019-11-23 22:54:06 +01:00
svalouch
723ef07ccf 📝 Add documentation for self-serving static Swagger UI (#112) (#557) 2019-11-23 22:50:58 +01:00
François Voron
8609beb9ab 🚨 Fix black linting (#682) 2019-11-23 22:43:43 +01:00
Sebastián Ramírez
65536cbf63 🔖 Release version 0.42.0: Answer to the Ultimate Question of Life, the Universe, and Everything 2019-10-09 13:16:45 -05:00
Sebastián Ramírez
0192eab557 📝 Update release notes 2019-10-09 13:13:04 -05:00
Sebastián Ramírez
3f9f4a0f8f Add dependencies with yield (used as context managers) (#595)
*  Add development/testing dependencies for Python 3.6

*  Add concurrency submodule with contextmanager_in_threadpool

*  Add AsyncExitStack to ASGI scope in FastAPI app call

*  Use async stack for contextmanager-able dependencies

including running in threadpool sync dependencies

*  Add tests for contextmanager dependencies

including internal raise checks when exceptions should be handled and when not

*  Add test for fake asynccontextmanager raiser

* 🐛 Fix mypy errors and coverage

* 🔇 Remove development logs and prints

*  Add tests for sub-contextmanagers, background tasks, and sync functions

* 🐛 Fix mypy errors for Python 3.7

* 💬 Fix error texts for clarity

* 📝 Add docs for dependencies with yield

*  Update SQL with SQLAlchemy tutorial to use dependencies with yield

and add an alternative with a middleware (from the old tutorial)

*  Update SQL tests to remove DB file during the same tests

*  Add tests for example with middleware

as a copy from the tests with dependencies with yield, removing the DB in the tests

* ✏️ Fix typos with suggestions from code review

Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
2019-10-09 13:01:58 -05:00
Sebastián Ramírez
380e3731a8 📝 Update release notes 2019-10-09 12:48:01 -05:00
Samuel Colvin
d6d99b86cb 🐛 Fix sitemap.xml in website, fix #597 (#598) 2019-10-09 12:45:44 -05:00
Sebastián Ramírez
5592fa0f6f 🔖 Release version 0.41.0 2019-10-07 06:44:07 -05:00
Sebastián Ramírez
b65be5d496 📝 Update release notes 2019-10-05 13:19:10 -05:00
Sebastián Ramírez
6c7da43e51 ⬆️ Upgrade Starlette to 0.12.9 and add State (#593) 2019-10-05 13:17:15 -05:00
Sebastián Ramírez
dfec2d7644 📝 Update release notes 2019-10-04 20:21:53 -05:00
dmontagu
8c3ef76139 Add better support for request body access/manipulation with custom classes (#589) 2019-10-04 19:23:34 -05:00
Sebastián Ramírez
7a504a721c 📝 Update release notes 2019-10-04 16:36:54 -05:00
dmontagu
dd963511d6 🐛 Fix preserving route_class when calling include_router (#538) 2019-10-04 16:35:20 -05:00
Sebastián Ramírez
fdb6d43e10 🔖 Release 0.40.0 2019-10-04 15:38:03 -05:00
Sebastián Ramírez
a7c718e968 📝 Update release notes 2019-10-04 15:35:09 -05:00
sliptonic
f4d753620b 📝 Add notes about installing python-multipart for forms (#574) 2019-10-04 15:33:42 -05:00
Sebastián Ramírez
fadfe4c586 📝 Update release notes 2019-10-04 15:11:04 -05:00
dmontagu
5fd83c5fa4 Sort schemas alphabetically (#554)
Modify openapi spec generation to include schemas in alphabetical order.
2019-10-04 15:08:41 -05:00
Sebastián Ramírez
14daaf409f 📝 Update release notes 2019-10-04 15:07:22 -05:00
svalouch
c7dc26b760 Allow docstrings to be truncated before being used for OpenAPI (#556) 2019-10-04 15:02:40 -05:00
Sebastián Ramírez
f5ccb3c35d 📝 Update release notes 2019-10-03 19:37:23 -05:00
Trim21
4cea311e6e 🐛 Fix doctype in docs (#537) 2019-10-03 19:35:44 -05:00
Sebastián Ramírez
f8718072a0 📝 Update release notes 2019-10-03 19:10:34 -05:00
tsouvarev
3dbbecdd16 🐛 Fix setting 4XX overriding default 422 validation errors(#517) 2019-10-03 19:08:29 -05:00
Sebastián Ramírez
6d5530ec1c 📝 Update release notes 2019-10-03 19:04:41 -05:00
prostomarkeloff
0761f11d1a ✏️ Fix typo in HTTP Basic auth tutorial (#514) 2019-10-03 19:01:41 -05:00
Sebastián Ramírez
f2e7ef7056 📝 Update release notes 2019-10-03 19:00:13 -05:00
Fedor Ignatov
d5d9a20937 📝 Fix incorrect example in docs - first steps (#511) 2019-10-03 18:57:49 -05:00
Sebastián Ramírez
96f092179f 📝 Update release notes 2019-10-03 18:43:15 -05:00
Zamir Amir
8505b716af Add support for setting Swagger UI initOAuth configs (clientId, appName) (#499) 2019-10-03 18:41:04 -05:00
Sebastián Ramírez
78272ac1f3 🔖 Release 0.39.0 2019-09-29 17:17:44 -05:00
Sebastián Ramírez
f1bee9a271 📝 Update release notes 2019-09-29 17:09:37 -05:00
jonathanunderwood
b20b2218cd Allow defaults in path parameters (and don't use them) (#450) (#464)
This allows using parameters that can have defaults (e.g. `None`) that can be used as query parameters.

But can also be used in routers with that include those parameters as part of the path.
2019-09-29 17:03:16 -05:00
Sebastián Ramírez
b9cf69cd42 📝 Update release notes 2019-09-29 16:50:00 -05:00
toppk
f803c77515 Add support for specifying a default_response_class (#467) 2019-09-29 16:47:35 -05:00
Sebastián Ramírez
0c67022048 📝 Update release notes 2019-09-29 16:24:52 -05:00
dmontagu
d8fe307d61 Add support for strings and __future__ type annotations (#451)
* Add support for strings and __future__ annotations

* Add comments indicating reason for string annotations

* Fix ignores (including removing some unused ignores)
2019-09-29 16:19:09 -05:00
Sebastián Ramírez
580cf8f4e2 🔖 Release 0.38.1 2019-09-01 07:56:37 -05:00
Sebastián Ramírez
af390af77c 📝 Update release notes 2019-09-01 07:53:20 -05:00
Kamal Gill
4642f63a1e 🐛 Use proper import for Request -- fixes #492 (#493) 2019-09-01 07:51:42 -05:00
Sebastián Ramírez
203e10596f 🔖 Release version 0.38.0.Support for Pydantic 0.32.2 and Starlette 0.12.8 2019-08-30 20:40:50 -05:00
Sebastián Ramírez
5a2278d09a 📝 Update release notes 2019-08-30 20:37:39 -05:00
Sebastián Ramírez
47a8387a04 📝 Add recent articles and opinions (#490) 2019-08-30 20:35:34 -05:00
Sebastián Ramírez
27ca0c9dca 📝 Update release notes 2019-08-30 19:47:17 -05:00
dmontagu
9418d78de6 ⬆️ Upgrade Starlette support range to include 0.12.8 (#477) 2019-08-30 19:45:01 -05:00
Sebastián Ramírez
4b74aef429 📝 Update release notes 2019-08-30 19:34:34 -05:00
dmontagu
fc7d123347 ⬆️ Upgrade support to Pydantic version 0.32.2 (breaking change) (#463) 2019-08-30 19:30:03 -05:00
Sebastián Ramírez
53da56146e 🔖 Release version 0.37.0 2019-08-30 19:10:43 -05:00
Sebastián Ramírez
3799b9027e 📝 Update release notes 2019-08-30 19:09:12 -05:00
dmontagu
c70f3f1198 Add support for custom route class (#468) 2019-08-30 19:05:59 -05:00
Sebastián Ramírez
58dddc5e4f 📝 Update release notes 2019-08-30 19:02:29 -05:00
b1-luettje
c90c4fb6c1 Allow disabling Google fonts in ReDoc (#481) 2019-08-30 19:00:55 -05:00
Sebastián Ramírez
5b3df28f0c 📝 Update release notes 2019-08-30 18:59:08 -05:00
dmontagu
6c6bdb6233 🔒 Ensure skip_defaults doesn't cause extra fields to be serialized (#485) 2019-08-30 18:56:14 -05:00
Sebastián Ramírez
f156f45193 📝 Update release notes 2019-08-30 18:37:42 -05:00
Aliaksei Urbanski
f24d744a3b Enable tests for Python 3.8-dev (#465) 2019-08-30 18:34:49 -05:00
Sebastián Ramírez
937b462cdd 📝 Update release notes 2019-08-30 18:15:08 -05:00
dconathan
3025a368c6 Add support and tests for Pydantic dataclasses in response_model (#454) 2019-08-30 18:12:15 -05:00
Sebastián Ramírez
c218e0d560 📝 Update release notes 2019-08-30 17:40:14 -05:00
Pablo Marti
1ed5aa23e6 ✏️ Fix typo in oauth2-jwt.md (#447) 2019-08-30 17:35:52 -05:00
Sebastián Ramírez
106d2171d8 📝 Update release notes 2019-08-30 17:34:45 -05:00
Zoltan Papp
c5817912d2 🐛 use media_type from Body params for OpenAPI requestBody (Fixes: #431) (#439) 2019-08-30 17:32:39 -05:00
Sebastián Ramírez
a7a92bc637 📝 Update release notes 2019-08-30 17:02:40 -05:00
naxty
68d1fea961 📝 Add article: Deploying a scikit-learn model with ONNX and FastAPI (#438) 2019-08-30 17:00:00 -05:00
Sebastián Ramírez
8c6b2d5804 📝 Update release notes 2019-08-30 16:48:53 -05:00
Zoltan Papp
19c53b21c1 Allow using custom 422 validation error and use media type from response class in schema (#437)
* media_type of additional responses from the response_class

* Use HTTPValidationError only if a custom one is not defined (Fixes: #429)
2019-08-30 16:46:05 -05:00
Sebastián Ramírez
44d63cd555 📝 Update release notes 2019-08-30 16:36:18 -05:00
Sebastián Ramírez
55c4b5fb0b 🐛 Fix "default" extra response with extra status codes (#489)
* 🐛 Fix lowercase "default" extra response

* 🐛 Fix model for responses, to allow "default" plus status codes

*  Add test for "default" extra response
2019-08-30 16:34:47 -05:00
Sebastián Ramírez
c32e800c23 📝 Update release notes 2019-08-30 11:30:52 -05:00
Zoltan Papp
73dbbeab55 Allow additional responses to use status ranges and "default" (#435) 2019-08-30 11:17:42 -05:00
Sebastián Ramírez
417a3ab140 🔖 Release 0.36.0 2019-08-26 08:28:33 -05:00
Sebastián Ramírez
a3235ed8de 📝 Update release notes 2019-08-26 08:27:31 -05:00
dmontagu
38495fffa5 🐛 Fix skip_defaults implementation when returning a Pydantic model (#422) 2019-08-26 08:24:58 -05:00
Sebastián Ramírez
b77a43bcac 📝 Update release notes 2019-08-24 22:08:10 -05:00
dmontagu
483eb73b26 🐛 Use caching logic to determine OpenAPI spec for duplicate dependencies (#417) 2019-08-24 21:55:25 -05:00
Sebastián Ramírez
51a928d3f5 📝 Update release notes 2019-08-24 20:08:04 -05:00
Sebastián Ramírez
e71636e381 🐛 Fix mypy route errors after merging #415 (#462) 2019-08-24 20:05:44 -05:00
Vitaliy Kucheryaviy
f7f17fcfd6 Allow empty routed path (issue #414) (#415) 2019-08-24 19:39:48 -05:00
Sebastián Ramírez
033bc2a6c9 🔖 Release 0.35.0 2019-08-07 14:12:15 -05:00
Sebastián Ramírez
28d3b9f783 📝 Update release notes 2019-08-07 14:09:50 -05:00
Pablo Marti
0c55553328 ✏️ Fix typo in assert statement (#419) 2019-08-07 14:03:11 -05:00
Bronsen
b66056aa34 📝 Fix plural-s without apostrophe in docs (#411) 2019-08-07 14:01:31 -05:00
Sebastián Ramírez
4f10b8b98d 📝 Update release notes 2019-08-07 13:57:41 -05:00
Koudai Aono
06eb421934 Fix request body parsing with Union (#400) 2019-08-07 13:55:33 -05:00
Sebastián Ramírez
bf229ad5d8 🔖 Release 0.34.0 upgrading Starlette 2019-08-06 07:22:06 -05:00
Sebastián Ramírez
d0319001be 📝 Update Release Notes 2019-08-06 07:13:24 -05:00
David De Sousa
c4682af13d ⬆️ Upgrade Starlette max range to 0.12.7 (#367) 2019-08-06 07:10:29 -05:00
Sebastián Ramírez
6ca3ce80e4 📝 Update release notes 2019-07-12 19:15:21 -05:00
Sebastián Ramírez
25e85c8522 Add test from @dmontagu in #333 for duplicate models (#385) 2019-07-12 19:13:28 -05:00
Sebastián Ramírez
6bf3ab3b7a 🔖 Release 0.33.0, including Pydantic 0.30.0 2019-07-12 19:01:27 -05:00
Sebastián Ramírez
f5ea5eef2a 📝 Update release notes 2019-07-12 18:58:09 -05:00
James Kaplan
46a986cacf ⬆️ Upgrade Pydantic to 0.30 (#384)
* bump pydantic to 0.30

* 📌 Pin Pydantic to 0.30 as 0.31 hasn't been released
2019-07-12 18:56:25 -05:00
Sebastián Ramírez
e620aeb46d 🔖 Release 0.32.0, as PR ##347 might be a breaking change
in some specific cases
2019-07-12 18:32:30 -05:00
Sebastián Ramírez
d1e2e46b80 🔖 Release 0.31.1 2019-07-12 18:30:54 -05:00
Sebastián Ramírez
b1c4a8acd5 📝 Update release notes 2019-07-12 18:29:49 -05:00
Martino Mensio
362e2cdc79 📝 Fix small typo in docs for features (#380) 2019-07-12 18:28:07 -05:00
Sebastián Ramírez
93e6a08acd 📝 Update release notes 2019-07-12 18:25:04 -05:00
Ben Williams
3ec4342282 📝 Change limit default parameter to 10 in Query docs (#366)
Rest of docs reference 10 as the default.
2019-07-12 18:22:21 -05:00
Sebastián Ramírez
dc483478eb 📝 Update release notes 2019-07-12 18:20:02 -05:00
Chris Withers
bdd251a05b 📝 Tweak wording on OAuth2 scopes (#371) 2019-07-12 18:17:34 -05:00
Sebastián Ramírez
195559ccba 📝 Update release notes 2019-06-28 21:29:29 +02:00
Sebastián Ramírez
9a71672a95 📝 Update enum examples to use str, and improve Swagger UI in examples (#351) 2019-06-28 21:27:27 +02:00
Sebastián Ramírez
7e48be1561 📝 Update release notes 2019-06-28 20:57:14 +02:00
Sebastián Ramírez
508f9ce954 🐛 Fix regression, Swagger UI with deep linking (#350) 2019-06-28 20:56:48 +02:00
Sebastián Ramírez
afbdf2546f 📝 Update release notes 2019-06-28 20:16:53 +02:00
Sebastián Ramírez
62df417807 Add test for templates in include_router path (#349) 2019-06-28 20:15:17 +02:00
Sebastián Ramírez
09d2747a70 📝 Update release notes 2019-06-28 20:00:24 +02:00
Sebastián Ramírez
d3ea6f7514 📝 Add note to docs about including same router multiple times (#348) 2019-06-28 19:54:49 +02:00
Sebastián Ramírez
02187636ea 📝 Update release notes 2019-06-28 19:40:31 +02:00
Sebastián Ramírez
687065509b 🏗️ Fix same function names in different modules with composite bodies (#347)
* 🏗️ Implement unique IDs for dynamic models

like those used for composite bodies and responses. IDs based on path (not only on function name, as it can be duplicated in a different module).

*  Add tests for same function name and composite body

*  Update OpenAPI in tests with new dynamic model ID generation
2019-06-28 19:35:16 +02:00
Sebastián Ramírez
b30cca8e9e 🔖 Release 0.31.0, upgrading Pydantic to 0.29 2019-06-28 17:01:04 +02:00
Sebastián Ramírez
3906777065 📝 Update release notes 2019-06-28 12:36:52 +02:00
Sebastián Ramírez
d60a10fa59 ⬆️ Upgrade support for Pydantic to 0.29 (#344) 2019-06-28 12:36:08 +02:00
Sebastián Ramírez
54368e7b22 🔖 Release 0.30.1 2019-06-28 09:39:29 +02:00
Sebastián Ramírez
acc556e416 📝 Update release notes 2019-06-27 22:44:54 +02:00
Sebastián Ramírez
700585f99d 📝 Add section about external links to docs (#341) 2019-06-27 22:44:15 +02:00
Sebastián Ramírez
4c2993f353 📝 Update release notes 2019-06-27 21:53:59 +02:00
Sebastián Ramírez
ea9277aab4 🔥 Remove Pipfile.lock from the repository (each contributor can keep his/her locally)
* 🔥 Remove Pipfile.lock

Being a library, it should work independent of locking of dependency tree.

The Pipfile (and Pipfile.lock) is only used locally for development of FastAPI itself, it doesn't affect final users (that is controlled with pyproject.toml).

The Pipfile.lock adds unnecessary noise to PRs that update/upgrade development packages, and the locking is not the same in all environments (e.g. Linux, Mac, and Windows).

Each FastAPI contributor (developing FastAPI itself) can have his/her own Pipfile.lock, but it doesn't have to be in git.

* 🙈 Add Pipfile.lock to .gitignore
2019-06-27 21:51:38 +02:00
Sebastián Ramírez
8d86fca027 📝 Update release notes 2019-06-27 21:33:07 +02:00
Sebastián Ramírez
fc0716a7dd 📝 Update Docs: Help FastAPI (#339) 2019-06-27 21:32:27 +02:00
Sebastián Ramírez
1e593dc4d4 📝 Update release notes 2019-06-27 20:53:54 +02:00
Sebastián Ramírez
dcc1e1bcf8 ♻️ Refine internal type declarations and logic around them (#338) 2019-06-27 20:51:17 +02:00
Sebastián Ramírez
06eb775c63 📝 Update release notes 2019-06-27 13:27:53 +02:00
Camila Gutierrez
ab77c069d4 📝 Update, simplify, and clarify the SQL tutorial (#331) 2019-06-27 13:25:16 +02:00
Sebastián Ramírez
46fffc0e94 📝 Update release notes 2019-06-27 13:22:56 +02:00
cyril
1c2cdb97e9 📝 Add online SQLite browsers to docs (#330) 2019-06-27 13:12:38 +02:00
Sebastián Ramírez
76b6fd5c18 🔖 Release 0.30.0 2019-06-20 12:32:24 +02:00
Sebastián Ramírez
a2fb716035 📝 Update release notes 2019-06-20 12:30:54 +02:00
Sebastián Ramírez
aa84ac8e3e Implement support for Pydantic's ORM mode (#322)
*  Implement support for Pydantic's ORM mode

* 🏗️ Re-structure/augment SQL tutorial source using ORM mode

* 📝 Update SQL docs with SQLAlchemy, ORM mode, relationships

* 🔥 Remove unused util in tutorial

* 📝 Add tutorials for simple dict bodies and responses

* 🔥 Remove old SQL tutorial

*  Add/update tests for SQL tutorial

*  Add tests for simple dicts (body and response)

* 🐛 Fix cloning field from original field
2019-06-20 11:31:32 +02:00
Sebastián Ramírez
4ed2bd1fea 📝 Update release notes 2019-06-18 13:54:36 +02:00
dmontagu
87b7a63ff2 🔥 Remove unused regex in routing.py (#314) 2019-06-18 13:52:34 +02:00
Sebastián Ramírez
06d0918c3d 📝 Update release notes 2019-06-18 09:49:43 +02:00
Eric Du
5b3adfe449 Use default response status reasons in additional responses (#313)
* default the description of additional response to status reason phrase

* fix 404 description

* fix lint warning

* allow custom response status code
2019-06-18 09:46:57 +02:00
Sebastián Ramírez
bdd794a0e6 📝 Update release notes 2019-06-18 09:40:31 +02:00
James Kaplan
f0df79aa91 ⬆️ Upgrade Pydantic to 0.28 (#320) 2019-06-18 09:37:40 +02:00
Sebastián Ramírez
c26f1760d4 🔖 Release 0.29.1 2019-06-13 18:47:43 +02:00
Sebastián Ramírez
e5fa4b0af6 📝 Update release notes 2019-06-13 18:39:17 +02:00
Sebastián Ramírez
a33c299fd7 🔧 Add format-imports script 2019-06-13 18:38:49 +02:00
Sebastián Ramírez
6939621730 bug: Fix handling an empty-body request with a required body param (#311)
* 🐛 Fix solving a required body param from an empty body request

*  Add tests for receiving required body parameters with body not provided
2019-06-13 18:37:48 +02:00
dmontagu
120ab08360 📝 Update response-directly.md, fix link (#306) 2019-06-13 18:34:20 +02:00
Andrew Widdersheim
3f5521fdfb 📝 Fix default response model docs (#288)
Fix a discrepancy in the `tax` parameters default value between the docs
and the code example.
2019-06-13 18:31:48 +02:00
Sebastián Ramírez
7244e4b612 🔖 Release version 0.29.0 2019-06-06 14:31:50 +04:00
Sebastián Ramírez
d329745064 📝 Update release notes 2019-06-06 14:30:28 +04:00
Sebastián Ramírez
5f7fe926ab Add support for Response parameters to set headers, cookies, and status codes (#294)
*  Add support for declaring a Response parameter to set headers and cookies

*  Add source for docs and tests

* 📝 Add docs for setting headers, cookies and status code

* 📝 Add attribution to Hug for inspiring response parameters
2019-06-06 14:29:40 +04:00
Sebastián Ramírez
c8eea09664 📝 Update release notes 2019-06-05 21:20:12 +04:00
Sebastián Ramírez
5700d65188 🔖 Release 0.28.0 2019-06-05 21:13:32 +04:00
Sebastián Ramírez
46178a5347 📝 Update release notes 2019-06-05 21:09:11 +04:00
Sebastián Ramírez
bff5dbbf5d Implement dependency value cache per request (#292)
*  Add dependency cache, with support for disabling it

*  Add tests for dependency cache

* 📝 Add docs about dependency value caching
2019-06-05 21:00:54 +04:00
Sebastián Ramírez
09cd7c47a1 Implement dependency overrides for testing (#291)
*  Implement dependency overrides for testing

*  Add docs source tests and extra tests for dependency overrides

* 📝 Add docs for testing dependencies with overrides
2019-06-05 15:43:18 +04:00
Sebastián Ramírez
e2fadcbc90 🔖 Release version 0.27.2 2019-06-03 22:03:24 +04:00
Sebastián Ramírez
b3bb29afa8 📝 Update relase notes 2019-06-03 22:01:09 +04:00
Sebastián Ramírez
c7db2ff858 🐛 Fix path and query parameters receiving dict as valid (#287)
* 🐛 Fix path and query parameters accepting dict

*  Add several tests to ensure invalid types are not accepted

* 📝 Document (to include tested source) using query params with list

* 🐛 Fix OpenAPI schema in query with list tutorial
2019-06-03 21:59:40 +04:00
Sebastián Ramírez
2a7ef5504a 🔖 Release 0.27.1 2019-06-03 18:44:03 +04:00
Sebastián Ramírez
27964c5ffd 📝 Update release notes 2019-06-01 10:00:26 +04:00
Sebastián Ramírez
d262f6e929 🐛 Fix HTTP Bearer security auto-error (#282) 2019-06-01 09:57:45 +04:00
Sebastián Ramírez
d61f5e4b55 📝 Update release notes 2019-05-30 19:43:32 +04:00
Sebastián Ramírez
3ed112e8a9 🐛 Fix type declaration of HTTPException (#279) 2019-05-30 19:43:02 +04:00
Sebastián Ramírez
9da626eb2c 🔖 Release version 0.27.0 2019-05-30 17:48:52 +04:00
Sebastián Ramírez
6f74c7327b 📝 Update release notes 2019-05-30 17:45:38 +04:00
dmontagu
360a2797c1 🐛 Fix docs link in oauth2-scopes.md (#275)
#274
2019-05-30 17:43:18 +04:00
Sebastián Ramírez
0552977cd6 📝 Update release notes 2019-05-30 17:41:40 +04:00
Sebastián Ramírez
bd407cc4ed Refactor param extraction using Pydantic Field (#278)
*  Refactor parameter dependency using Pydantic Field

* ⬆️ Upgrade required Pydantic version with latest Shape values

*  Add tutorials and code for using Enum and Optional

*  Add tests for tutorials with new types and extra cases

* ♻️ Format, clean, and add annotations to dependencies.utils

* 📝 Update tutorial for query parameters with list defaults

*  Add tests for query param with list default
2019-05-30 17:40:43 +04:00
Sebastián Ramírez
83b1a117cc 🔖 Release version 0.26.0 2019-05-29 19:29:44 +04:00
Sebastián Ramírez
2a1ff213a0 📝 Update release notes 2019-05-29 16:33:19 +04:00
Sebastián Ramírez
62af6e0eeb Separate Pydantic's ValidationError handler and improve docs for error handling (#273)
*  Implement separated ValidationError handlers and custom exceptions

*  Add tutorial source examples and tests

* 📝 Add docs for custom exception handlers

* 📝 Update docs section titles
2019-05-29 16:27:55 +04:00
Sebastián Ramírez
15da01af5c 📝 Update release notes 2019-05-29 13:46:27 +04:00
William Hayes
d544bdf092 📝 Update docs for paths in path params (#256) 2019-05-29 13:43:41 +04:00
Sebastián Ramírez
703ade7967 🐛 Fix path in path parameters (#272) 2019-05-29 13:34:46 +04:00
Sebastián Ramírez
58f135ba2f 📝 Update link in release notes 2019-05-29 11:51:43 +04:00
Sebastián Ramírez
713d374484 📝 Update release notes 2019-05-29 11:47:46 +04:00
Sebastián Ramírez
24e9ea28d3 Update testing docs, examples for testing POST, headers (#271) 2019-05-29 11:47:21 +04:00
Sebastián Ramírez
cae53138b2 📝 Update release notes 2019-05-27 21:56:49 +04:00
Sebastián Ramírez
a49d45eaa9 🐛 Fix response_model type to allow List[Model] (#266) 2019-05-27 21:56:20 +04:00
Sebastián Ramírez
3986f79029 🔖 Release version 0.25.0 2019-05-27 20:21:03 +04:00
Sebastián Ramírez
7379fde5ee 📝 Update release notes 2019-05-27 16:28:24 +04:00
Sebastián Ramírez
7b63bc5551 Add include, exclude, and by_alias to path operation methods (#264)
*  Make jsonable_encoder's include and exclude receive sequences

*  Add include, exclude, and by_alias to app and router

*  Add and update tutorial code with new parameters

* 📝 Update docs for new parameters and add docs for updating data

*  Add tests for consistency in path operation methods

*  Add tests for new parameters and update tests
2019-05-27 16:08:13 +04:00
Sebastián Ramírez
747ae8210f 📝 Update release notes 2019-05-25 19:48:27 +04:00
William Hayes
c651416e05 📝 Create CONTRIBUTING.md (#255) 2019-05-25 19:47:49 +04:00
Sebastián Ramírez
814f95e2bf 📝 Update release notes 2019-05-25 19:40:04 +04:00
William Hayes
d8716f94ae Add skip_defaults support for path operations (for #242) (#248) 2019-05-25 19:35:57 +04:00
Sebastián Ramírez
67f8cb3b4f 🔖 Release 0.24.0 2019-05-24 22:48:27 +04:00
Sebastián Ramírez
5c2828bd13 📝 Update release notes 2019-05-24 20:46:36 +04:00
James Kaplan
b087246f26 Add support for WebSockets with dependencies, params, etc #166 (#178) 2019-05-24 20:41:41 +04:00
Sebastián Ramírez
219d299426 📝 Update release notes 2019-05-23 11:04:13 +04:00
euri10
31da760729 ⬆️ Upgrade Pydantic to 0.26 (#247) 2019-05-23 11:03:53 +04:00
Sebastián Ramírez
fc89eb8f81 🔖 Release version 0.23.0 2019-05-21 23:26:28 +04:00
Sebastián Ramírez
6fca1041e9 📝 Update release notes 2019-05-21 23:05:46 +04:00
Sebastián Ramírez
9db1f5641b ⬆️ Upgrade Starlette to 0.12.0 (#243) 2019-05-21 22:59:48 +04:00
Sebastián Ramírez
c3beb56e63 📝 Update release notes 2019-05-21 22:46:22 +04:00
Steinthor Palsson
325edd5f00 Add swagger UI OAuth2 redirect page for implicit/code auth flows in API docs (#198) 2019-05-21 22:39:58 +04:00
Sebastián Ramírez
08322ef359 📝 Update release notes 2019-05-20 18:37:39 +04:00
Trim21
01b43e6e25 Make Swagger UI, ReDoc and OpenAPI handlers be coroutines to improve performance (#241) 2019-05-20 18:34:33 +04:00
Sebastián Ramírez
3cf92a156c 📝 Update release notes 2019-05-20 11:27:33 +04:00
euri10
f54d8d57a4 Make Swagger UI and ReDoc parameterizable to host offline assets for docs (#112) 2019-05-20 11:26:54 +04:00
Sebastián Ramírez
56ab106bbb 🔖 Release version 0.22.0 2019-05-16 18:09:11 +04:00
Sebastián Ramírez
e92b43b5c8 Add parameter dependencies to path operation decorators and include_router (#235)
*  Implement dependencies in decorator and .include_router

* 📝 Add docs for parameter dependencies

*  Add tests for dependencies parameter

* 🔥 Remove debugging prints in tests

* 📝 Update release notes
2019-05-16 18:07:00 +04:00
Sebastián Ramírez
7c50025c47 📝 Update release notes 2019-05-16 17:58:22 +04:00
euri10
adfbd27100 🐛 Fix OpenAPI URL format for Starlette convertors (#234) 2019-05-16 17:55:14 +04:00
Sebastián Ramírez
eada8bf7db 📝 Update release notes 2019-05-15 23:01:19 +04:00
Sebastián Ramírez
440b7a8efa 📝 Update relase notes 2019-05-15 22:14:25 +04:00
Sebastián Ramírez
fcaff64646 🔧 Separate format and lint scripts (#232) 2019-05-15 22:13:06 +04:00
Sebastián Ramírez
d240421378 📝 Add docs about params as functions for mypy (#231) 2019-05-15 22:01:23 +04:00
Sebastián Ramírez
ca27317b65 Add param functions, to override types, to make mypy happy (#226) 2019-05-15 21:25:11 +04:00
Sebastián Ramírez
ce02d3cb83 📝 Update release notes 2019-05-15 18:33:43 +04:00
Sebastián Ramírez
95475aaa9c 🔥 Remove Python version extraction in tests, no longer used 2019-05-15 18:33:13 +04:00
zamiramir
7a8b054a12 🎨 Reenable Black --check for Python 3.7 (#229)
Reenabled Black --check for python 3.7, issue is fixed.
see https://github.com/ambv/black/issues/494
2019-05-15 18:29:36 +04:00
Sebastián Ramírez
7b2993682f 🔖 Release 0.21.0 2019-05-15 14:54:46 +04:00
Sebastián Ramírez
73fad03b46 📝 Update release notes 2019-05-15 14:53:43 +04:00
Ricardo Momm
b0b88f9d5b 🔊 Raise from previous exception (#195) 2019-05-15 14:50:58 +04:00
Sebastián Ramírez
49d33f9f70 📝 Update release notes 2019-05-15 14:45:04 +04:00
Sebastián Ramírez
1f27981045 📝 Update release notes 2019-05-15 14:44:00 +04:00
euri10
f541d2c200 Use a logger instead of the root logging (#222) 2019-05-15 14:43:31 +04:00
euri10
0e99b23ebc ⬆️ Upgrade Pydantic to version 0.25 (#225) 2019-05-15 14:19:51 +04:00
Sebastián Ramírez
de341abe66 📝 Update release notes 2019-05-14 22:06:55 +04:00
Derek J. Lambert
4a1648b04e ✏️ Minor spelling fix in routing (#221) 2019-05-14 22:04:18 +04:00
Sebastián Ramírez
5f13b53ea5 🔧 Enable FastAPI releases bot in main Gitter channel 2019-05-11 19:44:39 +04:00
Sebastián Ramírez
5189c93d85 🔖 Release 0.20.1 2019-05-11 19:38:08 +04:00
Sebastián Ramírez
e612989313 📝 Update release notes 2019-05-11 13:46:17 +04:00
Steve B
d675991a34 add py.typed to ship typing information (#209)
As described in https://www.python.org/dev/peps/pep-0561/
2019-05-11 13:43:47 +04:00
Sebastián Ramírez
d03678dfbb 📝 Update release notes 2019-04-27 20:03:23 +04:00
Sebastián Ramírez
6ff89284c5 Add FastAPI releases bot for Gitter (#189)
* 🔥 Remove development util script

* 🎨 Reformat release notes with markdown-only code (no HTML)

*  Add FastAPI releases bot for Gitter
2019-04-27 20:02:32 +04:00
Sebastián Ramírez
7f673cf4e9 🔖 Release 0.20.0 2019-04-27 17:51:31 +04:00
Sebastián Ramírez
bac7230027 📝 Update release notes 2019-04-27 17:07:17 +04:00
Christopher Dignam
866af5bca6 ✏️ Fix typos in docs, from forms (#176) 2019-04-27 17:05:06 +04:00
Sebastián Ramírez
f4be79be51 📝 Update release notes 2019-04-27 17:04:00 +04:00
Sebastián Ramírez
3797c04946 Use 401 with WWW-Authenticate for OAuth2 and add scope_str (#188) 2019-04-27 17:00:56 +04:00
Sebastián Ramírez
9a9bfd7f93 📝 Update release notes 2019-04-26 19:28:54 +04:00
Sebastián Ramírez
ada1ecdb00 📝 Add Hypercorn as an alternative ASGI server (#187) 2019-04-26 19:26:38 +04:00
Sebastián Ramírez
3bbd38313b 📝 Update release notes 2019-04-26 19:08:04 +04:00
Sebastián Ramírez
c1df0f6b84 Add docs and tests for Jinja2 templates (#186)
*  Add docs and tests for Jinja2 templates

* 🎨 Fix format in test, remove unused import
2019-04-26 18:49:15 +04:00
Sebastián Ramírez
0cd5485597 📝 Update release notes 2019-04-26 15:17:32 +04:00
Sebastián Ramírez
528ef7e079 Docs and tests, responses with headers and cookies (#185) 2019-04-26 15:13:59 +04:00
Sebastián Ramírez
8e3a7699a3 🔖 Release 0.19.0 2019-04-26 13:48:30 +04:00
Sebastián Ramírez
8998ccaffb 📝 Update release notes 2019-04-26 13:45:38 +04:00
Sebastián Ramírez
2b7f201a44 📝 Add docs about returning a response directly and encoder (#184) 2019-04-26 13:40:23 +04:00
Sebastián Ramírez
192ebba2a2 ♻️ Rename parameter content_type to response_class (#183) 2019-04-26 13:11:16 +04:00
Sebastián Ramírez
8880c4cb03 🔖 Release 0.18.0 2019-04-22 21:08:43 +04:00
Sebastián Ramírez
6324be684f 📝 Update release notes 2019-04-21 22:31:43 +04:00
Sebastián Ramírez
c705685394 Add docs for HTTP Basic Auth and tests (#177) 2019-04-21 22:30:58 +04:00
Sebastián Ramírez
945f401d8e 📝 Update release notes 2019-04-21 21:46:00 +04:00
Sebastián Ramírez
f216d340ec Add automatic header handling for HTTP Basic Auth (#175)
*  Add automatic header handling for HTTP Basic Auth

* 🎨 Remove obsolete comment
2019-04-21 21:44:25 +04:00
Sebastián Ramírez
a4558e7053 📝 Update release notes 2019-04-21 20:21:53 +04:00
Sebastián Ramírez
298f8478e2 🔒 Fix development dependencies security (#174) 2019-04-21 20:20:25 +04:00
Sebastián Ramírez
b86d163470 📝 Rename additional response OpenAPI declarations 2019-04-21 20:13:26 +04:00
Sebastián Ramírez
9e2d37b89c 📝 Update release notes 2019-04-21 19:57:07 +04:00
Sebastián Ramírez
97adadd9e1 📝 Add docs for middleware (#173) 2019-04-21 19:56:20 +04:00
Sebastián Ramírez
26e3dffb37 🚀 Deploy when tagged using Python 3.6 2019-04-20 22:16:07 +04:00
Sebastián Ramírez
aa7b4bd101 🔖 0.17.0 2019-04-20 22:12:55 +04:00
Sebastián Ramírez
ffc4c716c0 🚀 Make Flit publish from CI (#170) 2019-04-20 22:09:35 +04:00
Sebastián Ramírez
ef7b6e8eaf 📝 Update Release Notes 2019-04-20 21:15:03 +04:00
Sebastián Ramírez
596243f4a5 Add docs about CORS (#169) 2019-04-20 21:13:01 +04:00
Sebastián Ramírez
766bf1c5aa 📝 Update release notes 2019-04-20 20:31:44 +04:00
Sebastián Ramírez
9e748dbca4 By default, encode by alias (#168) 2019-04-20 20:29:54 +04:00
Sebastián Ramírez
cefe6cf92c 🔖 Release version 0.16.0 2019-04-16 23:28:13 +04:00
Sebastián Ramírez
be3953499f 📝 Update release notes 2019-04-16 23:27:25 +04:00
Sebastián Ramírez
546d233dec ♻️ Update Pydantic usage, types, values, minor structure changes (#164) 2019-04-16 23:26:09 +04:00
Sebastián Ramírez
61dd36a945 Upgrade docstring Markdown parsing (#163)
*  Upgrade docstring Markdown parsing

* 📝 Update release notes
2019-04-16 22:49:18 +04:00
Sebastián Ramírez
27f9d55c3e 📝 Update release notes 2019-04-16 22:43:59 +04:00
euri10
906cc60f65 ⬆️ Upgrade Pydantic to 0.23 (#160)
* Add websocket to APIRouter

* Upgrade pydantic to v0.23.0

* Forgot pyproject.toml

* ⬆️ Upgrade some Pipfile.lock dependencies
2019-04-16 22:42:00 +04:00
Sebastián Ramírez
69afaf256f 📝 Update release notes 2019-04-16 22:21:32 +04:00
Daniel Michaels
4ab349a2a8 ✏️ fixed small typo /tutorial/extra-models.md (#159) 2019-04-16 22:20:03 +04:00
Sebastián Ramírez
9c258107b4 📝 Update release notes 2019-04-16 22:18:42 +04:00
hayata-yamamoto
29a4f90bcd 📝 fix URL examples in Tutorial: Query Parameters (#157)
* modify tutorial

* modify item_id
2019-04-16 22:16:16 +04:00
Sebastián Ramírez
361fd00777 📝 Add note about Swagger UI and multi-part uploads 2019-04-14 22:24:31 +04:00
Sebastián Ramírez
4c3cf31730 🔖 Release 0.15.0, multi-file uploads 2019-04-14 22:14:20 +04:00
Sebastián Ramírez
aad6b123f7 Add support for multi-file uploads (#158) 2019-04-14 22:12:14 +04:00
Sebastián Ramírez
e40e87c662 📝 Use same link in benchmarks as in index 2019-04-12 22:56:09 +04:00
Sebastián Ramírez
84de980977 Add docs about responses with additional status codes (#156)
*  Add docs about responses with additional status codes

* 📝 Update docs, link to documenting additional responses
2019-04-12 22:43:21 +04:00
Sebastián Ramírez
08484603ee 🔖 Release 0.14.0 2019-04-12 21:56:22 +04:00
Sebastián Ramírez
ab6dd60997 📝 Add note on installing and running pytest 2019-04-12 21:45:19 +04:00
Sebastián Ramírez
c9ef7bd6dc 📝 Update release notes 2019-04-12 21:27:24 +04:00
Sebastián Ramírez
88ece95a30 🎨 Improve automatic naming of path operations in API docs (#155)
* 🎨 Improve operation summary naming

* 📝 Update names in README

* 🚚 Improve names of security tutorial
2019-04-12 21:25:26 +04:00
Sebastián Ramírez
366c5db0bb 📝 Update release notes 2019-04-12 20:18:48 +04:00
Sebastián Ramírez
46e3811f8d Add testing docs and tests (#151)
* ✏️ Fix typo in security intro

*  Add testing docs and tests

* 🐛 Debug Travis coverage

* 🐛 Debug Travis coverage, report XML

* 💚 Make Travis/Flit use same code install

*  Revert Travis/Codecov debugging changes
2019-04-12 20:15:05 +04:00
Sebastián Ramírez
613e211d20 📝 Update release notes 2019-04-12 11:51:26 +04:00
William Hayes
500f2b2ad4 Add deeplinking to Swagger UI (#148)
Update the Swagger UI docs to deep link to path operations to share them more easily.
2019-04-12 11:49:32 +04:00
Sebastián Ramírez
5cf7718657 📝 Update release notes 2019-04-12 11:40:56 +04:00
Sebastián Ramírez
727b656c8d ⬆️ Update development dependencies, Pipfile.lock (#150) 2019-04-12 11:39:06 +04:00
Sebastián Ramírez
cc7102e9b8 📝 Add opinions in main page 2019-04-10 22:27:28 +04:00
Sebastián Ramírez
5123915fe4 📝 Include Hug and Falcon in Alternatives/Inspiration 2019-04-10 22:09:50 +04:00
Sebastián Ramírez
1b8bbd51d8 🔖 Release 0.13.0 2019-04-09 23:38:11 +04:00
Sebastián Ramírez
1e4f86db6d 📝 Update release notes and OAuth2 scopes docs 2019-04-09 23:36:18 +04:00
Sebastián Ramírez
7391056daf Add OAuth2 scopes with SecurityScopes, upgrade Security (#141)
*  Upgrade OAuth2 Security with scopes handling

* 📝 Update Security tutorial with OAuth2 and JWT

*  Add tutorial code for OAuth2 with scopes (and JWT)

*  Add tests for tutorial/OAuth2 with scopes

* 🐛 Fix security_scopes type declaration

*  Add docs and tests for SecurityScopes
2019-04-09 23:29:04 +04:00
Sebastián Ramírez
6a274d18b4 🔖 Release 0.12.1, fix responses in include_router 2019-04-05 20:08:36 +04:00
Sebastián Ramírez
62626b0175 📝 Update release notes 2019-04-05 20:08:00 +04:00
Sebastián Ramírez
c8df3ae57c 🐛 Fix handling additional responses in include_router (#140) 2019-04-05 20:06:40 +04:00
Sebastián Ramírez
6f7f9268f6 📝 Update release notes 2019-04-05 16:24:04 +04:00
Matthew McLeod
50653e205f 📝 Fix typo in SQL tutorial (#138) 2019-04-05 16:22:33 +04:00
Sebastián Ramírez
50a280b17b 📝 Update release notes 2019-04-05 16:21:17 +04:00
Mostapha Sadeghipour Roudsari
c1da3b38a3 📝 fix typos in nested models and OAuth2 with JWT (#127) 2019-04-05 16:08:59 +04:00
Sebastián Ramírez
e68a68c97c 🔖 Release 0.12.0, add additional responses 2019-04-05 14:35:01 +04:00
Sebastián Ramírez
907e613ff2 🔧 Update test-conv-html.sh to allow extra params 2019-04-05 14:29:36 +04:00
Sebastián Ramírez
f0fc2fad2c 📝 Update release notes 2019-04-05 14:28:30 +04:00
Sebastián Ramírez
ad471307e2 Additional Responses (#97)
Add additional responses to OpenAPI, including Pydantic models or schemas directly, custom status codes, media types, extending `response_model`, etc.
2019-04-05 14:18:28 +04:00
Sebastián Ramírez
2bd775988f Add/refactor addditional responses, tests, docs 2019-04-05 13:54:00 +04:00
Sebastián Ramírez
c59ddc8a24 🔖 Release 0.11.0 2019-04-03 15:51:44 +04:00
Sebastián Ramírez
378b39bbbc 📝 Update release notes 2019-04-03 15:49:58 +04:00
Sebastián Ramírez
37e0306517 📝 Update default error response in SQL tutorial 2019-04-03 15:49:40 +04:00
Sebastián Ramírez
fad3a9e1dc Add auto_error to security utils (#134)
to allow them to be optional, also allowing the declaration of multiple security schemes
2019-04-03 15:44:52 +04:00
Sebastián Ramírez
b35b0a9a90 📝 Update release notes 2019-03-31 22:05:03 +04:00
Alex Iribarren
1426b6200a 🗃️ Close the DB even if exceptions are raised (#89)
* Close the DB even if exceptions are raised

* 📝 Add note about closing DB in finally
2019-03-31 22:01:32 +04:00
Sebastián Ramírez
40e5f3764e 📝 Update release notes 2019-03-31 20:56:52 +04:00
Alif Jahan
e5c75807ce 🔥 removed duplicate dependency in pyproject.toml (#128) 2019-03-31 20:55:12 +04:00
Sebastián Ramírez
deff2b6678 🔖 Release 0.10.3 2019-03-30 21:54:00 +04:00
Sebastián Ramírez
7c572fdb3a 📝 Update release notes 2019-03-30 21:32:24 +04:00
Daniel Hahler
ae970638cf 👷 Set Travis to use dist=xenial and Python 3.7 instead of 3.7-dev (#92) 2019-03-30 21:30:31 +04:00
Sebastián Ramírez
deae92bba1 📝 Update release notes 2019-03-30 21:09:47 +04:00
yihuang
f806ba642a 🔥 Remove repeated param declaration (#123) 2019-03-30 21:07:41 +04:00
Sebastián Ramírez
5a3cf863da 📝 Update release notes 2019-03-30 19:55:01 +04:00
Sebastián Ramírez
dd6ab23b62 Add docs/tests extending OpenAPI (#126) 2019-03-30 19:53:44 +04:00
Sebastián Ramírez
0449499188 📝 Update release notes 2019-03-30 18:32:23 +04:00
The Gitter Badger
4dc7b32861 📝 Add a Gitter chat badge and links (#117)
* Add Gitter badge

* 📝 Add links and badges to Gitter chat
2019-03-30 18:30:02 +04:00
Sebastián Ramírez
08d849d5c5 📝 Update release notes 2019-03-29 19:06:02 +04:00
James Saunders
714e68b5f0 📝 Add note in response model docs: why not return type annotations (#109)
* Update response model documentation to explain design choice

Closes #101

* 📝 Update note about return function type annotation
2019-03-29 19:02:53 +04:00
Sebastián Ramírez
3d4f59f35a 📝 Udpate release notes 2019-03-29 18:43:40 +04:00
Stratos Gerakakis
3ce2920fef 🐛 fix name of shutdown_event in docs (#105)
Fix name copy/paste name error in docs source for startup/shutdown events.
2019-03-29 18:39:57 +04:00
Sebastián Ramírez
825f397918 🔖 Release 0.10.2 2019-03-29 15:17:34 +04:00
Sebastián Ramírez
b390e32372 📝 Update release notes 2019-03-29 15:16:56 +04:00
Sebastián Ramírez
b7d184363f 🐛 Fix JSON Schema of additional properties (#121)
#87
2019-03-29 15:15:49 +04:00
Sebastián Ramírez
2ddb804940 📝 Update release notes 2019-03-25 23:48:27 +04:00
Sebastián Ramírez
a2c9f666b5 📝 Add note about Celery in background tasks 2019-03-25 23:47:25 +04:00
Sebastián Ramírez
1594222e39 📝 Update Release Notes 2019-03-25 23:28:36 +04:00
Sebastián Ramírez
dc1e94d05f Document and test union and list response models (#108) 2019-03-25 23:28:09 +04:00
Sebastián Ramírez
b0f7961b65 🔖 Release 0.10.1: support for encode/databases 2019-03-25 22:21:59 +04:00
Sebastián Ramírez
1c2ecbb89a Add docs and tests for encode/databases (#107)
*  Add docs and tests for encode/databases

*  Add testing-only dependency, databases
2019-03-25 22:17:31 +04:00
Sebastián Ramírez
5a6e47bd49 🔖 Release 0.10.0: BackgroundTasks and websockets fix 2019-03-24 23:37:37 +04:00
Sebastián Ramírez
58872dca74 📝 Udpate release notes 2019-03-24 23:36:57 +04:00
Sebastián Ramírez
9b04593260 Add support for BackgroundTasks parameters (#103)
*  Add support for BackgroundTasks parameters

* 🐛 Fix type declaration in dependencies

* 🐛 Fix coverage of util in tests
2019-03-24 23:33:35 +04:00
euri10
6d77e2ac5f Add websocket to APIRouter (#100)
* Add websocket to APIRouter

* Restore upstream/master Pipfile.lock (git checkout upstream/master -- Pipfile.lock)

* Added tests for router with a prefix
2019-03-24 23:18:20 +04:00
Sebastián Ramírez
b16ca54c30 📝 Update Release Notes 2019-03-24 12:46:13 +04:00
Sebastián Ramírez
834723cf2c Add events docs and tests (#99) 2019-03-24 12:45:46 +04:00
Mohammed
eda9b28338 files formatting 2019-03-23 13:10:45 +03:00
Mohammed
7514ac6fb0 100% test coverage 2019-03-23 13:01:53 +03:00
Mohammed
25fb4239cc increase test coverage 2019-03-23 01:13:09 +03:00
Mohammed
65568065e0 Remove extra code. 2019-03-23 00:47:32 +03:00
Mohammed
95679ca5e6 Fix: adding additional_responses on .include_router() 2019-03-23 00:37:10 +03:00
Mohammed
84a300ef84 Formatting according to guide 2019-03-22 22:54:48 +03:00
Mohammed
c6d28c8209 Accept Multiple Additional Responses 2019-03-22 22:50:47 +03:00
Mohammed
3984e9b8ac Additional Responses test 2019-03-22 22:40:46 +03:00
Mohammed
aa0bca7bb2 Additional Responses implementation 2019-03-22 22:40:07 +03:00
Sebastián Ramírez
9778542ba6 🔖 Release 0.9.1, multi value/duplicate query/header 2019-03-22 21:52:37 +04:00
Sebastián Ramírez
34c34c68d2 📝 Update release notes 2019-03-22 21:51:36 +04:00
Sebastián Ramírez
c64f8346ae Multi-value query parameters and duplicate headers (#95)
* 📝 Document multi-value query parameters

*  Document and test multiple query values

*  Document receiving duplicate headers
2019-03-22 21:47:54 +04:00
Sebastián Ramírez
4f852878d6 🔖 Release 0.9.0, compatible with latest Pydantic 2019-03-22 16:29:33 +04:00
Sebastián Ramírez
59bc4b7d69 📝 Update links in help section 2019-03-22 16:28:28 +04:00
Sebastián Ramírez
3cae2ccbae 📝 Fix link from deployment to bigger applications 2019-03-21 20:35:49 +04:00
Matt Hegarty
e21ba7646a ✏️ typo: fist_name -> first_name (#72) 2019-03-21 18:50:47 +04:00
Sebastián Ramírez
10498fcfbd 📝 Update release notes 2019-03-21 18:48:17 +04:00
Sebastián Ramírez
3f7b7837fb 🔀 Merge PR #72 2019-03-21 18:46:02 +04:00
Sebastián Ramírez
1c26e77a66 📝 Update release notes 2019-03-21 18:40:59 +04:00
Sebastián Ramírez
108c2f3c0e ⬆️ Update Pydantic to 0.21.0 (#90)
* ⬆️ Upgrade Pydantic and others (isort), update docs after changes by isort

* 🎨 Format with newest isort, update type hints in jsonable_encoder

* 🔧 Update test script, to avoid Pydantic type errors

* ⬆️ Update pyproject.toml with latest Pydantic
2019-03-21 18:40:29 +04:00
Sebastián Ramírez
f2fd948ce3 📝 Update release notes 2019-03-21 18:10:08 +04:00
Sebastián Ramírez
b269655b7f 📝 Add docs for application configuration (OpenAPI) 2019-03-21 18:08:10 +04:00
Sebastián Ramírez
a174f01901 🔖 Release version 0.8.0 2019-03-16 21:24:26 +04:00
Sebastián Ramírez
9b76ad1870 ✏️ Fix typos in README 2019-03-16 21:23:35 +04:00
Sebastián Ramírez
f1c367aead 📝 Update docs - Release Notes 2019-03-16 21:21:56 +04:00
Sebastián Ramírez
8291c664b9 🔀 Merge origin master with release notes 2019-03-16 21:20:54 +04:00
euri10
e8472ebbd1 🔧 Make scripts executable (#76) 2019-03-16 21:19:13 +04:00
Sebastián Ramírez
f4391e2a87 📝 Add tags parameter to Release Notes 2019-03-16 21:17:27 +04:00
euri10
11c755bee3 Add tags parameter to app.include_router (#55) 2019-03-16 21:15:08 +04:00
Sebastián Ramírez
35054a450c 📝 Update release notes 2019-03-09 22:12:00 +04:00
Sebastián Ramírez
da60de33c1 📝 Update Uvicorn docs with new --reload option (#74) 2019-03-09 22:10:25 +04:00
Sebastián Ramírez
c0758dfe71 📝 Update release-notes with isort changes 2019-03-09 15:04:47 +04:00
Sebastián Ramírez
1112ac7538 ⬆️ Update imports and scripts for new isort versions (#75) 2019-03-09 15:04:13 +04:00
Sebastián Ramírez
ac2b18bf40 🔖 Release 0.7.1, Raspberry Pi deployment and docs 2019-03-04 20:07:11 +04:00
Sebastián Ramírez
b89a24448b 📝 Update release notes 2019-03-04 20:06:24 +04:00
Zaar Hai
e76216dd26 Clarification about possible performance hit (#64)
* Furether technical details towards #33.

* 📝 Update note about previous async frameworks
2019-03-04 20:04:16 +04:00
Sebastián Ramírez
123d778a0c 📝 Add instructions for Docker on Raspberry Pi 2019-03-04 19:37:46 +04:00
Sebastián Ramírez
829ad209a6 📝 Update benchmarks link 2019-03-04 17:29:53 +04:00
Sebastián Ramírez
b15a65c37e 📝 Update release notes 2019-03-04 11:18:45 +04:00
Sebastián Ramírez
0eed798aac 👷 Limit Docker trigger to branch master 2019-03-04 11:17:56 +04:00
Sebastián Ramírez
2caca42b9e 👷 Trigger Docker images build on Travis (#65) 2019-03-04 11:12:21 +04:00
Sebastián Ramírez
7658d0af16 📝 Clarify uploadfile async method calls 2019-03-04 11:07:15 +04:00
Sebastián Ramírez
c14ec50f73 🔖 Release 0.7.0, with support for UploadFile 2019-03-03 21:06:42 +04:00
Sebastián Ramírez
6b6ea0da2e 📝 Update release notes with UploadFile 2019-03-03 21:05:58 +04:00
Sebastián Ramírez
0b9fe62a10 Add support for UploadFile class annotations (#63)
*  Add support for UploadFile annotations

* 📝 Update File upload docs with FileUpload class

*  Add tests for UploadFile support

* 📝 Update UploadFile docs
2019-03-03 20:52:37 +04:00
Sebastián Ramírez
1f03e85f06 🔖 Release 0.6.4 2019-03-02 22:33:48 +04:00
Sebastián Ramírez
b98bf178a6 📝 Update release notes with WebSockets 2019-03-02 21:51:01 +04:00
Sebastián Ramírez
bbd2198fa2 Add docs for WebSockets (#62) 2019-03-02 21:45:15 +04:00
Sebastián Ramírez
e2723e8480 📝 Update release notes 2019-03-02 20:00:27 +04:00
Sebastián Ramírez
1896153d58 ✏️ Fix typos 2019-03-02 19:54:52 +04:00
Sebastián Ramírez
770b4421f9 📝 Add History, Design and Future to docs 2019-03-02 19:54:15 +04:00
Sebastián Ramírez
e89aacbdf7 📝 Add link to Python docs in debugging section 2019-03-02 17:56:30 +04:00
Sebastián Ramírez
cf25291650 📝 Update release notes 2019-03-02 17:55:07 +04:00
Sebastián Ramírez
13772fbd11 📝 Add note about bigger applications in Docker 2019-03-02 17:52:24 +04:00
Sebastián Ramírez
1d69b6f480 📝 Update release notes 2019-03-02 17:44:48 +04:00
Sebastián Ramírez
01d6aa3dd1 📝 Add docs for debugging 2019-03-02 17:40:01 +04:00
Sebastián Ramírez
74db8ddf9b 📝 Update release notes 2019-03-02 13:53:16 +04:00
Sebastián Ramírez
819b3b2516 📝 Add technical details about async def handling (#61)
#33
2019-03-02 13:48:06 +04:00
Sebastián Ramírez
76fb2879ed ✏️ Fix typo in release notes 2019-03-02 13:02:06 +04:00
Sebastián Ramírez
daaf654868 🔖 Release 0.6.3: favicons in docs 2019-02-24 01:49:04 +04:00
Sebastián Ramírez
6e0553b4cf 📝 Update release notes, favicons 2019-02-24 01:32:39 +04:00
Sebastián Ramírez
8e1ecaf221 💄 Add FastAPI favicons to docs (#53) 2019-02-24 01:31:50 +04:00
Sebastián Ramírez
9e610030fb ✏️ Fix typo in release notes 2019-02-24 01:12:33 +04:00
Sebastián Ramírez
9940c1511e 🔖 Release 0.6.2, SQL tutorial improvements and project generator 2019-02-24 01:09:49 +04:00
Sebastián Ramírez
24d94298d0 📝 Update release notes with SQL tutorial changes 2019-02-24 01:09:00 +04:00
Sebastián Ramírez
e3b4019fa3 Update SQL with dependency and intro project generator (#52) 2019-02-24 01:04:44 +04:00
Sebastián Ramírez
502ab432b8 💄 Add PNG images to improve link previews 2019-02-23 23:59:17 +04:00
Sebastián Ramírez
9051ec3816 📝 Improve naming of middleware in SQLAlchemy tutorial 2019-02-21 10:15:39 +04:00
Sebastián Ramírez
22f4e18cdd ✏️ Fix GraphQL typo 2019-02-20 22:02:19 +04:00
Sebastián Ramírez
4473e6a096 🔖 Release 0.6.1: GraphQL 2019-02-20 21:59:24 +04:00
Sebastián Ramírez
984dd71d13 Add docs for GraphQL (#48) 2019-02-20 21:58:26 +04:00
Sebastián Ramírez
bf53518141 📝 Include PR in Release Notes 2019-02-19 21:22:51 +04:00
Sebastián Ramírez
0ed55eb7d3 🔖 Release 0.6.0, upgrade Starlette, improve SQLAlchemy compatibility 2019-02-19 21:20:32 +04:00
Sebastián Ramírez
12e087f0b5 Use request.state for SQLAlchemy session in tutorial (#45) 2019-02-19 21:18:28 +04:00
Sebastián Ramírez
ba10838c30 ⬆️ Upgrade Starlette and fix compatibility (#44) 2019-02-19 20:27:48 +04:00
Sebastián Ramírez
656e1c7ce9 🙈 Add test.db to .gitignore 2019-02-18 22:55:48 +04:00
Sebastián Ramírez
88b31e6a4d 🔖 Release 0.5.1: docs 2019-02-18 22:52:03 +04:00
Sebastián Ramírez
2c3b826810 📝 Add contributing/development docs (#42) 2019-02-18 22:40:31 +04:00
Sebastián Ramírez
aa64eecda6 Update error handling docs, including Starlette's utils (#41)
📝 Update error handling docs, including Starlette's utils
2019-02-18 21:58:21 +04:00
Sebastián Ramírez
712b18a58a 📝 Update docs 2019-02-16 19:36:09 +04:00
Sebastián Ramírez
a809da5567 📝 Add note about path declaration order 2019-02-16 19:23:42 +04:00
Sebastián Ramírez
80b68cd97d 📝 Add section about help/getting help 2019-02-16 18:10:15 +04:00
Sebastián Ramírez
894e131e03 🔖 Release 0.5.0 with new HTTPException 2019-02-16 17:06:31 +04:00
Sebastián Ramírez
8772e2f2ee Add HTTPException with custom headers (#35)
* 📝 Update Release Notes with issue templates

*  Add HTTPException with support for headers

Including docs and tests

* 📝 Update Security docs to use new HTTPException
2019-02-16 17:01:29 +04:00
Sebastián Ramírez
7edbd9345b Update issue templates (#34)
Update issue templates
2019-02-16 14:09:20 +04:00
Sebastián Ramírez
56819fdd89 📝 Update Release Notes 2019-02-16 13:47:05 +04:00
euri10
febf8e7341 📝 Add docs for using the Starlette Request directly (#25)
Add docs for using the Starlette Request directly
2019-02-16 12:44:56 +04:00
Sebastián Ramírez
293ebd7cc2 📝 Update Release Notes 2019-02-15 23:19:19 +04:00
Sebastián Ramírez
54e3949f74 📝 Update SQLAlchemy docs, with current workaround 2019-02-15 22:05:18 +04:00
989 changed files with 77693 additions and 6093 deletions

5
.flake8 Normal file
View File

@@ -0,0 +1,5 @@
[flake8]
max-line-length = 88
select = C,E,F,W,B,B9
ignore = E203, E501, W503
exclude = __init__.py

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: [tiangolo]

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View File

@@ -0,0 +1,104 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: ''
---
### First check
* [ ] I added a very descriptive title to this issue.
* [ ] I used the GitHub search to find a similar issue and didn't find it.
* [ ] I searched the FastAPI documentation, with the integrated search.
* [ ] I already searched in Google "How to X in FastAPI" and didn't find any information.
* [ ] I already read and followed all the tutorial in the docs and didn't find an answer.
* [ ] I already checked if it is not related to FastAPI but to [Pydantic](https://github.com/samuelcolvin/pydantic).
* [ ] I already checked if it is not related to FastAPI but to [Swagger UI](https://github.com/swagger-api/swagger-ui).
* [ ] I already checked if it is not related to FastAPI but to [ReDoc](https://github.com/Redocly/redoc).
* [ ] After submitting this, I commit to:
* Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
* Or, I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
* Implement a Pull Request for a confirmed bug.
<!--
I'm asking all this because answering questions and solving problems in GitHub issues consumes a lot of time. I end up not being able to add new features, fix bugs, review Pull Requests, etc. as fast as I wish because I have to spend too much time handling issues.
All that, on top of all the incredible help provided by a bunch of community members that give a lot of their time to come here and help others.
That's a lot of work they are doing, but if more FastAPI users came to help others like them just a little bit more, it would be much less effort for them (and you and me 😅).
-->
### Example
Here's a self-contained [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) with my use case:
<!-- Replace the code below with your own self-contained, minimal, reproducible, example -->
```Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
```
### Description
<!-- Replace the content below with your own feature request -->
* Open the browser and call the endpoint `/`.
* It returns a JSON with `{"Hello": "World"}`.
* I would like it to have an extra parameter to teleport me to the moon and back.
### The solution you would like
<!-- Replace this with your own content -->
I would like it to have a `teleport_to_moon` parameter that defaults to `False`, and can be set to `True` to teleport me:
```Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/", teleport_to_moon=True)
def read_root():
return {"Hello": "World"}
```
### Describe alternatives you've considered
<!-- Replace this with your own ideas -->
To wait for Space X moon travel plans to drop down long after they release them. But I would rather teleport.
### Environment
* OS: [e.g. Linux / Windows / macOS]:
* FastAPI Version [e.g. 0.3.0]:
To know the FastAPI version use:
```bash
python -c "import fastapi; print(fastapi.__version__)"
```
* Python version:
To know the Python version use:
```bash
python --version
```
### Additional context
<!-- Add any other context or screenshots about the question here. -->

81
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@@ -0,0 +1,81 @@
---
name: Question or Problem
about: Ask a question or ask about a problem
title: ""
labels: question
assignees: ""
---
### First check
* [ ] I added a very descriptive title to this issue.
* [ ] I used the GitHub search to find a similar issue and didn't find it.
* [ ] I searched the FastAPI documentation, with the integrated search.
* [ ] I already searched in Google "How to X in FastAPI" and didn't find any information.
* [ ] I already read and followed all the tutorial in the docs and didn't find an answer.
* [ ] I already checked if it is not related to FastAPI but to [Pydantic](https://github.com/samuelcolvin/pydantic).
* [ ] I already checked if it is not related to FastAPI but to [Swagger UI](https://github.com/swagger-api/swagger-ui).
* [ ] I already checked if it is not related to FastAPI but to [ReDoc](https://github.com/Redocly/redoc).
* [ ] After submitting this, I commit to one of:
* Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
* I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
* Implement a Pull Request for a confirmed bug.
<!--
I'm asking all this because answering questions and solving problems in GitHub issues consumes a lot of time. I end up not being able to add new features, fix bugs, review Pull Requests, etc. as fast as I wish because I have to spend too much time handling issues.
All that, on top of all the incredible help provided by a bunch of community members that give a lot of their time to come here and help others.
That's a lot of work they are doing, but if more FastAPI users came to help others like them just a little bit more, it would be much less effort for them (and you and me 😅).
-->
### Example
Here's a self-contained, [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) with my use case:
<!-- Replace the code below with your own self-contained, minimal, reproducible, example, if I (or someone) can copy it, run it, and see it right away, there's a much higher chance I (or someone) will be able to help you -->
```Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
```
### Description
<!-- Replace the content below with your own problem, question, or error -->
* Open the browser and call the endpoint `/`.
* It returns a JSON with `{"Hello": "World"}`.
* But I expected it to return `{"Hello": "Sara"}`.
### Environment
* OS: [e.g. Linux / Windows / macOS]:
* FastAPI Version [e.g. 0.3.0]:
To know the FastAPI version use:
```bash
python -c "import fastapi; print(fastapi.__version__)"
```
* Python version:
To know the Python version use:
```bash
python --version
```
### Additional context
<!-- Add any other context or screenshots about the question here. -->

View File

@@ -0,0 +1,7 @@
FROM python:3.7
RUN pip install httpx "pydantic==1.5.1" pygithub
COPY ./app /app
CMD ["python", "/app/main.py"]

View File

@@ -0,0 +1,13 @@
name: Comment Docs Preview in PR
description: Comment with the docs URL preview in the PR
author: Sebastián Ramírez <tiangolo@gmail.com>
inputs:
token:
description: Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}
required: true
deploy_url:
description: The deployment URL to comment in the PR
required: true
runs:
using: docker
image: Dockerfile

View File

@@ -0,0 +1,70 @@
import logging
import sys
from pathlib import Path
from typing import Optional
import httpx
from github import Github
from github.PullRequest import PullRequest
from pydantic import BaseModel, BaseSettings, SecretStr, ValidationError
github_api = "https://api.github.com"
class Settings(BaseSettings):
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
input_token: SecretStr
input_deploy_url: str
class PartialGithubEventHeadCommit(BaseModel):
id: str
class PartialGithubEventWorkflowRun(BaseModel):
head_commit: PartialGithubEventHeadCommit
class PartialGithubEvent(BaseModel):
workflow_run: PartialGithubEventWorkflowRun
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
settings = Settings()
logging.info(f"Using config: {settings.json()}")
g = Github(settings.input_token.get_secret_value())
repo = g.get_repo(settings.github_repository)
try:
event = PartialGithubEvent.parse_file(settings.github_event_path)
except ValidationError as e:
logging.error(f"Error parsing event file: {e.errors()}")
sys.exit(0)
use_pr: Optional[PullRequest] = None
for pr in repo.get_pulls():
if pr.head.sha == event.workflow_run.head_commit.id:
use_pr = pr
break
if not use_pr:
logging.error(
f"No PR found for hash: {event.workflow_run.head_commit.id}"
)
sys.exit(0)
github_headers = {
"Authorization": f"token {settings.input_token.get_secret_value()}"
}
url = f"{github_api}/repos/{settings.github_repository}/issues/{use_pr.number}/comments"
logging.info(f"Using comments URL: {url}")
response = httpx.post(
url,
headers=github_headers,
json={
"body": f"📝 Docs preview for commit {use_pr.head.sha} at: {settings.input_deploy_url}"
},
)
if not (200 <= response.status_code <= 300):
logging.error(f"Error posting comment: {response.text}")
sys.exit(1)
logging.info("Finished")

7
.github/actions/people/Dockerfile vendored Normal file
View File

@@ -0,0 +1,7 @@
FROM python:3.7
RUN pip install httpx PyGithub "pydantic==1.5.1" "pyyaml>=5.3.1,<6.0.0"
COPY ./app /app
CMD ["python", "/app/main.py"]

13
.github/actions/people/action.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: "Generate FastAPI People"
description: "Generate the data for the FastAPI People page"
author: "Sebastián Ramírez <tiangolo@gmail.com>"
inputs:
token:
description: 'User token, to read the GitHub API. Can be passed in using {{ secrets.ACTION_TOKEN }}'
required: true
standard_token:
description: 'Default GitHub Action token, used for the PR. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
required: true
runs:
using: 'docker'
image: 'Dockerfile'

529
.github/actions/people/app/main.py vendored Normal file
View File

@@ -0,0 +1,529 @@
import logging
import subprocess
import sys
from collections import Counter, defaultdict
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Container, DefaultDict, Dict, List, Optional, Set
import httpx
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr
github_graphql_url = "https://api.github.com/graphql"
issues_query = """
query Q($after: String) {
repository(name: "fastapi", owner: "tiangolo") {
issues(first: 100, after: $after) {
edges {
cursor
node {
number
author {
login
avatarUrl
url
}
title
createdAt
state
comments(first: 100) {
nodes {
createdAt
author {
login
avatarUrl
url
}
}
}
}
}
}
}
}
"""
prs_query = """
query Q($after: String) {
repository(name: "fastapi", owner: "tiangolo") {
pullRequests(first: 100, after: $after) {
edges {
cursor
node {
number
labels(first: 100) {
nodes {
name
}
}
author {
login
avatarUrl
url
}
title
createdAt
state
comments(first: 100) {
nodes {
createdAt
author {
login
avatarUrl
url
}
}
}
reviews(first:100) {
nodes {
author {
login
avatarUrl
url
}
state
}
}
}
}
}
}
}
"""
sponsors_query = """
query Q($after: String) {
user(login: "tiangolo") {
sponsorshipsAsMaintainer(first: 100, after: $after) {
edges {
cursor
node {
sponsorEntity {
... on Organization {
login
avatarUrl
url
}
... on User {
login
avatarUrl
url
}
}
tier {
name
monthlyPriceInDollars
}
}
}
}
}
}
"""
class Author(BaseModel):
login: str
avatarUrl: str
url: str
class CommentsNode(BaseModel):
createdAt: datetime
author: Optional[Author] = None
class Comments(BaseModel):
nodes: List[CommentsNode]
class IssuesNode(BaseModel):
number: int
author: Optional[Author] = None
title: str
createdAt: datetime
state: str
comments: Comments
class IssuesEdge(BaseModel):
cursor: str
node: IssuesNode
class Issues(BaseModel):
edges: List[IssuesEdge]
class IssuesRepository(BaseModel):
issues: Issues
class IssuesResponseData(BaseModel):
repository: IssuesRepository
class IssuesResponse(BaseModel):
data: IssuesResponseData
class LabelNode(BaseModel):
name: str
class Labels(BaseModel):
nodes: List[LabelNode]
class ReviewNode(BaseModel):
author: Optional[Author] = None
state: str
class Reviews(BaseModel):
nodes: List[ReviewNode]
class PullRequestNode(BaseModel):
number: int
labels: Labels
author: Optional[Author] = None
title: str
createdAt: datetime
state: str
comments: Comments
reviews: Reviews
class PullRequestEdge(BaseModel):
cursor: str
node: PullRequestNode
class PullRequests(BaseModel):
edges: List[PullRequestEdge]
class PRsRepository(BaseModel):
pullRequests: PullRequests
class PRsResponseData(BaseModel):
repository: PRsRepository
class PRsResponse(BaseModel):
data: PRsResponseData
class SponsorEntity(BaseModel):
login: str
avatarUrl: str
url: str
class Tier(BaseModel):
name: str
monthlyPriceInDollars: float
class SponsorshipAsMaintainerNode(BaseModel):
sponsorEntity: SponsorEntity
tier: Tier
class SponsorshipAsMaintainerEdge(BaseModel):
cursor: str
node: SponsorshipAsMaintainerNode
class SponsorshipAsMaintainer(BaseModel):
edges: List[SponsorshipAsMaintainerEdge]
class SponsorsUser(BaseModel):
sponsorshipsAsMaintainer: SponsorshipAsMaintainer
class SponsorsResponseData(BaseModel):
user: SponsorsUser
class SponsorsResponse(BaseModel):
data: SponsorsResponseData
class Settings(BaseSettings):
input_token: SecretStr
input_standard_token: SecretStr
github_repository: str
def get_graphql_response(
*, settings: Settings, query: str, after: Optional[str] = None
):
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
variables = {"after": after}
response = httpx.post(
github_graphql_url,
headers=headers,
json={"query": query, "variables": variables, "operationName": "Q"},
)
if not response.status_code == 200:
logging.error(f"Response was not 200, after: {after}")
logging.error(response.text)
raise RuntimeError(response.text)
data = response.json()
return data
def get_graphql_issue_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=issues_query, after=after)
graphql_response = IssuesResponse.parse_obj(data)
return graphql_response.data.repository.issues.edges
def get_graphql_pr_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=prs_query, after=after)
graphql_response = PRsResponse.parse_obj(data)
return graphql_response.data.repository.pullRequests.edges
def get_graphql_sponsor_edges(*, settings: Settings, after: Optional[str] = None):
data = get_graphql_response(settings=settings, query=sponsors_query, after=after)
graphql_response = SponsorsResponse.parse_obj(data)
return graphql_response.data.user.sponsorshipsAsMaintainer.edges
def get_experts(settings: Settings):
issue_nodes: List[IssuesNode] = []
issue_edges = get_graphql_issue_edges(settings=settings)
while issue_edges:
for edge in issue_edges:
issue_nodes.append(edge.node)
last_edge = issue_edges[-1]
issue_edges = get_graphql_issue_edges(settings=settings, after=last_edge.cursor)
commentors = Counter()
last_month_commentors = Counter()
authors: Dict[str, Author] = {}
now = datetime.now(tz=timezone.utc)
one_month_ago = now - timedelta(days=30)
for issue in issue_nodes:
issue_author_name = None
if issue.author:
authors[issue.author.login] = issue.author
issue_author_name = issue.author.login
issue_commentors = set()
for comment in issue.comments.nodes:
if comment.author:
authors[comment.author.login] = comment.author
if comment.author.login == issue_author_name:
continue
issue_commentors.add(comment.author.login)
for author_name in issue_commentors:
commentors[author_name] += 1
if issue.createdAt > one_month_ago:
last_month_commentors[author_name] += 1
return commentors, last_month_commentors, authors
def get_contributors(settings: Settings):
pr_nodes: List[PullRequestNode] = []
pr_edges = get_graphql_pr_edges(settings=settings)
while pr_edges:
for edge in pr_edges:
pr_nodes.append(edge.node)
last_edge = pr_edges[-1]
pr_edges = get_graphql_pr_edges(settings=settings, after=last_edge.cursor)
contributors = Counter()
commentors = Counter()
reviewers = Counter()
authors: Dict[str, Author] = {}
for pr in pr_nodes:
author_name = None
if pr.author:
authors[pr.author.login] = pr.author
author_name = pr.author.login
pr_commentors: Set[str] = set()
pr_reviewers: Set[str] = set()
for comment in pr.comments.nodes:
if comment.author:
authors[comment.author.login] = comment.author
if comment.author.login == author_name:
continue
pr_commentors.add(comment.author.login)
for author_name in pr_commentors:
commentors[author_name] += 1
for review in pr.reviews.nodes:
if review.author:
authors[review.author.login] = review.author
pr_reviewers.add(review.author.login)
for reviewer in pr_reviewers:
reviewers[reviewer] += 1
if pr.state == "MERGED" and pr.author:
contributors[pr.author.login] += 1
return contributors, commentors, reviewers, authors
def get_individual_sponsors(settings: Settings):
nodes: List[SponsorshipAsMaintainerNode] = []
edges = get_graphql_sponsor_edges(settings=settings)
while edges:
for edge in edges:
nodes.append(edge.node)
last_edge = edges[-1]
edges = get_graphql_sponsor_edges(settings=settings, after=last_edge.cursor)
tiers: DefaultDict[float, Dict[str, SponsorEntity]] = defaultdict(dict)
for node in nodes:
tiers[node.tier.monthlyPriceInDollars][
node.sponsorEntity.login
] = node.sponsorEntity
return tiers
def get_top_users(
*,
counter: Counter,
min_count: int,
authors: Dict[str, Author],
skip_users: Container[str],
):
users = []
for commentor, count in counter.most_common(50):
if commentor in skip_users:
continue
if count >= min_count:
author = authors[commentor]
users.append(
{
"login": commentor,
"count": count,
"avatarUrl": author.avatarUrl,
"url": author.url,
}
)
return users
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
settings = Settings()
logging.info(f"Using config: {settings.json()}")
g = Github(settings.input_standard_token.get_secret_value())
repo = g.get_repo(settings.github_repository)
issue_commentors, issue_last_month_commentors, issue_authors = get_experts(
settings=settings
)
contributors, pr_commentors, reviewers, pr_authors = get_contributors(
settings=settings
)
authors = {**issue_authors, **pr_authors}
maintainers_logins = {"tiangolo"}
bot_names = {"codecov", "github-actions"}
maintainers = []
for login in maintainers_logins:
user = authors[login]
maintainers.append(
{
"login": login,
"answers": issue_commentors[login],
"prs": contributors[login],
"avatarUrl": user.avatarUrl,
"url": user.url,
}
)
min_count_expert = 10
min_count_last_month = 3
min_count_contributor = 4
min_count_reviewer = 4
skip_users = maintainers_logins | bot_names
experts = get_top_users(
counter=issue_commentors,
min_count=min_count_expert,
authors=authors,
skip_users=skip_users,
)
last_month_active = get_top_users(
counter=issue_last_month_commentors,
min_count=min_count_last_month,
authors=authors,
skip_users=skip_users,
)
top_contributors = get_top_users(
counter=contributors,
min_count=min_count_contributor,
authors=authors,
skip_users=skip_users,
)
top_reviewers = get_top_users(
counter=reviewers,
min_count=min_count_reviewer,
authors=authors,
skip_users=skip_users,
)
tiers = get_individual_sponsors(settings=settings)
sponsors_50 = []
for login, sponsor in tiers[50].items():
sponsors_50.append(
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
)
keys = list(tiers.keys())
keys.sort(reverse=True)
sponsors = []
for key in keys:
if key >= 50:
continue
for login, sponsor in tiers[key].items():
sponsors.append(
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
)
people = {
"maintainers": maintainers,
"experts": experts,
"last_month_active": last_month_active,
"top_contributors": top_contributors,
"top_reviewers": top_reviewers,
"sponsors_50": sponsors_50,
"sponsors": sponsors,
}
people_path = Path("./docs/en/data/people.yml")
people_old_content = people_path.read_text(encoding="utf-8")
new_content = yaml.dump(people, sort_keys=False, width=200, allow_unicode=True)
if people_old_content == new_content:
logging.info("The FastAPI People data hasn't changed, finishing.")
sys.exit(0)
people_path.write_text(new_content, encoding="utf-8")
logging.info("Setting up GitHub Actions git user")
subprocess.run(["git", "config", "user.name", "github-actions"], check=True)
subprocess.run(
["git", "config", "user.email", "github-actions@github.com"], check=True
)
branch_name = "fastapi-people"
logging.info(f"Creating a new branch {branch_name}")
subprocess.run(["git", "checkout", "-b", branch_name], check=True)
logging.info("Adding updated file")
subprocess.run(["git", "add", str(people_path)], check=True)
logging.info("Committing updated file")
message = "👥 Update FastAPI People"
result = subprocess.run(["git", "commit", "-m", message], check=True)
logging.info("Pushing branch")
subprocess.run(["git", "push", "origin", branch_name], check=True)
logging.info("Creating PR")
pr = repo.create_pull(title=message, body=message, base="master", head=branch_name)
logging.info(f"Created PR: {pr.number}")
logging.info("Finished")

View File

@@ -0,0 +1,7 @@
FROM python:3.7
RUN pip install httpx PyGithub "pydantic==1.5.1"
COPY ./app /app
CMD ["python", "/app/main.py"]

View File

@@ -0,0 +1,10 @@
name: "Watch docs previews in PRs"
description: "Check PRs and trigger new docs deploys"
author: "Sebastián Ramírez <tiangolo@gmail.com>"
inputs:
token:
description: 'Token for the repo. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
required: true
runs:
using: 'docker'
image: 'Dockerfile'

View File

@@ -0,0 +1,101 @@
import logging
from datetime import datetime
from pathlib import Path
from typing import List, Optional
import httpx
from github import Github
from github.NamedUser import NamedUser
from pydantic import BaseModel, BaseSettings, SecretStr
github_api = "https://api.github.com"
netlify_api = "https://api.netlify.com"
class Settings(BaseSettings):
input_token: SecretStr
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
class Artifact(BaseModel):
id: int
node_id: str
name: str
size_in_bytes: int
url: str
archive_download_url: str
expired: bool
created_at: datetime
updated_at: datetime
class ArtifactResponse(BaseModel):
total_count: int
artifacts: List[Artifact]
def get_message(commit: str) -> str:
return f"Docs preview for commit {commit} at"
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
settings = Settings()
logging.info(f"Using config: {settings.json()}")
g = Github(settings.input_token.get_secret_value())
repo = g.get_repo(settings.github_repository)
owner: NamedUser = repo.owner
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
prs = list(repo.get_pulls(state="open"))
response = httpx.get(
f"{github_api}/repos/{settings.github_repository}/actions/artifacts",
headers=headers,
)
data = response.json()
artifacts_response = ArtifactResponse.parse_obj(data)
for pr in prs:
logging.info("-----")
logging.info(f"Processing PR #{pr.number}: {pr.title}")
pr_comments = list(pr.get_issue_comments())
pr_commits = list(pr.get_commits())
last_commit = pr_commits[0]
for pr_commit in pr_commits:
if pr_commit.commit.author.date > last_commit.commit.author.date:
last_commit = pr_commit
commit = last_commit.commit.sha
logging.info(f"Last commit: {commit}")
message = get_message(commit)
notified = False
for pr_comment in pr_comments:
if message in pr_comment.body:
notified = True
logging.info(f"Docs preview was notified: {notified}")
if not notified:
artifact_name = f"docs-zip-{commit}"
use_artifact: Optional[Artifact] = None
for artifact in artifacts_response.artifacts:
if artifact.name == artifact_name:
use_artifact = artifact
break
if not use_artifact:
logging.info("Artifact not available")
else:
logging.info(f"Existing artifact: {use_artifact.name}")
response = httpx.post(
"https://api.github.com/repos/tiangolo/fastapi/actions/workflows/preview-docs.yml/dispatches",
headers=headers,
json={
"ref": "master",
"inputs": {
"pr": f"{pr.number}",
"name": artifact_name,
"commit": commit,
},
},
)
logging.info(
f"Trigger sent, response status: {response.status_code} - content: {response.content}"
)
logging.info("Finished")

50
.github/workflows/build-docs.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Build Docs
on:
push:
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-18.04
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m pip install flit
- name: Install docs extras
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m flit install --deps production --extras doc
- name: Install Material for MkDocs Insiders
if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true'
run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
- name: Build Docs
run: python3.7 ./scripts/docs.py build-all
- name: Zip docs
run: bash ./scripts/zip-docs.sh
- uses: actions/upload-artifact@v2
with:
name: docs-zip
path: ./docs.zip
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1.5
with:
publish-dir: './site'
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

30
.github/workflows/issue-manager.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Issue Manager
on:
schedule:
- cron: "0 0 * * *"
issue_comment:
types:
- created
issues:
types:
- labeled
pull_request_target:
types:
- labeled
workflow_dispatch:
jobs:
issue-manager:
runs-on: ubuntu-latest
steps:
- uses: tiangolo/issue-manager@0.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
config: >
{
"answered": {
"delay": 864000,
"message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
}
}

13
.github/workflows/label-approved.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: Label Approved
on:
schedule:
- cron: "0 12 * * *"
jobs:
label-approved:
runs-on: ubuntu-latest
steps:
- uses: docker://tiangolo/label-approved:0.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}

25
.github/workflows/latest-changes.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Latest Changes
on:
pull_request_target:
branches:
- master
types:
- closed
workflow_dispatch:
inputs:
number:
description: PR number
required: true
jobs:
latest-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://tiangolo/latest-changes:0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
latest_changes_file: docs/en/docs/release-notes.md
latest_changes_header: '## Latest Changes\n\n'
debug_logs: true

29
.github/workflows/people.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: FastAPI People
on:
schedule:
- cron: "0 14 1 * *"
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
fastapi-people:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
limit-access-to-actor: true
token: ${{ secrets.ACTIONS_TOKEN }}
standard_token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/people
with:
token: ${{ secrets.ACTIONS_TOKEN }}
standard_token: ${{ secrets.GITHUB_TOKEN }}

41
.github/workflows/preview-docs.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Preview Docs
on:
workflow_run:
workflows:
- Build Docs
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Artifact Docs
uses: dawidd6/action-download-artifact@v2.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-docs.yml
run_id: ${{ github.event.workflow_run.id }}
name: docs-zip
- name: Unzip docs
run: |
rm -rf ./site
unzip docs.zip
rm -f docs.zip
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v1.1.5
with:
publish-dir: './site'
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Comment Deploy
uses: ./.github/actions/comment-docs-preview-in-pr
with:
token: ${{ secrets.GITHUB_TOKEN }}
deploy_url: "${{ steps.netlify.outputs.deploy-url }}"

46
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Publish
on:
release:
types:
- created
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.6"
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Publish
env:
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: bash scripts/publish.sh
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
# - name: Notify
# env:
# GITTER_TOKEN: ${{ secrets.GITTER_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TAG: ${{ github.event.release.name }}
# run: bash scripts/notify.sh

36
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Test
on:
push:
pull_request:
types: [opened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Test
run: bash scripts/test.sh
- name: Upload coverage
uses: codecov/codecov-action@v1

13
.gitignore vendored
View File

@@ -10,3 +10,16 @@ site
.coverage
coverage.xml
.netlify
test.db
log.txt
Pipfile.lock
env3.*
env
docs_build
venv
docs.zip
archive.zip
# vim temporary files
*~
.*.sw?

View File

@@ -1,17 +0,0 @@
language: python
cache: pip
python:
- "3.6"
- "3.7-dev"
install:
- pip install flit
- flit install
script:
- bash scripts/test.sh
after_script:
- bash <(curl -s https://codecov.io/bash)

1
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1 @@
Please read the [Development - Contributing](https://fastapi.tiangolo.com/contributing/) guidelines in the documentation site.

34
Pipfile
View File

@@ -1,34 +0,0 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
mypy = "*"
black = "*"
jupyter = "*"
better-exceptions = "*"
pytest = "*"
pytest-cov = "*"
isort = "*"
requests = "*"
flit = "*"
mkdocs = "*"
mkdocs-material = "*"
markdown-include = "*"
autoflake = "*"
email-validator = "*"
ujson = "*"
flake8 = "*"
python-multipart = "*"
sqlalchemy = "*"
[packages]
starlette = "==0.10.1"
pydantic = "==0.18.2"
[requires]
python_version = "3.6"
[pipenv]
allow_prereleases = true

743
Pipfile.lock generated
View File

@@ -1,743 +0,0 @@
{
"_meta": {
"hash": {
"sha256": "37b34bb892b6b4dc0f7c941434d0e08199aa7a7ca83efb6294b89ace44168bba"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"dataclasses": {
"hashes": [
"sha256:454a69d788c7fda44efd71e259be79577822f5e3f53f029a22d08004e951dc9f",
"sha256:6988bd2b895eef432d562370bb707d540f32f7360ab13da45340101bc2307d84"
],
"markers": "python_version < '3.7'",
"version": "==0.6"
},
"pydantic": {
"hashes": [
"sha256:9f023811b6cefd203c5fd8fd15a4152f04e79e531b8f676ab1244dfe06ce8024",
"sha256:edbb08b561feda505374c0f25e4b54466a0a0c702ed6b2efaabdc3890d1a82e7"
],
"index": "pypi",
"version": "==0.18.2"
},
"starlette": {
"hashes": [
"sha256:7cc05c33d00db3b2ddfd7516a737544ed0a34c9dd0ced94076f29b581ce4f532"
],
"index": "pypi",
"version": "==0.10.1"
}
},
"develop": {
"appdirs": {
"hashes": [
"sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92",
"sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e"
],
"version": "==1.4.3"
},
"atomicwrites": {
"hashes": [
"sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4",
"sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"
],
"version": "==1.3.0"
},
"attrs": {
"hashes": [
"sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69",
"sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"
],
"version": "==18.2.0"
},
"autoflake": {
"hashes": [
"sha256:c103e63466f11db3617167a2c68ff6a0cda35b940222920631c6eeec6b67e807"
],
"index": "pypi",
"version": "==1.2"
},
"backcall": {
"hashes": [
"sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4",
"sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2"
],
"version": "==0.1.0"
},
"better-exceptions": {
"hashes": [
"sha256:bf79c87659bc849989d726bf0e4a2100edefe7eded112d201f54fe08467fdf63",
"sha256:c196cad849de615abb9f6eb67ca1b83f33b938818f0e2fe8fa157b22aeb7b992"
],
"index": "pypi",
"version": "==0.2.2"
},
"black": {
"hashes": [
"sha256:817243426042db1d36617910df579a54f1afd659adb96fc5032fcf4b36209739",
"sha256:e030a9a28f542debc08acceb273f228ac422798e5215ba2a791a6ddeaaca22a5"
],
"index": "pypi",
"version": "==18.9b0"
},
"bleach": {
"hashes": [
"sha256:213336e49e102af26d9cde77dd2d0397afabc5a6bf2fed985dc35b5d1e285a16",
"sha256:3fdf7f77adcf649c9911387df51254b813185e32b2c6619f690b593a617e19fa"
],
"version": "==3.1.0"
},
"certifi": {
"hashes": [
"sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7",
"sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033"
],
"version": "==2018.11.29"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"click": {
"hashes": [
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
"sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
],
"version": "==7.0"
},
"coverage": {
"hashes": [
"sha256:029c69deaeeeae1b15bc6c59f0ffa28aa8473721c614a23f2c2976dec245cd12",
"sha256:02abbbebc6e9d5abe13cd28b5e963dedb6ffb51c146c916d17b18f141acd9947",
"sha256:1bbfe5b82a3921d285e999c6d256c1e16b31c554c29da62d326f86c173d30337",
"sha256:210c02f923df33a8d0e461c86fdcbbb17228ff4f6d92609fc06370a98d283c2d",
"sha256:2d0807ba935f540d20b49d5bf1c0237b90ce81e133402feda906e540003f2f7a",
"sha256:35d7a013874a7c927ce997350d314144ffc5465faf787bb4e46e6c4f381ef562",
"sha256:3636f9d0dcb01aed4180ef2e57a4e34bb4cac3ecd203c2a23db8526d86ab2fb4",
"sha256:42f4be770af2455a75e4640f033a82c62f3fb0d7a074123266e143269d7010ef",
"sha256:48440b25ba6cda72d4c638f3a9efa827b5b87b489c96ab5f4ff597d976413156",
"sha256:4dac8dfd1acf6a3ac657475dfdc66c621f291b1b7422a939cc33c13ac5356473",
"sha256:4e8474771c69c2991d5eab65764289a7dd450bbea050bc0ebb42b678d8222b42",
"sha256:551f10ddfeff56a1325e5a34eff304c5892aa981fd810babb98bfee77ee2fb17",
"sha256:5b104982f1809c1577912519eb249f17d9d7e66304ad026666cb60a5ef73309c",
"sha256:5c62aef73dfc87bfcca32cee149a1a7a602bc74bac72223236b0023543511c88",
"sha256:633151f8d1ad9467b9f7e90854a7f46ed8f2919e8bc7d98d737833e8938fc081",
"sha256:772207b9e2d5bf3f9d283b88915723e4e92d9a62c83f44ec92b9bd0cd685541b",
"sha256:7d5e02f647cd727afc2659ec14d4d1cc0508c47e6cfb07aea33d7aa9ca94d288",
"sha256:a9798a4111abb0f94584000ba2a2c74841f2cfe5f9254709756367aabbae0541",
"sha256:b38ea741ab9e35bfa7015c93c93bbd6a1623428f97a67083fc8ebd366238b91f",
"sha256:b6a5478c904236543c0347db8a05fac6fc0bd574c870e7970faa88e1d9890044",
"sha256:c6248bfc1de36a3844685a2e10ba17c18119ba6252547f921062a323fb31bff1",
"sha256:c705ab445936457359b1424ef25ccc0098b0491b26064677c39f1d14a539f056",
"sha256:d95a363d663ceee647291131dbd213af258df24f41350246842481ec3709bd33",
"sha256:e27265eb80cdc5dab55a40ef6f890e04ecc618649ad3da5265f128b141f93f78",
"sha256:ebc276c9cb5d917bd2ae959f84ffc279acafa9c9b50b0fa436ebb70bbe2166ea",
"sha256:f4d229866d030863d0fe3bf297d6d11e6133ca15bbb41ed2534a8b9a3d6bd061",
"sha256:f95675bd88b51474d4fe5165f3266f419ce754ffadfb97f10323931fa9ac95e5",
"sha256:f95bc54fb6d61b9f9ff09c4ae8ff6a3f5edc937cda3ca36fc937302a7c152bf1",
"sha256:fd0f6be53de40683584e5331c341e65a679dbe5ec489a0697cec7c2ef1a48cda"
],
"version": "==5.0a4"
},
"decorator": {
"hashes": [
"sha256:33cd704aea07b4c28b3eb2c97d288a06918275dac0ecebdaf1bc8a48d98adb9e",
"sha256:cabb249f4710888a2fc0e13e9a16c343d932033718ff62e1e9bc93a9d3a9122b"
],
"version": "==4.3.2"
},
"defusedxml": {
"hashes": [
"sha256:24d7f2f94f7f3cb6061acb215685e5125fbcdc40a857eff9de22518820b0a4f4",
"sha256:702a91ade2968a82beb0db1e0766a6a273f33d4616a6ce8cde475d8e09853b20"
],
"version": "==0.5.0"
},
"dnspython": {
"hashes": [
"sha256:36c5e8e38d4369a08b6780b7f27d790a292b2b08eea01607865bf0936c558e01",
"sha256:f69c21288a962f4da86e56c4905b49d11aba7938d3d740e80d9e366ee4f1632d"
],
"version": "==1.16.0"
},
"docutils": {
"hashes": [
"sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6",
"sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274",
"sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6"
],
"version": "==0.14"
},
"email-validator": {
"hashes": [
"sha256:ddc4b5b59fa699bb10127adcf7ad4de78fde4ec539a072b104b8bb16da666ae5"
],
"index": "pypi",
"version": "==1.0.3"
},
"entrypoints": {
"hashes": [
"sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19",
"sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"
],
"version": "==0.3"
},
"flake8": {
"hashes": [
"sha256:c3ba1e130c813191db95c431a18cb4d20a468e98af7a77e2181b68574481ad36",
"sha256:fd9ddf503110bf3d8b1d270e8c673aab29ccb3dd6abf29bae1f54e5116ab4a91"
],
"index": "pypi",
"version": "==3.7.5"
},
"flit": {
"hashes": [
"sha256:1d93f7a833ed8a6e120ddc40db5c4763bc39bccc75c05081ec8285ece718aefb",
"sha256:6f6f0fb83c51ffa3a150fa41b5ac118df9ea4a87c2c06dff4ebf9adbe7b52b36"
],
"index": "pypi",
"version": "==1.3"
},
"idna": {
"hashes": [
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
"sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"
],
"version": "==2.8"
},
"ipykernel": {
"hashes": [
"sha256:0aeb7ec277ac42cc2b59ae3d08b10909b2ec161dc6908096210527162b53675d",
"sha256:0fc0bf97920d454102168ec2008620066878848fcfca06c22b669696212e292f"
],
"version": "==5.1.0"
},
"ipython": {
"hashes": [
"sha256:6a9496209b76463f1dec126ab928919aaf1f55b38beb9219af3fe202f6bbdd12",
"sha256:f69932b1e806b38a7818d9a1e918e5821b685715040b48e59c657b3c7961b742"
],
"markers": "python_version >= '3.3'",
"version": "==7.2.0"
},
"ipython-genutils": {
"hashes": [
"sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8",
"sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"
],
"version": "==0.2.0"
},
"ipywidgets": {
"hashes": [
"sha256:0f2b5cde9f272cb49d52f3f0889fdd1a7ae1e74f37b48dac35a83152780d2b7b",
"sha256:a3e224f430163f767047ab9a042fc55adbcab0c24bbe6cf9f306c4f89fdf0ba3"
],
"version": "==7.4.2"
},
"isort": {
"hashes": [
"sha256:1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af",
"sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8",
"sha256:ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497"
],
"index": "pypi",
"version": "==4.3.4"
},
"jedi": {
"hashes": [
"sha256:571702b5bd167911fe9036e5039ba67f820d6502832285cde8c881ab2b2149fd",
"sha256:c8481b5e59d34a5c7c42e98f6625e633f6ef59353abea6437472c7ec2093f191"
],
"version": "==0.13.2"
},
"jinja2": {
"hashes": [
"sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
"sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
],
"version": "==2.10"
},
"jsonschema": {
"hashes": [
"sha256:683fe7ed58763ea0be572de5aad47cd3cc1297640916f9a8ccd222b287da7d2f",
"sha256:b42d7a292addb57370e6260bcbadb77e00a899fe6ec998c453f45893c41c658b"
],
"version": "==3.0.0b3"
},
"jupyter": {
"hashes": [
"sha256:3e1f86076bbb7c8c207829390305a2b1fe836d471ed54be66a3b8c41e7f46cc7",
"sha256:5b290f93b98ffbc21c0c7e749f054b3267782166d72fa5e3ed1ed4eaf34a2b78",
"sha256:d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f"
],
"index": "pypi",
"version": "==1.0.0"
},
"jupyter-client": {
"hashes": [
"sha256:b5f9cb06105c1d2d30719db5ffb3ea67da60919fb68deaefa583deccd8813551",
"sha256:c44411eb1463ed77548bc2d5ec0d744c9b81c4a542d9637c7a52824e2121b987"
],
"version": "==5.2.4"
},
"jupyter-console": {
"hashes": [
"sha256:308ce876354924fb6c540b41d5d6d08acfc946984bf0c97777c1ddcb42e0b2f5",
"sha256:cc80a97a5c389cbd30252ffb5ce7cefd4b66bde98219edd16bf5cb6f84bb3568"
],
"version": "==6.0.0"
},
"jupyter-core": {
"hashes": [
"sha256:927d713ffa616ea11972534411544589976b2493fc7e09ad946e010aa7eb9970",
"sha256:ba70754aa680300306c699790128f6fbd8c306ee5927976cbe48adacf240c0b7"
],
"version": "==4.4.0"
},
"livereload": {
"hashes": [
"sha256:29cadfabcedd12eed792e0131991235b9d4764d4474bed75cf525f57109ec0a2",
"sha256:e632a6cd1d349155c1d7f13a65be873b38f43ef02961804a1bba8d817fa649a7"
],
"version": "==2.6.0"
},
"markdown": {
"hashes": [
"sha256:c00429bd503a47ec88d5e30a751e147dcb4c6889663cd3e2ba0afe858e009baa",
"sha256:d02e0f9b04c500cde6637c11ad7c72671f359b87b9fe924b2383649d8841db7c"
],
"version": "==3.0.1"
},
"markdown-include": {
"hashes": [
"sha256:72a45461b589489a088753893bc95c5fa5909936186485f4ed55caa57d10250f"
],
"index": "pypi",
"version": "==0.5.1"
},
"markupsafe": {
"hashes": [
"sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432",
"sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b",
"sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9",
"sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af",
"sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834",
"sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd",
"sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d",
"sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7",
"sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b",
"sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3",
"sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c",
"sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2",
"sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7",
"sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36",
"sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1",
"sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e",
"sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1",
"sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c",
"sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856",
"sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550",
"sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492",
"sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672",
"sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401",
"sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6",
"sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6",
"sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c",
"sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd",
"sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1"
],
"version": "==1.1.0"
},
"mccabe": {
"hashes": [
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
],
"version": "==0.6.1"
},
"mistune": {
"hashes": [
"sha256:59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e",
"sha256:88a1051873018da288eee8538d476dffe1262495144b33ecb586c4ab266bb8d4"
],
"version": "==0.8.4"
},
"mkdocs": {
"hashes": [
"sha256:17d34329aad75d5de604b9ed4e31df3a4d235afefdc46ce7b1964fddb2e1e939",
"sha256:8cc8b38325456b9e942c981a209eaeb1e9f3f77b493ad755bfef889b9c8d356a"
],
"index": "pypi",
"version": "==1.0.4"
},
"mkdocs-material": {
"hashes": [
"sha256:4b4af83c704d2bab41be3a5228e800a5e1157003368fbf548d95073ce19e0f61",
"sha256:86c0042c803586985bf79c99962ebd4644c3f0ff095d5df541f09fa48f5b62cc"
],
"index": "pypi",
"version": "==3.3.0"
},
"more-itertools": {
"hashes": [
"sha256:0125e8f60e9e031347105eb1682cef932f5e97d7b9a1a28d9bf00c22a5daef40",
"sha256:590044e3942351a1bdb1de960b739ff4ce277960f2425ad4509446dbace8d9d1"
],
"version": "==6.0.0"
},
"mypy": {
"hashes": [
"sha256:308c274eb8482fbf16006f549137ddc0d69e5a589465e37b99c4564414363ca7",
"sha256:e80fd6af34614a0e898a57f14296d0dacb584648f0339c2e000ddbf0f4cc2f8d"
],
"index": "pypi",
"version": "==0.670"
},
"mypy-extensions": {
"hashes": [
"sha256:37e0e956f41369209a3d5f34580150bcacfabaa57b33a15c0b25f4b5725e0812",
"sha256:b16cabe759f55e3409a7d231ebd2841378fb0c27a5d1994719e340e4f429ac3e"
],
"version": "==0.4.1"
},
"nbconvert": {
"hashes": [
"sha256:302554a2e219bc0fc84f3edd3e79953f3767b46ab67626fdec16e38ba3f7efe4",
"sha256:5de8fb2284422272a1d45abc77c07b888127550a6d602ce619592a2b08a474ff"
],
"version": "==5.4.1"
},
"nbformat": {
"hashes": [
"sha256:b9a0dbdbd45bb034f4f8893cafd6f652ea08c8c1674ba83f2dc55d3955743b0b",
"sha256:f7494ef0df60766b7cabe0a3651556345a963b74dbc16bc7c18479041170d402"
],
"version": "==4.4.0"
},
"notebook": {
"hashes": [
"sha256:3ab2db8bc10e6edbd264c3c4b800bee276c99818386ee0c146d98d7e6bcf0a67",
"sha256:d908673a4010787625c8952e91a22adf737db031f2aa0793ad92f6558918a74a"
],
"version": "==5.7.4"
},
"pandocfilters": {
"hashes": [
"sha256:b3dd70e169bb5449e6bc6ff96aea89c5eea8c5f6ab5e207fc2f521a2cf4a0da9"
],
"version": "==1.4.2"
},
"parso": {
"hashes": [
"sha256:6ecf7244be8e7283ec9009c72d074830e7e0e611c974f813d76db0390a4e0dd6",
"sha256:8162be7570ffb34ec0b8d215d7f3b6c5fab24f51eb3886d6dee362de96b6db94"
],
"version": "==0.3.3"
},
"pexpect": {
"hashes": [
"sha256:2a8e88259839571d1251d278476f3eec5db26deb73a70be5ed5dc5435e418aba",
"sha256:3fbd41d4caf27fa4a377bfd16fef87271099463e6fa73e92a52f92dfee5d425b"
],
"markers": "sys_platform != 'win32'",
"version": "==4.6.0"
},
"pickleshare": {
"hashes": [
"sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca",
"sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"
],
"version": "==0.7.5"
},
"pluggy": {
"hashes": [
"sha256:8ddc32f03971bfdf900a81961a48ccf2fb677cf7715108f85295c67405798616",
"sha256:980710797ff6a041e9a73a5787804f848996ecaa6f8a1b1e08224a5894f2074a"
],
"version": "==0.8.1"
},
"prometheus-client": {
"hashes": [
"sha256:e8c11ff5ca53de6c3d91e1510500611cafd1d247a937ec6c588a0a7cc3bef93c"
],
"version": "==0.5.0"
},
"prompt-toolkit": {
"hashes": [
"sha256:88002cc618cacfda8760c4539e76c3b3f148ecdb7035a3d422c7ecdc90c2a3ba",
"sha256:c6655a12e9b08edb8cf5aeab4815fd1e1bdea4ad73d3bbf269cf2e0c4eb75d5e",
"sha256:df5835fb8f417aa55e5cafadbaeb0cf630a1e824aad16989f9f0493e679ec010"
],
"version": "==2.0.8"
},
"ptyprocess": {
"hashes": [
"sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0",
"sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f"
],
"markers": "os_name != 'nt'",
"version": "==0.6.0"
},
"py": {
"hashes": [
"sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694",
"sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6"
],
"version": "==1.7.0"
},
"pycodestyle": {
"hashes": [
"sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56",
"sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c"
],
"version": "==2.5.0"
},
"pyflakes": {
"hashes": [
"sha256:5e8c00e30c464c99e0b501dc160b13a14af7f27d4dffb529c556e30a159e231d",
"sha256:f277f9ca3e55de669fba45b7393a1449009cff5a37d1af10ebb76c52765269cd"
],
"version": "==2.1.0"
},
"pygments": {
"hashes": [
"sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a",
"sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d"
],
"version": "==2.3.1"
},
"pymdown-extensions": {
"hashes": [
"sha256:25b0a7967fa697b5035e23340a48594e3e93acb10b06d74574218ace3347d1df",
"sha256:6cf0cf36b5a03b291ace22dc2f320f4789ce56fbdb6635a3be5fadbf5d7694dd"
],
"version": "==6.0"
},
"pyrsistent": {
"hashes": [
"sha256:07f7ae71291af8b0dbad8c2ab630d8223e4a8c4e10fc37badda158c02e753acf"
],
"version": "==0.14.10"
},
"pytest": {
"hashes": [
"sha256:65aeaa77ae87c7fc95de56285282546cfa9c886dc8e5dc78313db1c25e21bc07",
"sha256:6ac6d467d9f053e95aaacd79f831dbecfe730f419c6c7022cb316b365cd9199d"
],
"index": "pypi",
"version": "==4.2.0"
},
"pytest-cov": {
"hashes": [
"sha256:0ab664b25c6aa9716cbf203b17ddb301932383046082c081b9848a0edf5add33",
"sha256:230ef817450ab0699c6cc3c9c8f7a829c34674456f2ed8df1fe1d39780f7c87f"
],
"index": "pypi",
"version": "==2.6.1"
},
"python-dateutil": {
"hashes": [
"sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb",
"sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e"
],
"version": "==2.8.0"
},
"python-multipart": {
"hashes": [
"sha256:f7bb5f611fc600d15fa47b3974c8aa16e93724513b49b5f95c81e6624c83fa43"
],
"index": "pypi",
"version": "==0.0.5"
},
"pytoml": {
"hashes": [
"sha256:ca2d0cb127c938b8b76a9a0d0f855cf930c1d50cc3a0af6d3595b566519a1013"
],
"version": "==0.1.20"
},
"pyyaml": {
"hashes": [
"sha256:254bf6fda2b7c651837acb2c718e213df29d531eebf00edb54743d10bcb694eb",
"sha256:3108529b78577327d15eec243f0ff348a0640b0c3478d67ad7f5648f93bac3e2",
"sha256:3c17fb92c8ba2f525e4b5f7941d850e7a48c3a59b32d331e2502a3cdc6648e76",
"sha256:8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b",
"sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b"
],
"version": "==4.2b4"
},
"pyzmq": {
"hashes": [
"sha256:25a0715c8f69cf72f67cfe5a68a3f3ed391c67c063d2257bec0fe7fc2c7f08f8",
"sha256:2bab63759632c6b9e0d5bf19cc63c3b01df267d660e0abcf230cf0afaa966349",
"sha256:30ab49d99b24bf0908ebe1cdfa421720bfab6f93174e4883075b7ff38cc555ba",
"sha256:32c7ca9fc547a91e3c26fc6080b6982e46e79819e706eb414dd78f635a65d946",
"sha256:41219ae72b3cc86d97557fe5b1ef5d1adc1057292ec597b50050874a970a39cf",
"sha256:4b8c48a9a13cea8f1f16622f9bd46127108af14cd26150461e3eab71e0de3e46",
"sha256:55724997b4a929c0d01b43c95051318e26ddbae23565018e138ae2dc60187e59",
"sha256:65f0a4afae59d4fc0aad54a917ab599162613a761b760ba167d66cc646ac3786",
"sha256:6f88591a8b246f5c285ee6ce5c1bf4f6bd8464b7f090b1333a446b6240a68d40",
"sha256:75022a4c60dcd8765bb9ca32f6de75a0ec83b0d96e0309dc479f4c7b21f26cb7",
"sha256:76ea493bfab18dcb090d825f3662b5612e2def73dffc196d51a5194b0294a81d",
"sha256:7b60c045b80709e4e3c085bab9b691e71761b44c2b42dbb047b8b498e7bc16b3",
"sha256:8e6af2f736734aef8ed6f278f9f552ec7f37b1a6b98e59b887484a840757f67d",
"sha256:9ac2298e486524331e26390eac14e4627effd3f8e001d4266ed9d8f1d2d31cce",
"sha256:9ba650f493a9bc1f24feca1d90fce0e5dd41088a252ac9840131dfbdbf3815ca",
"sha256:a02a4a385e394e46012dc83d2e8fd6523f039bb52997c1c34a2e0dd49ed839c1",
"sha256:a3ceee84114d9f5711fa0f4db9c652af0e4636c89eabc9b7f03a3882569dd1ed",
"sha256:a72b82ac1910f2cf61a49139f4974f994984475f771b0faa730839607eeedddf",
"sha256:ab136ac51027e7c484c53138a0fab4a8a51e80d05162eb7b1585583bcfdbad27",
"sha256:c095b224300bcac61e6c445e27f9046981b1ac20d891b2f1714da89d34c637c8",
"sha256:c5cc52d16c06dc2521340d69adda78a8e1031705924e103c0eb8fc8af861d810",
"sha256:d612e9833a89e8177f8c1dc68d7b4ff98d3186cd331acd616b01bbdab67d3a7b",
"sha256:e828376a23c66c6fe90dcea24b4b72cd774f555a6ee94081670872918df87a19",
"sha256:e9767c7ab2eb552796440168d5c6e23a99ecaade08dda16266d43ad461730192",
"sha256:ebf8b800d42d217e4710d1582b0c8bff20cdcb4faad7c7213e52644034300924"
],
"version": "==17.1.2"
},
"qtconsole": {
"hashes": [
"sha256:1ac4a65e81a27b0838330a6d351c2f8435d4013d98a95373e8a41119b2968390",
"sha256:bc1ba15f50c29ed50f1268ad823bb6543be263c18dd093b80495e9df63b003ac"
],
"version": "==4.4.3"
},
"requests": {
"hashes": [
"sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e",
"sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"
],
"index": "pypi",
"version": "==2.21.0"
},
"send2trash": {
"hashes": [
"sha256:60001cc07d707fe247c94f74ca6ac0d3255aabcb930529690897ca2a39db28b2",
"sha256:f1691922577b6fa12821234aeb57599d887c4900b9ca537948d2dac34aea888b"
],
"version": "==1.5.0"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
],
"version": "==1.12.0"
},
"sqlalchemy": {
"hashes": [
"sha256:7dede29f121071da9873e7b8c98091874617858e790dc364ffaab4b09d81216c"
],
"index": "pypi",
"version": "==1.3.0b3"
},
"terminado": {
"hashes": [
"sha256:55abf9ade563b8f9be1f34e4233c7b7bde726059947a593322e8a553cc4c067a",
"sha256:65011551baff97f5414c67018e908110693143cfbaeb16831b743fe7cad8b927"
],
"version": "==0.8.1"
},
"testpath": {
"hashes": [
"sha256:46c89ebb683f473ffe2aab0ed9f12581d4d078308a3cb3765d79c6b2317b0109",
"sha256:b694b3d9288dbd81685c5d2e7140b81365d46c29f5db4bc659de5aa6b98780f8"
],
"version": "==0.4.2"
},
"toml": {
"hashes": [
"sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c",
"sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"
],
"version": "==0.10.0"
},
"tornado": {
"hashes": [
"sha256:d3b719a0cb7094e2b1ca94b31f4b601639fa7ad01a548a1a2ccdd6cbdfd56671"
],
"version": "==6.0b1"
},
"traitlets": {
"hashes": [
"sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835",
"sha256:c6cb5e6f57c5a9bdaa40fa71ce7b4af30298fbab9ece9815b5d995ab6217c7d9"
],
"version": "==4.3.2"
},
"typed-ast": {
"hashes": [
"sha256:035a54ede6ce1380599b2ce57844c6554666522e376bd111eb940fbc7c3dad23",
"sha256:037c35f2741ce3a9ac0d55abfcd119133cbd821fffa4461397718287092d9d15",
"sha256:049feae7e9f180b64efacbdc36b3af64a00393a47be22fa9cb6794e68d4e73d3",
"sha256:19228f7940beafc1ba21a6e8e070e0b0bfd1457902a3a81709762b8b9039b88d",
"sha256:2ea681e91e3550a30c2265d2916f40a5f5d89b59469a20f3bad7d07adee0f7a6",
"sha256:3a6b0a78af298d82323660df5497bcea0f0a4a25a0b003afd0ce5af049bd1f60",
"sha256:5385da8f3b801014504df0852bf83524599df890387a3c2b17b7caa3d78b1773",
"sha256:606d8afa07eef77280c2bf84335e24390055b478392e1975f96286d99d0cb424",
"sha256:69245b5b23bbf7fb242c9f8f08493e9ecd7711f063259aefffaeb90595d62287",
"sha256:6f6d839ab09830d59b7fa8fb6917023d8cb5498ee1f1dbd82d37db78eb76bc99",
"sha256:730888475f5ac0e37c1de4bd05eeb799fdb742697867f524dc8a4cd74bcecc23",
"sha256:9819b5162ffc121b9e334923c685b0d0826154e41dfe70b2ede2ce29034c71d8",
"sha256:9e60ef9426efab601dd9aa120e4ff560f4461cf8442e9c0a2b92548d52800699",
"sha256:af5fbdde0690c7da68e841d7fc2632345d570768ea7406a9434446d7b33b0ee1",
"sha256:b64efdbdf3bbb1377562c179f167f3bf301251411eb5ac77dec6b7d32bcda463",
"sha256:bac5f444c118aeb456fac1b0b5d14c6a71ea2a42069b09c176f75e9bd4c186f6",
"sha256:bda9068aafb73859491e13b99b682bd299c1b5fd50644d697533775828a28ee0",
"sha256:d659517ca116e6750101a1326107d3479028c5191f0ecee3c7203c50f5b915b0",
"sha256:eddd3fb1f3e0f82e5915a899285a39ee34ce18fd25d89582bc89fc9fb16cd2c6"
],
"version": "==1.3.1"
},
"ujson": {
"hashes": [
"sha256:f66073e5506e91d204ab0c614a148d5aa938bdbf104751be66f8ad7a222f5f86"
],
"index": "pypi",
"version": "==1.35"
},
"urllib3": {
"hashes": [
"sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
"sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
],
"version": "==1.24.1"
},
"wcwidth": {
"hashes": [
"sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e",
"sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c"
],
"version": "==0.1.7"
},
"webencodings": {
"hashes": [
"sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78",
"sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"
],
"version": "==0.5.1"
},
"widgetsnbextension": {
"hashes": [
"sha256:14b2c65f9940c9a7d3b70adbe713dbd38b5ec69724eebaba034d1036cf3d4740",
"sha256:fa618be8435447a017fd1bf2c7ae922d0428056cfc7449f7a8641edf76b48265"
],
"version": "==3.4.2"
}
}
}

186
README.md
View File

@@ -1,18 +1,18 @@
<p align="center">
<a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal-vector.svg" alt='FastAPI'></a>
<a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a>
</p>
<p align="center">
<em>FastAPI framework, high performance, easy to learn, fast to code, ready for production</em>
</p>
<p align="center">
<a href="https://travis-ci.org/tiangolo/fastapi" target="_blank">
<img src="https://travis-ci.org/tiangolo/fastapi.svg?branch=master" alt="Build Status">
<a href="https://github.com/tiangolo/fastapi/actions?query=workflow%3ATest" target="_blank">
<img src="https://github.com/tiangolo/fastapi/workflows/Test/badge.svg" alt="Test">
</a>
<a href="https://codecov.io/gh/tiangolo/fastapi" target="_blank">
<img src="https://codecov.io/gh/tiangolo/fastapi/branch/master/graph/badge.svg" alt="Coverage">
<img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
</a>
<a href="https://pypi.org/project/fastapi" target="_blank">
<img src="https://badge.fury.io/py/fastapi.svg" alt="Package version">
<img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
</p>
@@ -30,16 +30,77 @@ The key features are:
* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
* **Fast to code**: Increase the speed to develop features by about 200% to 300% *.
* **Less bugs**: Reduce about 40% of human (developer) induced errors. *
* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
* **Intuitive**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging.
* **Easy**: Designed to be easy to use and learn. Less time reading docs.
* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Less bugs.
* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
* **Robust**: Get production-ready code. With automatic interactive documentation.
* **Standards-based**: Based on (and fully compatible with) the open standards for APIs: <a href="https://github.com/OAI/OpenAPI-Specification" target="_blank">OpenAPI</a> (previously known as Swagger) and <a href="http://json-schema.org/" target="_blank">JSON Schema</a>.
* **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>.
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Sponsors
<!-- sponsors -->
<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>
<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>
<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>
<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>
<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>
<!-- /sponsors -->
<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
## Opinions
"_[...] 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._"
<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>
---
"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
<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>
---
"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
<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>
---
"_Im over the moon excited about **FastAPI**. Its so fun!_"
<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>
---
"_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._"
<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>
---
"_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 [...]_"
"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
<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>
---
## **Typer**, the FastAPI of CLIs
<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>
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>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
## Requirements
@@ -47,22 +108,33 @@ Python 3.6+
FastAPI stands on the shoulders of giants:
* <a href="https://www.starlette.io/" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" target="_blank">Pydantic</a> for the data parts.
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
## Installation
```bash
<div class="termy">
```console
$ pip install fastapi
---> 100%
```
You will also need an ASGI server, for production such as <a href="http://www.uvicorn.org" target="_blank">uvicorn</a>.
</div>
```bash
$ pip install uvicorn
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>.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
## Example
### Create it
@@ -70,6 +142,8 @@ $ pip install uvicorn
* Create a file `main.py` with:
```Python
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@@ -81,15 +155,18 @@ def read_root():
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
<details markdown="1">
<summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`:
```Python hl_lines="7 12"
```Python hl_lines="9 14"
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@@ -101,12 +178,12 @@ async def read_root():
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: str = None):
async def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
**Note**:
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>.
</details>
@@ -115,24 +192,34 @@ If you don't know, check the _"In a hurry?"_ section about <a href="https://fast
Run the server with:
```bash
uvicorn main:app --debug
<div class="termy">
```console
$ uvicorn main:app --reload
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [28720]
INFO: Started server process [28722]
INFO: Waiting for application startup.
INFO: Application startup complete.
```
</div>
<details markdown="1">
<summary>About the command <code>uvicorn main:app --debug</code>...</summary>
<summary>About the command <code>uvicorn main:app --reload</code>...</summary>
The command `uvicorn main:app` refers to:
* `main`: the file `main.py` (the Python "module").
* `app`: the object created inside of `main.py` with the line `app = FastAPI()`.
* `--debug`: make the server restart after code changes. Only do this for development.
* `--reload`: make the server restart after code changes. Only do this for development.
</details>
### Check it
Open your browser at <a href="http://127.0.0.1:8000/items/5?q=somequery" target="_blank">http://127.0.0.1:8000/items/5?q=somequery</a>.
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>.
You will see the JSON response as:
@@ -149,18 +236,17 @@ You already created an API that:
### Interactive API docs
Now go to <a href="http://127.0.0.1:8000/docs" target="_blank">http://127.0.0.1:8000/docs</a>.
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>.
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a>):
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>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
And now, go to <a href="http://127.0.0.1:8000/redoc" target="_blank">http://127.0.0.1:8000/redoc</a>.
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>.
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" target="_blank">ReDoc</a>):
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
@@ -170,8 +256,9 @@ Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optional
```Python hl_lines="2 7 8 9 10 24"
from fastapi import FastAPI
from pydantic import BaseModel
@@ -181,7 +268,7 @@ app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: bool = None
is_offer: Optional[bool] = None
@app.get("/")
@@ -190,20 +277,20 @@ def read_root():
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
@app.put("/items/{item_id}")
def create_item(item_id: int, item: Item):
def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
```
The server should reload automatically (because you added `--debug` to the `uvicorn` command above).
The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
### Interactive API docs upgrade
Now go to <a href="http://127.0.0.1:8000/docs" target="_blank">http://127.0.0.1:8000/docs</a>.
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>.
* The interactive API documentation will be automatically updated, including the new body:
@@ -217,16 +304,14 @@ Now go to <a href="http://127.0.0.1:8000/docs" target="_blank">http://127.0.0.1:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
### Alternative API docs upgrade
And now, go to <a href="http://127.0.0.1:8000/redoc" target="_blank">http://127.0.0.1:8000/redoc</a>.
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>.
* The alternative documentation will also reflect the new query parameter and body:
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Recap
In summary, you declare **once** the types of parameters, body, etc. as function parameters.
@@ -287,7 +372,7 @@ Coming back to the previous code example, **FastAPI** will:
* Without the `None` it would be required (as is the body in the case with `PUT`).
* For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
* Check that it has a required attribute `name` that should be a `str`.
* Check that is has a required attribute `price` that has to be a `float`.
* Check that it has a required attribute `price` that has to be a `float`.
* Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
* All this would also work for deeply nested JSON objects.
* Convert from and to JSON automatically.
@@ -296,7 +381,6 @@ Coming back to the previous code example, **FastAPI** will:
* Automatic client code generation systems, for many languages.
* Provide 2 interactive documentation web interfaces directly.
---
We just scratched the surface, but you already get the idea of how it all works.
@@ -323,8 +407,7 @@ Try changing the line with:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/intro/">Tutorial - User Guide</a>.
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
**Spoiler alert**: the tutorial - user guide includes:
@@ -341,12 +424,11 @@ For a more complete example including more features, see the <a href="https://fa
* **Cookie Sessions**
* ...and more.
## Performance
Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <a href="https://www.techempower.com/benchmarks/#section=test&runid=a979de55-980d-4721-a46f-77298b3f3923&hw=ph&test=fortune&l=zijzen-7" target="_blank">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
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). (*)
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" target="_blank">Benchmarks</a>.
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
## Optional Dependencies
@@ -355,23 +437,23 @@ Used by Pydantic:
* <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>.
* <a href="https://github.com/JoshData/python-email-validator" target="_blank"><code>email_validator</code></a> - for email validation.
Used by Starlette:
* <a href="http://docs.python-requests.org" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://github.com/Tinche/aiofiles" target="_blank"><code>aiofiles</code></a> - Required if you want to use `FileResponse` or `StaticFiles`.
* <a href="http://jinja.pocoo.org" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <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()`.
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
* <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for `SchemaGenerator` support.
* <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).
* <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - Required for `GraphQLApp` support.
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
Used by FastAPI / Starlette:
* <a href="http://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
You can install all of these with `pip3 install fastapi[all]`.
You can install all of these with `pip install fastapi[all]`.
## License

31
SECURITY.md Normal file
View File

@@ -0,0 +1,31 @@
# Security Policy
Security is very important for FastAPI and its community. 🔒
Learn more about it below. 👇
## Versions
The latest versions of FastAPI are supported.
You are encouraged to [write tests](https://fastapi.tiangolo.com/tutorial/testing/) for your application and update your FastAPI version frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**.
You can learn more about [FastAPI versions and how to pin and upgrade them](https://fastapi.tiangolo.com/deployment/versions/) for your project in the docs.
## Reporting a Vulnerability
If you think you found a vulnerability, and even if you are not sure about it, please report it right away by sending an email to: security@tiangolo.com. Please try to be as explicit as possible, describing all the steps and example code to reproduce the security issue.
I (the author, [@tiangolo](https://twitter.com/tiangolo)) will review it thoroughly and get back to you.
## Public Discussions
Please restrain from publicly discussing a potential security vulnerability. 🙊
It's better to discuss privately and try to find a solution first, to limit the potential impact as much as possible.
---
Thanks for your help!
The FastAPI community and I thank you for that. 🙇

View File

@@ -1,364 +0,0 @@
Details about the `async def` syntax for path operation functions and some background about asynchronous code, concurrency, and parallelism.
## In a hurry?
<abbr title="too long; didn't read"><strong>TL;DR:</strong></abbr>
If you are using third party libraries that tell you to call them with `await`, like:
```Python
results = await some_library()
```
Then, declare your path operation functions with `async def` like:
```Python hl_lines="2"
@app.get('/')
async def read_results():
results = await some_library()
return results
```
!!! note
You can only use `await` inside of functions created with `async def`.
---
If you are using a third party library that communicates with something (a database, an API, the file system, etc) and doesn't have support for using `await`, (this is currently the case for most database libraries), then declare your path operation functions as normally, with just `def`, like:
```Python hl_lines="2"
@app.get('/')
def results():
results = some_library()
return results
```
---
If your application (somehow) doesn't have to communicate with anything else and wait for it to respond, use `async def`.
---
If you just don't know, use normal `def`.
---
**Note**: you can mix `def` and `async def` in your path operation functions as much as you need and define each one using the best option for you. FastAPI will do the right thing with them.
Anyway, in any of the cases above, FastAPI will still work asynchronously and be extremely fast.
But by following the steps above, it will be able to do some performance optimizations.
## Technical Details
Modern versions of Python have support for **"asynchronous code"** using something called **"coroutines"**, with **`async` and `await`** syntax.
Let's see that phrase by parts in the sections below, below:
* **Asynchronous Code**
* **`async` and `await`**
* **Coroutines**
## Asynchronous Code
Asynchronous code just means that the language has a way to tell the computer / program that at some point in the code, he will have to wait for *something else* to finish somewhere else. Let's say that *something else* is called "slow-file".
So, during that time, the computer can go and do some other work, while "slow-file" finishes.
Then the computer / program will come back every time it has a chance because it's waiting again, or whenever he finished all the work he had at that point. And it will see if any of the tasks he was waiting for has already finished doing whatever it had to do.
And then it takes the first task to finish (let's say, our "slow-file") and continues whatever it had to do with it.
That "wait for something else" normally refers to <abbr title="Input and Output">I/O</abbr> operations that are relatively "slow" (compared to the speed of the processor and the RAM memory), like waiting for:
* the data from the client to be sent through the network
* the data sent by your program to be received by the client through the network
* the contents of a file in the disk to be read by the system and given to your program
* the contents your program gave to the system to be written to disk
* a remote API operation
* a database operation to finish
* a database query to return the results
* etc.
As the execution time is consumed mostly by waiting for <abbr title="Input and Output">I/O</abbr> operations, so they call them "I/O bound".
It's called "asynchronous" because the computer / program doesn't have to be "synchronized" with the slow task, waiting for the exact moment that the task finishes, while doing nothing, to be able to take the task result and continue the work.
Instead of that, by being an "asynchronous" system, once finished, the task can wait in line a little bit (some microseconds) for the computer / program to finish whatever it went to do, and then come back to take the results and continue working with them.
For "synchronous" (contrary to "asynchronous") they commonly also use the term "sequential", because the computer / program follows all the steps in sequence before switching to a different task, even if those steps involve waiting.
### Concurrency and Burgers
This idea of **asynchronous** code described above is also sometimes called **"concurrency"**. It is different from **"parallelism"**.
**Concurrency** and **parallelism** both relate to "different things happening more or less at the same time".
But the details between *concurrency* and *parallelism* are quite different.
To see the difference, imagine the following story about burgers:
### Concurrent Burgers
You go with your crush to get fast food, you stand in line while the cashier takes the orders from the people in front of you.
Then it's your turn, you place your order of 2 very fancy burgers for your crush and you.
You pay.
The cashier says something to the guy in the kitchen so he knows he has to prepare your burgers (even though he is currently preparing the ones for the previous clients).
The cashier gives you the number of your turn.
While you are waiting, you go with your crush and pick a table, you sit and talk with your crush for a long time (as your burgers are very fancy and take some time to prepare).
As you are seating on the table with your crush, while you wait for the burgers, you can spend that time admiring how awesome, cute and smart your crush is.
While waiting and talking to your crush, from time to time, you check the number displayed on the counter to see if it's your turn already.
Then at some point, it finally is your turn. You go to the counter, get your burgers and come back to the table.
You and your crush eat the burgers and have a nice time.
---
Imagine you are the computer / program in that story.
While you are at the line, you are just idle, waiting for your turn, not doing anything very "productive". But the line is fast because the cashier is only taking the orders, so that's fine.
Then, when it's your turn, you do actual "productive" work, you process the menu, decide what you want, get your crush's choice, pay, check that you give the correct bill or card, check that you are charged correctly, check that the order has the correct items, etc.
But then, even though you still don't have your burgers, your work with the cashier is "on pause", because you have to wait for your burgers to be ready.
But as you go away from the counter and seat on the table with a number for your turn, you can switch your attention to your crush, and "work" on that. Then you are again doing something very "productive", as is flirting with your crush.
Then the cashier says "I'm finished with doing the burgers" by putting your number on the counter display, but you don't jump like crazy immediately when the displayed number changes to your turn number. You know no one will steal your burgers because you have the number of your turn, and they have theirs.
So you wait for your crush to finish the story (finish the current work / task being processed), smile gently and say that you are going for the burgers.
Then you go to the counter, to the initial task that is now finished, pick the burgers, say thanks and take them to the table. That finishes that step / task of interaction with the counter. That in turn, creates a new task, of "eating burgers", but the previous one of "getting burgers" is finished.
### Parallel Burgers
You go with your crush to get parallel fast food.
You stand in line while several (let's say 8) cashiers take the orders from the people in front of you.
Everyone before you is waiting for their burgers to be ready before leaving the counter because each of the 8 cashiers goes himself and preparers the burger right away before getting the next order.
Then it's finally your turn, you place your order of 2 very fancy burgers for your crush and you.
You pay.
The cashier goes to the kitchen.
You wait, standing in front of the counter, so that no one else takes your burgers before you, as there are no numbers for turns.
As you and your crush are busy not letting anyone get in front of you and take your burgers whenever they arrive, you cannot pay attention to your crush.
This is "synchronous" work, you are "synchronized" with the cashier/cook. You have to wait and be there at the exact moment that the cashier/cook finishes the burgers and gives them to you, or otherwise, someone else might take them.
Then your cashier/cook finally comes back with your burgers, after a long time waiting there in front of the counter.
You take your burgers and go to the table with your crush.
You just eat them, and you are done.
There was not much talk or flirting as most of the time was spent waiting in front of the counter.
---
In this scenario of the parallel burgers, you are a computer / program with two processors (you and your crush), both waiting and dedicating their attention to be "waiting on the counter" for a long time.
The fast food store has 8 processors (cashiers/cooks). While the concurrent burgers store might have had only 2 (one cashier and one cook).
But still, the final experience is not the best.
---
This would be the parallel equivalent story for burgers.
For a more "real life" example of this, imagine a bank.
Up to recently, most of the banks had multiple cashiers and a big line.
All of the cashiers doing all the work with one client after the other.
And you have to wait in the line for a long time or you lose your turn.
You probably wouldn't want to take your crush with you to do errands at the bank.
### Burger Conclusion
In this scenario of "fast food burgers with your crush", as there is a lot of waiting, it makes a lot more sense to have a concurrent system.
This is the case for most of the web applications.
Many, many users, but your server is waiting for their not-so-good connection to send their requests.
And then waiting again for the responses to come back.
This "waiting" is measured in microseconds, but still, summing it all, it's a lot of waiting in the end.
That's why it makes a lot of sense to use asynchronous code for web APIs.
Most of the existing popular Python frameworks (including Flask and Django) were created before the new asynchronous features in Python existed. So, the ways they can be deployed support parallel execution and an older form of asynchronous execution that is not as powerful as the new capabilities.
Even though the main specification for asynchronous web Python (ASGI) was developed at Django, to add support for WebSockets.
That kind of asynchronicity is what made NodeJS popular (even though NodeJS is not parallel) and that's the strength of Go as a programing language.
And that's the same level of performance</a> you get with **FastAPI**.
And as you can have parallelism and asynchronicity at the same time, you get higher performance than most of the tested NodeJS frameworks and on par with Go, which is a compiled language closer to C <a href="https://www.techempower.com/benchmarks/#section=data-r17&hw=ph&test=query&l=zijmkf-1" target="_blank">(all thanks to Starlette)</a>.
### Is concurrency better than parallelism?
Nope! That's not the moral of the story.
Concurrency is different than parallelism. And it is better on **specific** scenarios that involve a lot of waiting. Because of that, it generally is a lot better than parallelism for web application development. But not for everything.
So, to balance that out, imagine the following short story:
> You have to clean a big, dirty house.
*Yep, that's the whole story*.
---
There's no waiting anywhere, just a lot of work to be done, on multiple places of the house.
You could have turns as in the burgers example, first the living room, then the kitchen, but as you are not waiting for anything, just cleaning and cleaning, the turns wouldn't affect anything.
It would take the same amount of time to finish with or without turns (concurrency) and you would have done the same amount of work.
But in this case, if you could bring the 8 ex-cashier/cooks/now-cleaners, and each one of them (plus you) could take a zone of the house to clean it, you could do all the work in **parallel**, with the extra help, and finish much sooner.
In this scenario, each one of the cleaners (including you) would be a processor, doing their part of the job.
And as most of the execution time is taken by actual work (instead of waiting), and the work in a computer is done by a <abbr title="Central Processing Unit">CPU</abbr>, they call these problems "CPU bound".
---
Common examples of CPU bound operations are things that require complex math processing.
For example:
* **Audio** or **image processing**
* **Computer vision**: an image is composed of millions of pixels, each pixel has 3 values / colors, processing that normally requires computing something on those pixels, all at the same time)
* **Machine Learning**: it normally requires lots of "matrix" and "vector" multiplications. Think of a huge spreadsheet with numbers and multiplying all of them together at the same time.
* **Deep Learning**: this is a sub-field of Machine Learning, so, the same applies. It's just that there is not a single spreadsheet of numbers to multiply, but a huge set of them, and in many cases, you use a special processor to build and / or use those models.
### Concurrency + Parallelism: Web + Machine Learning
With **FastAPI** you can take the advantage of concurrency that is very common for web development (the same main attractive of NodeJS).
But you can also exploit the benefits of parallelism and multiprocessing (having multiple processes running in parallel) for **CPU bound** workloads like those in Machine Learning systems.
That, plus the simple fact that Python is the main language for **Data Science**, Machine Learning and especially Deep Learning, make FastAPI a very good match for Data Science / Machine Learning web APIs and applications (among many others).
To see how to achieve this parallelism in production see the section about [Deployment](deployment.md).
## `async` and `await`
Modern versions of python have a very intuitive way to define asynchronous code. This makes it look just like normal "sequential" code and do the "awaiting" for you at the right moments.
When there is an operation that will require waiting before giving the results and has support for these new Python features, you can code it like:
```Python
burgers = await get_burgers(2)
```
The key here is the `await`. It tells Python that it has to wait for `get_burgers(2)` to finish doing its thing before storing the results in `burgers`. With that, Python will know that it can go and do something else in the meanwhile (like receiving another request).
For `await` to work, it has to be inside a function that supports this asynchronicity. To do that, you just declare it with `async def`:
```Python hl_lines="1"
async def get_burgers(number: int):
# Do some asynchronous stuff to create the burgers
return burgers
```
...instead of `def`:
```Python hl_lines="2"
# This is not asynchronous
def get_sequential_burgers(number: int):
# Do some sequential stuff to create the burgers
return burgers
```
With `async def`, Python knows that, inside that function, it has to be aware of `await` expressions, and that it can "pause" the execution of that function and go do something else before coming back.
When you want to call an `async def` function, you have to "await" it. So, this won't work:
```Python
# This won't work, because get_burgers was defined with: async def
burgers = get_burgers(2)
```
---
So, if you are using a library that tells you that you can call it with `await`, you need to create the path operation functions that uses it with `async def`, like in:
```Python hl_lines="2 3"
@app.get('/burgers')
async def read_burgers():
burgers = await get_burgers(2)
return burgers
```
### More technical details
You might have noticed that `await` can only be used inside of functions defined with `async def`.
But at the same time, functions defined with `async def` have to be "awaited". So, functions with `async def` can only be called inside of functions defined with `async def` too.
So, about the egg and the chicken, how do you call the first `async` function?
If you are working with **FastAPI** you don't have to worry about that, because that "first" function will be your path operation function, and FastAPI will know how to do the right thing.
But if you want to use `async` / `await` without FastAPI, <a href="https://docs.python.org/3/library/asyncio-task.html#coroutine" target="_blank">check the official Python docs</a>
### Other forms of asynchronous code
This style of using `async` and `await` is relatively new in the language.
But it makes working with asynchronous code a lot easier.
This same syntax (or almost identical) was also included recently in modern versions of JavaScript (in Browser and NodeJS).
But before that, handling asynchronous code was quite more complex and difficult.
In previous versions of Python, you could have used threads or <a href="http://www.gevent.org/" target="_blank">Gevent</a>. But the code is way more complex to understand, debug, and think about.
In previous versions of NodeJS / Browser JavaScript, you would have used "callbacks". Which lead to <a href="http://callbackhell.com/" target="_blank">callback hell</a>.
## Coroutines
**Coroutine** is just the very fancy term for the thing returned by an `async def` function. Python knows that it is something like a function that it can start and that it will end at some point, but that it might be paused internally too, whenever there is an `await` inside of it.
But all this functionality of using asynchronous code with `async` and `await` is many times summarized as using "coroutines". It is comparable to the main key feature of Go, the "Goroutines".
## Conclusion
Let's see the same phrase from above:
> Modern versions of Python have support for **"asynchronous code"** using something called **"coroutines"**, with **`async` and `await`** syntax.
That should make more sense now.
All that is what powers FastAPI (through Starlette) and what makes it have such an impressive performance.

467
docs/de/docs/index.md Normal file
View File

@@ -0,0 +1,467 @@
{!../../../docs/missing-translation.md!}
<p align="center">
<a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a>
</p>
<p align="center">
<em>FastAPI framework, high performance, easy to learn, fast to code, ready for production</em>
</p>
<p align="center">
<a href="https://github.com/tiangolo/fastapi/actions?query=workflow%3ATest" target="_blank">
<img src="https://github.com/tiangolo/fastapi/workflows/Test/badge.svg" alt="Test">
</a>
<a href="https://codecov.io/gh/tiangolo/fastapi" target="_blank">
<img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
</a>
<a href="https://pypi.org/project/fastapi" target="_blank">
<img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
</p>
---
**Documentation**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a>
**Source Code**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
---
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
The key features are:
* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
* **Intuitive**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging.
* **Easy**: Designed to be easy to use and learn. Less time reading docs.
* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
* **Robust**: Get production-ready code. With automatic interactive documentation.
* **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>.
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
{% endfor -%}
{%- for sponsor in sponsors.silver -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
{% endfor %}
{% endif %}
<!-- /sponsors -->
<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
## Opinions
"_[...] 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._"
<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>
---
"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
<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>
---
"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
<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>
---
"_Im over the moon excited about **FastAPI**. Its so fun!_"
<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>
---
"_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._"
<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>
---
"_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 [...]_"
"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
<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>
---
## **Typer**, the FastAPI of CLIs
<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>
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>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
## Requirements
Python 3.6+
FastAPI stands on the shoulders of giants:
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
## Installation
<div class="termy">
```console
$ pip install fastapi
---> 100%
```
</div>
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>.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
## Example
### Create it
* Create a file `main.py` with:
```Python
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
<details markdown="1">
<summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`:
```Python hl_lines="9 14"
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
**Note**:
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>.
</details>
### Run it
Run the server with:
<div class="termy">
```console
$ uvicorn main:app --reload
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [28720]
INFO: Started server process [28722]
INFO: Waiting for application startup.
INFO: Application startup complete.
```
</div>
<details markdown="1">
<summary>About the command <code>uvicorn main:app --reload</code>...</summary>
The command `uvicorn main:app` refers to:
* `main`: the file `main.py` (the Python "module").
* `app`: the object created inside of `main.py` with the line `app = FastAPI()`.
* `--reload`: make the server restart after code changes. Only do this for development.
</details>
### Check it
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>.
You will see the JSON response as:
```JSON
{"item_id": 5, "q": "somequery"}
```
You already created an API that:
* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
* Both _paths_ take `GET` <em>operations</em> (also known as HTTP _methods_).
* The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`.
* The _path_ `/items/{item_id}` has an optional `str` _query parameter_ `q`.
### Interactive API docs
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>.
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>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
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>.
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Example upgrade
Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Optional[bool] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
```
The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
### Interactive API docs upgrade
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>.
* The interactive API documentation will be automatically updated, including the new body:
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
* 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:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
### Alternative API docs upgrade
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>.
* The alternative documentation will also reflect the new query parameter and body:
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Recap
In summary, you declare **once** the types of parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
Just standard **Python 3.6+**.
For example, for an `int`:
```Python
item_id: int
```
or for a more complex `Item` model:
```Python
item: Item
```
...and with that single declaration you get:
* Editor support, including:
* Completion.
* Type checks.
* Validation of data:
* Automatic and clear errors when the data is invalid.
* Validation even for deeply nested JSON objects.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of input data: coming from the network to Python data and types. Reading from:
* JSON.
* Path parameters.
* Query parameters.
* Cookies.
* Headers.
* Forms.
* Files.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of output data: converting from Python data and types to network data (as JSON):
* Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc).
* `datetime` objects.
* `UUID` objects.
* Database models.
* ...and many more.
* Automatic interactive API documentation, including 2 alternative user interfaces:
* Swagger UI.
* ReDoc.
---
Coming back to the previous code example, **FastAPI** will:
* Validate that there is an `item_id` in the path for `GET` and `PUT` requests.
* Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.
* If it is not, the client will see a useful, clear error.
* 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.
* As the `q` parameter is declared with `= None`, it is optional.
* Without the `None` it would be required (as is the body in the case with `PUT`).
* For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
* Check that it has a required attribute `name` that should be a `str`.
* Check that it has a required attribute `price` that has to be a `float`.
* Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
* All this would also work for deeply nested JSON objects.
* Convert from and to JSON automatically.
* Document everything with OpenAPI, that can be used by:
* Interactive documentation systems.
* Automatic client code generation systems, for many languages.
* Provide 2 interactive documentation web interfaces directly.
---
We just scratched the surface, but you already get the idea of how it all works.
Try changing the line with:
```Python
return {"item_name": item.name, "item_id": item_id}
```
...from:
```Python
... "item_name": item.name ...
```
...to:
```Python
... "item_price": item.price ...
```
...and see how your editor will auto-complete the attributes and know their types:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
**Spoiler alert**: the tutorial - user guide includes:
* Declaration of **parameters** from other different places as: **headers**, **cookies**, **form fields** and **files**.
* How to set **validation constraints** as `maximum_length` or `regex`.
* A very powerful and easy to use **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** system.
* Security and authentication, including support for **OAuth2** with **JWT tokens** and **HTTP Basic** auth.
* More advanced (but equally easy) techniques for declaring **deeply nested JSON models** (thanks to Pydantic).
* Many extra features (thanks to Starlette) as:
* **WebSockets**
* **GraphQL**
* extremely easy tests based on `requests` and `pytest`
* **CORS**
* **Cookie Sessions**
* ...and more.
## Performance
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). (*)
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
## Optional Dependencies
Used by Pydantic:
* <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>.
* <a href="https://github.com/JoshData/python-email-validator" target="_blank"><code>email_validator</code></a> - for email validation.
Used by Starlette:
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://github.com/Tinche/aiofiles" target="_blank"><code>aiofiles</code></a> - Required if you want to use `FileResponse` or `StaticFiles`.
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <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()`.
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
* <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).
* <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - Required for `GraphQLApp` support.
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
Used by FastAPI / Starlette:
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
You can install all of these with `pip install fastapi[all]`.
## License
This project is licensed under the terms of the MIT license.

125
docs/de/mkdocs.yml Normal file
View File

@@ -0,0 +1,125 @@
site_name: FastAPI
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
site_url: https://fastapi.tiangolo.com/de/
theme:
name: material
custom_dir: overrides
palette:
- scheme: default
primary: teal
accent: amber
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
- scheme: slate
primary: teal
accent: amber
toggle:
icon: material/lightbulb
name: Switch to dark mode
features:
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github-alt
logo: https://fastapi.tiangolo.com/img/icon-white.svg
favicon: https://fastapi.tiangolo.com/img/favicon.png
language: de
repo_name: tiangolo/fastapi
repo_url: https://github.com/tiangolo/fastapi
edit_uri: ''
google_analytics:
- UA-133183413-1
- auto
plugins:
- search
- markdownextradata:
data: data
nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
markdown_extensions:
- toc:
permalink: true
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- extra
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_div_format ''
- pymdownx.tabbed
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/tiangolo
- icon: fontawesome/brands/dev
link: https://dev.to/tiangolo
- icon: fontawesome/brands/medium
link: https://medium.com/@tiangolo
- icon: fontawesome/solid/globe
link: https://tiangolo.com
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/
name: ru - русский язык
- link: /sq/
name: sq - shqip
- link: /tr/
name: tr - Türkçe
- link: /uk/
name: uk - українська мова
- link: /zh/
name: zh - 汉语
extra_css:
- https://fastapi.tiangolo.com/css/termynal.css
- https://fastapi.tiangolo.com/css/custom.css
extra_javascript:
- https://unpkg.com/mermaid@8.4.6/dist/mermaid.min.js
- https://fastapi.tiangolo.com/js/termynal.js
- https://fastapi.tiangolo.com/js/custom.js

View File

@@ -1,219 +0,0 @@
It is recommended to use <a href="https://www.docker.com/" target="_blank">**Docker**</a> for security, replicability, development simplicity, etc.
In this section you'll see instructions and links to guides to know how to:
* Make your **FastAPI** application a Docker image/container with maximum performance. In about **5 min**.
* (Optionally) understand what you, as a developer, need to know about HTTPS.
* Set up a Docker Swarm mode cluster with automatic HTTPS, even on a simple $5 USD/month server. In about **20 min**.
* Generate and deploy a full **FastAPI** application, using your Docker Swarm cluster, with HTTPS, etc. In about **10 min**.
---
You can also easily use **FastAPI** in a standard server directly too (without Docker).
## Docker
If you are using Docker, you can use the official Docker image:
### <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>
This image has an "auto-tuning" mechanism included, so that you can just add your code and get very high performance automatically. And without making sacrifices.
But you can still change and update all the configurations with environment variables or configuration files.
!!! tip
To see all the configurations and options, go to the Docker image page: <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>.
### Build your Image
* Go to your project directory.
* Create a `Dockerfile` with:
```Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
COPY ./app /app
```
* Create an `app` directory and enter in it.
* Create a `main.py` file with:
```Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
```
* You should now have a directory structure like:
```
.
├── app
│ └── main.py
└── Dockerfile
```
* Go to the project directory (in where your `Dockerfile` is, containing your `app` directory).
* Build your FastAPI image:
```bash
docker build -t myimage .
```
* Run a container based on your image:
```bash
docker run -d --name mycontainer -p 80:80 myimage
```
Now you have an optimized FastAPI server in a Docker container. Auto-tuned for your current server (and number of CPU cores).
### Check it
You should be able to check it in your Docker container's URL, for example: <a href="http://192.168.99.100/items/5?q=somequery" target="_blank">http://192.168.99.100/items/5?q=somequery</a> or <a href="http://127.0.0.1/items/5?q=somequery" target="_blank">http://127.0.0.1/items/5?q=somequery</a> (or equivalent, using your Docker host).
You will see something like:
```JSON
{"item_id": 5, "q": "somequery"}
```
### Interactive API docs
Now you can go to <a href="http://192.168.99.100/docs" target="_blank">http://192.168.99.100/docs</a> or <a href="http://127.0.0.1/docs" target="_blank">http://127.0.0.1/docs</a> (or equivalent, using your Docker host).
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
And you can also go to <a href="http://192.168.99.100/redoc" target="_blank">http://192.168.99.100/redoc</a> or <a href="http://127.0.0.1/redoc" target="_blank">http://127.0.0.1/redoc</a> (or equivalent, using your Docker host).
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## HTTPS
### About HTTPS
It is easy to assume that HTTPS is something that is just "enabled" or not.
But it is way more complex than that.
!!! tip
If you are in a hurry or don't care, continue with the next section for step by step instructions to set everything up.
To learn the basics of HTTPS, from a consumer perspective, check <a href="https://howhttps.works/" target="_blank">https://howhttps.works/</a>.
Now, from a developer's perspective, here are several things to have in mind while thinking about HTTPS:
* For HTTPS, the server needs to have "certificates" generated by a third party.
* Those certificates are actually acquired from the third-party, not "generated".
* Certificates have a lifetime.
* They expire.
* And then they need to be renewed, acquired again from the third party.
* The encryption of the connection happens at the TCP level.
* That's one layer below HTTP.
* So, the certificate and encryption handling is done before HTTP.
* TCP doesn't know about "domains". Only about IP addresses.
* The information about the specific domain requested goes in the HTTP data.
* The HTTPS certificates "certificate" a certain domain, but the protocol and encryption happen at the TCP level, before knowing which domain is being dealt with.
* By default, that would mean that you can only have one HTTPS certificate per IP address.
* No matter how big is your server and how small each application you have there might be. But...
* There's an extension to the TLS protocol (the one handling the encryption at the TCP level, before HTTP) called <a href="https://en.wikipedia.org/wiki/Server_Name_Indication" target="_blank"><abbr title="Server Name Indication">SNI</abbr></a>.
* This SNI extension allows one single server (with a single IP address) to have several HTTPS certificates and server multiple HTTPS domains/applications.
* For this to work, a single component (program) running in the server, listening in the public IP address, must have all the HTTPS certificates in the server.
* After having a secure connection, the communication protocol is the same HTTP.
* It goes encrypted, but the encrypted contents are the same HTTP protocol.
It is a common practice to have one program/HTTP server runing in the server (the machine, host, etc) and managing all the HTTPS parts, sending the decrypted HTTP requests to the actual HTTP application running in the same server (the **FastAPI** application, in this case), take the HTTP response from the application, encrypt it using the appropriate certificate and sending it back to the client using HTTPS. This server is ofter called a <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" target="_blank">TLS Termination Proxy</a>.
### Let's Encrypt
Up to some years ago, these HTTPS certificates were sold by trusted third-parties.
The process to acquire one of these certificates used to be cumbersome, require quite some paperwork and the certificates were quite expensive.
But then <a href="https://letsencrypt.org/" target="_blank">Let's Encrypt</a> was created.
It is a project from the Linux Foundation. It provides HTTPS certificates for free. In an automated way. These certificates use all the standard cryptographic security, and are short lived (about 3 months), so, the security is actually increased, by reducing their lifespan.
The domain's are securely verified and the certificates are generated automatically. This also allows automatizing the renewal of these certificates.
The idea is to automatize the acquisition and renewal of these certificates, so that you can have secure HTTPS, free, forever.
### Traefik
<a href="https://traefik.io/" target="_blank">Traefik</a> is a high performance reverse proxy / load balancer. It can do the "TLS Termination Proxy" job (apart from other features).
It has integration with Let's Encrypt. So, it can handle all the HTTPS parts, including certificate acquisition and renewal.
It also has integrations with Docker. So, you can declare your domains in each application configurations and have it read those configurations, generate the HTTPS certificates and serve HTTPS to your application, all automatically. Without requiring any change in its configuration.
---
With this information and tools, continue with the next section to combine everything.
## Docker Swarm mode cluster with Traefik and HTTPS
You can have a Docker Swarm mode cluster set up in minutes (about 20 min) with a main Traefik handling HTTPS (including certificate acquisition and renewal).
By using Docker Swarm mode, you can start with a "cluster" of a single machine (it can even be a $5 USD / month server) and then you can grow as much as you need adding more servers.
To set up a Docker Swarm Mode cluster with Traefik and HTTPS handling, follow this guide:
### <a href="https://medium.com/@tiangolo/docker-swarm-mode-and-traefik-for-a-https-cluster-20328dba6232" target="_blank">Docker Swarm Mode and Traefik for an HTTPS cluster</a>.
### Deploy a FastAPI application
The easiest way to set everything up, would be using the <a href="/project-generation/" target="_blank">FastAPI project generator</a>.
It is designed to be integrated with this Docker Swarm cluster with Traefik and HTTPS described above.
You can generate a project in about 2 min.
The generated project has instructions to deploy it, doing it takes other 2 min.
## Alternatively, deploy **FastAPI** without Docker
You can deploy **FastAPI** directly without Docker too.
You just need to install <a href="https://www.uvicorn.org/" target="_blank">Uvicorn</a> (or any other ASGI server).
And run your application the same way you have done in the tutorials, but without the `--debug` option, e.g.:
```bash
uvicorn main:app --host 0.0.0.0 --port 80
```
You might want to set up some tooling to make sure it is restarted automatically if it stops.
You might also want to install <a href="https://gunicorn.org/" target="_blank">Gunicorn</a> and <a href="https://www.uvicorn.org/#running-with-gunicorn" target="_blank">use it as a manager for Uvicorn</a>.
Making sure to fine-tune the number of workers, etc.
But if you are doing all that, you might just use the Docker image that does it automatically.

View File

@@ -0,0 +1,258 @@
articles:
english:
- link: https://medium.com/@williamhayes/fastapi-starlette-debug-vs-prod-5f7561db3a59
title: FastAPI/Starlette debug vs prod
author_link: https://medium.com/@williamhayes
author: William Hayes
- link: https://medium.com/data-rebels/fastapi-google-as-an-external-authentication-provider-3a527672cf33
title: FastAPIGoogle as an external authentication provider
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://medium.com/data-rebels/fastapi-how-to-add-basic-and-cookie-authentication-a45c85ef47d3
title: FastAPIHow to add basic and cookie authentication
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://dev.to/errietta/introduction-to-the-fastapi-python-framework-2n10
title: Introduction to the fastapi python framework
author_link: https://dev.to/errietta
author: Errieta Kostala
- link: https://nickc1.github.io/api,/scikit-learn/2019/01/10/scikit-fastapi.html
title: "FastAPI and Scikit-Learn: Easily Deploy Models"
author_link: https://nickc1.github.io/
author: Nick Cortale
- link: https://medium.com/data-rebels/fastapi-authentication-revisited-enabling-api-key-authentication-122dc5975680
title: "FastAPI authentication revisited: Enabling API key authentication"
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://medium.com/@nico.axtmann95/deploying-a-scikit-learn-model-with-onnx-und-fastapi-1af398268915
title: Deploying a scikit-learn model with ONNX and FastAPI
author_link: https://www.linkedin.com/in/nico-axtmann
author: Nico Axtmann
- link: https://geekflare.com/python-asynchronous-web-frameworks/
title: Top 5 Asynchronous Web Frameworks for Python
author_link: https://geekflare.com/author/ankush/
author: Ankush Thakur
- link: https://medium.com/@gntrm/jwt-authentication-with-fastapi-and-aws-cognito-1333f7f2729e
title: JWT Authentication with FastAPI and AWS Cognito
author_link: https://twitter.com/gntrm
author: Johannes Gontrum
- link: https://towardsdatascience.com/how-to-deploy-a-machine-learning-model-dc51200fe8cf
title: How to Deploy a Machine Learning Model
author_link: https://www.linkedin.com/in/mgrootendorst/
author: Maarten Grootendorst
- link: https://eng.uber.com/ludwig-v0-2/
title: "Uber: Ludwig v0.2 Adds New Features and Other Improvements to its Deep Learning Toolbox [including a FastAPI server]"
author_link: https://eng.uber.com
author: Uber Engineering
- link: https://gitlab.com/euri10/fastapi_cheatsheet
title: A FastAPI and Swagger UI visual cheatsheet
author_link: https://gitlab.com/euri10
author: "@euri10"
- link: https://medium.com/@mike.p.moritz/using-docker-compose-to-deploy-a-lightweight-python-rest-api-with-a-job-queue-37e6072a209b
title: Using Docker Compose to deploy a lightweight Python REST API with a job queue
author_link: https://medium.com/@mike.p.moritz
author: Mike Moritz
- link: https://robwagner.dev/tortoise-fastapi-setup/
title: Setting up Tortoise ORM with FastAPI
author_link: https://robwagner.dev/
author: Rob Wagner
- link: https://dev.to/dbanty/why-i-m-leaving-flask-3ki6
title: Why I'm Leaving Flask
author_link: https://dev.to/dbanty
author: Dylan Anthony
- link: https://medium.com/python-data/how-to-deploy-tensorflow-2-0-models-as-an-api-service-with-fastapi-docker-128b177e81f3
title: How To Deploy Tensorflow 2.0 Models As An API Service With FastAPI & Docker
author_link: https://medium.com/@bbrenyah
author: Bernard Brenyah
- link: https://testdriven.io/blog/fastapi-crud/
title: "TestDriven.io: Developing and Testing an Asynchronous API with FastAPI and Pytest"
author_link: https://testdriven.io/authors/herman
author: Michael Herman
- link: https://towardsdatascience.com/deploying-iris-classifications-with-fastapi-and-docker-7c9b83fdec3a
title: "Towards Data Science: Deploying Iris Classifications with FastAPI and Docker"
author_link: https://towardsdatascience.com/@mandygu
author: Mandy Gu
- link: https://medium.com/analytics-vidhya/deploy-machine-learning-models-with-keras-fastapi-redis-and-docker-4940df614ece
title: Deploy Machine Learning Models with Keras, FastAPI, Redis and Docker
author_link: https://medium.com/@shane.soh
author: Shane Soh
- link: https://medium.com/@arthur393/another-boilerplate-to-fastapi-azure-pipeline-ci-pytest-3c8d9a4be0bb
title: "Another Boilerplate to FastAPI: Azure Pipeline CI + Pytest"
author_link: https://twitter.com/arthurheinrique
author: Arthur Henrique
- link: https://iwpnd.pw/articles/2020-01/deploy-fastapi-to-aws-lambda
title: How to continuously deploy a FastAPI to AWS Lambda with AWS SAM
author_link: https://iwpnd.pw
author: Benjamin Ramser
- link: https://www.tutlinks.com/create-and-deploy-fastapi-app-to-heroku/
title: Create and Deploy FastAPI app to Heroku without using Docker
author_link: https://www.linkedin.com/in/navule/
author: Navule Pavan Kumar Rao
- link: https://iwpnd.pw/articles/2020-03/apache-kafka-fastapi-geostream
title: Apache Kafka producer and consumer with FastAPI and aiokafka
author_link: https://iwpnd.pw
author: Benjamin Ramser
- link: https://wuilly.com/2019/10/real-time-notifications-with-python-and-postgres/
title: Real-time Notifications with Python and Postgres
author_link: https://wuilly.com/
author: Guillermo Cruz
- link: https://dev.to/paurakhsharma/microservice-in-python-using-fastapi-24cc
title: Microservice in Python using FastAPI
author_link: https://twitter.com/PaurakhSharma
author: Paurakh Sharma Humagain
- link: https://dev.to/cuongld2/build-simple-api-service-with-python-fastapi-part-1-581o
title: Build simple API service with Python FastAPI — Part 1
author_link: https://dev.to/cuongld2
author: cuongld2
- link: https://paulsec.github.io/posts/fastapi_plus_zeit_serverless_fu/
title: FastAPI + Zeit.co = 🚀
author_link: https://twitter.com/PaulWebSec
author: Paul Sec
- link: https://dev.to/tiangolo/build-a-web-api-from-scratch-with-fastapi-the-workshop-2ehe
title: Build a web API from scratch with FastAPI - the workshop
author_link: https://twitter.com/tiangolo
author: Sebastián Ramírez (tiangolo)
- link: https://www.twilio.com/blog/build-secure-twilio-webhook-python-fastapi
title: Build a Secure Twilio Webhook with Python and FastAPI
author_link: https://www.twilio.com
author: Twilio
- link: https://www.stavros.io/posts/fastapi-with-django/
title: Using FastAPI with Django
author_link: https://twitter.com/Stavros
author: Stavros Korokithakis
- link: https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072
title: Introducing Dispatch
author_link: https://netflixtechblog.com/
author: Netflix
- link: https://davidefiocco.github.io/streamlit-fastapi-ml-serving/
title: Machine learning model serving in Python using FastAPI and streamlit
author_link: https://github.com/davidefiocco
author: Davide Fiocco
- link: https://www.tutlinks.com/deploy-fastapi-on-azure/
title: Deploy FastAPI on Azure App Service
author_link: https://www.linkedin.com/in/navule/
author: Navule Pavan Kumar Rao
- link: https://towardsdatascience.com/build-and-host-fast-data-science-applications-using-fastapi-823be8a1d6a0
title: Build And Host Fast Data Science Applications Using FastAPI
author_link: https://medium.com/@farhadmalik
author: Farhad Malik
- link: https://medium.com/@gabbyprecious2000/creating-a-crud-app-with-fastapi-part-one-7c049292ad37
title: Creating a CRUD App with FastAPI (Part one)
author_link: https://medium.com/@gabbyprecious2000
author: Precious Ndubueze
- link: https://julienharbulot.com/notification-server.html
title: HTTP server to display desktop notifications
author_link: https://julienharbulot.com/
author: Julien Harbulot
- link: https://guitton.co/posts/fastapi-monitoring/
title: How to monitor your FastAPI service
author_link: https://twitter.com/louis_guitton
author: Louis Guitton
- link: https://amitness.com/2020/06/fastapi-vs-flask/
title: FastAPI for Flask Users
author_link: https://twitter.com/amitness
author: Amit Chaudhary
- link: https://valonjanuzaj.medium.com/deploy-a-dockerized-fastapi-application-to-aws-cc757830ba1b
title: Deploy a dockerized FastAPI application to AWS
author_link: https://www.linkedin.com/in/valon-januzaj-b02692187/
author: Valon Januzaj
- link: https://dompatmore.com/blog/authenticate-your-fastapi-app-with-auth0
title: Authenticate Your FastAPI App with auth0
author_link: https://twitter.com/dompatmore
author: Dom Patmore
japanese:
- link: https://qiita.com/mtitg/items/47770e9a562dd150631d
title: FastAPIDB接続してCRUDするPython製APIサーバーを構築
author_link: https://qiita.com/mtitg
author: "@mtitg"
- link: https://qiita.com/ryoryomaru/items/59958ed385b3571d50de
title: python製の最新APIフレームワーク FastAPI を触ってみた
author_link: https://qiita.com/ryoryomaru
author: "@ryoryomaru"
- link: https://qiita.com/angel_katayoku/items/0e1f5dbbe62efc612a78
title: FastAPIでCORSを回避
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/angel_katayoku/items/4fbc1a4e2b33fa2237d2
title: FastAPIをMySQLと接続してDockerで管理してみる
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/angel_katayoku/items/8a458a8952f50b73f420
title: FastAPIでPOSTされたJSONのレスポンスbodyを受け取る
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/hikarut/items/b178af2e2440c67c6ac4
title: フロントエンド開発者向けのDockerによるPython開発環境構築
author_link: https://qiita.com/hikarut
author: Hikaru Takahashi
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-environment
title: "【第1回】FastAPIチュートリアル: ToDoアプリを作ってみよう【環境構築編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-model-building
title: "【第2回】FastAPIチュートリアル: ToDoアプリを作ってみよう【モデル構築編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-authentication-user-registration
title: "【第3回】FastAPIチュートリアル: toDoアプリを作ってみよう【認証・ユーザ登録編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-admin-page-improvement
title: "【第4回】FastAPIチュートリアル: toDoアプリを作ってみよう【管理者ページ改良編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://qiita.com/bee2/items/0ad260ab9835a2087dae
title: PythonのWeb frameworkのパフォーマンス比較 (Django, Flask, responder, FastAPI, japronto)
author_link: https://qiita.com/bee2
author: "@bee2"
- link: https://qiita.com/bee2/items/75d9c0d7ba20e7a4a0e9
title: "[FastAPI] Python製のASGI Web フレームワーク FastAPIに入門する"
author_link: https://qiita.com/bee2
author: "@bee2"
vietnamese:
- link: https://fullstackstation.com/fastapi-trien-khai-bang-docker/
title: "FASTAPI: TRIỂN KHAI BẰNG DOCKER"
author_link: https://fullstackstation.com/author/figonking/
author: Nguyễn Nhân
russian:
- link: https://habr.com/ru/post/454440/
title: "Мелкая питонячая радость #2: Starlette - Солидная примочка FastAPI"
author_link: https://habr.com/ru/users/57uff3r/
author: Andrey Korchak
- link: https://habr.com/ru/post/478620/
title: Почему Вы должны попробовать FastAPI?
author_link: https://github.com/prostomarkeloff
author: prostomarkeloff
- link: https://trkohler.com/fast-api-introduction-to-framework
title: "FastAPI: знакомимся с фреймворком"
author_link: https://www.linkedin.com/in/trkohler/
author: Troy Köhler
german:
- link: https://blog.codecentric.de/2019/08/inbetriebnahme-eines-scikit-learn-modells-mit-onnx-und-fastapi/
title: Inbetriebnahme eines scikit-learn-Modells mit ONNX und FastAPI
author_link: https://twitter.com/_nicoax
author: Nico Axtmann
podcasts:
english:
- link: https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855
title: FastAPI on PythonBytes
author_link: https://pythonbytes.fm/
author: Python Bytes FM
- link: https://www.pythonpodcast.com/fastapi-web-application-framework-episode-259/
title: "Build The Next Generation Of Python Web Applications With FastAPI - Episode 259 - interview to Sebastían Ramírez (tiangolo)"
author_link: https://www.pythonpodcast.com/
author: Podcast.`__init__`
talks:
english:
- link: https://www.youtube.com/watch?v=3DLwPcrE5mA
title: "PyCon UK 2019: FastAPI from the ground up"
author_link: https://twitter.com/chriswithers13
author: Chris Withers
- link: https://www.youtube.com/watch?v=z9K5pwb0rt8
title: "PyConBY 2020: Serve ML models easily with FastAPI"
author_link: https://twitter.com/tiangolo
author: "Sebastián Ramírez (tiangolo)"
- link: https://www.youtube.com/watch?v=PnpTY1f4k2U
title: "[VIRTUAL] Py.Amsterdam's flying Software Circus: Intro to FastAPI"
author_link: https://twitter.com/tiangolo
author: "Sebastián Ramírez (tiangolo)"

752
docs/en/data/people.yml Normal file
View File

@@ -0,0 +1,752 @@
maintainers:
- login: tiangolo
answers: 1225
prs: 232
avatarUrl: https://avatars.githubusercontent.com/u/1326112?u=05f95ca7fdead36edd9c86be46b4ef6c3c71f876&v=4
url: https://github.com/tiangolo
experts:
- login: Kludex
count: 267
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: dmontagu
count: 262
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: ycd
count: 216
avatarUrl: https://avatars.githubusercontent.com/u/62724709?u=826f228edf0bab0d19ad1d5c4ba4df1047ccffef&v=4
url: https://github.com/ycd
- login: Mause
count: 182
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: euri10
count: 166
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: phy25
count: 130
avatarUrl: https://avatars.githubusercontent.com/u/331403?v=4
url: https://github.com/phy25
- login: ArcLightSlavik
count: 64
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: falkben
count: 56
avatarUrl: https://avatars.githubusercontent.com/u/653031?u=0c8d8f33d87f1aa1a6488d3f02105e9abc838105&v=4
url: https://github.com/falkben
- login: raphaelauv
count: 47
avatarUrl: https://avatars.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
- login: sm-Fifteen
count: 46
avatarUrl: https://avatars.githubusercontent.com/u/516999?u=437c0c5038558c67e887ccd863c1ba0f846c03da&v=4
url: https://github.com/sm-Fifteen
- login: includeamin
count: 38
avatarUrl: https://avatars.githubusercontent.com/u/11836741?u=8bd5ef7e62fe6a82055e33c4c0e0a7879ff8cfb6&v=4
url: https://github.com/includeamin
- login: prostomarkeloff
count: 33
avatarUrl: https://avatars.githubusercontent.com/u/28061158?u=72309cc1f2e04e40fa38b29969cb4e9d3f722e7b&v=4
url: https://github.com/prostomarkeloff
- login: Dustyposa
count: 32
avatarUrl: https://avatars.githubusercontent.com/u/27180793?u=5cf2877f50b3eb2bc55086089a78a36f07042889&v=4
url: https://github.com/Dustyposa
- login: krishnardt
count: 30
avatarUrl: https://avatars.githubusercontent.com/u/31960541?u=47f4829c77f4962ab437ffb7995951e41eeebe9b&v=4
url: https://github.com/krishnardt
- login: insomnes
count: 30
avatarUrl: https://avatars.githubusercontent.com/u/16958893?u=f8be7088d5076d963984a21f95f44e559192d912&v=4
url: https://github.com/insomnes
- login: wshayes
count: 29
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: dbanty
count: 25
avatarUrl: https://avatars.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
url: https://github.com/dbanty
- login: SirTelemak
count: 24
avatarUrl: https://avatars.githubusercontent.com/u/9435877?u=719327b7d2c4c62212456d771bfa7c6b8dbb9eac&v=4
url: https://github.com/SirTelemak
- login: chbndrhnns
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/7534547?v=4
url: https://github.com/chbndrhnns
- login: acnebs
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/9054108?u=bfd127b3e6200f4d00afd714f0fc95c2512df19b&v=4
url: https://github.com/acnebs
- login: nsidnev
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/22559461?u=a9cc3238217e21dc8796a1a500f01b722adb082c&v=4
url: https://github.com/nsidnev
- login: frankie567
count: 21
avatarUrl: https://avatars.githubusercontent.com/u/1144727?u=72adf1cb1d29787305c99700d669561952cea0af&v=4
url: https://github.com/frankie567
- login: chris-allnutt
count: 21
avatarUrl: https://avatars.githubusercontent.com/u/565544?v=4
url: https://github.com/chris-allnutt
- login: retnikt
count: 19
avatarUrl: https://avatars.githubusercontent.com/u/24581770?v=4
url: https://github.com/retnikt
- login: Hultner
count: 18
avatarUrl: https://avatars.githubusercontent.com/u/2669034?u=115e53df959309898ad8dc9443fbb35fee71df07&v=4
url: https://github.com/Hultner
- login: jorgerpo
count: 17
avatarUrl: https://avatars.githubusercontent.com/u/12537771?u=7444d20019198e34911082780cc7ad73f2b97cb3&v=4
url: https://github.com/jorgerpo
- login: nkhitrov
count: 17
avatarUrl: https://avatars.githubusercontent.com/u/28262306?u=66ee21316275ef356081c2efc4ed7a4572e690dc&v=4
url: https://github.com/nkhitrov
- login: waynerv
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: haizaar
count: 13
avatarUrl: https://avatars.githubusercontent.com/u/58201?u=4f1f9843d69433ca0d380d95146cfe119e5fdac4&v=4
url: https://github.com/haizaar
- login: acidjunk
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/685002?u=b5094ab4527fc84b006c0ac9ff54367bdebb2267&v=4
url: https://github.com/acidjunk
- login: zamiramir
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/40475662?u=e58ef61034e8d0d6a312cc956fb09b9c3332b449&v=4
url: https://github.com/zamiramir
- login: juntatalor
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/8134632?v=4
url: https://github.com/juntatalor
- login: valentin994
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/42819267?u=fdeeaa9242a59b243f8603496b00994f6951d5a2&v=4
url: https://github.com/valentin994
- login: aalifadv
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/78442260?v=4
url: https://github.com/aalifadv
- login: stefanondisponibile
count: 10
avatarUrl: https://avatars.githubusercontent.com/u/20441825?u=ee1e59446b98f8ec2363caeda4c17164d0d9cc7d&v=4
url: https://github.com/stefanondisponibile
last_month_active:
- login: Kludex
count: 12
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: frankie567
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/1144727?u=72adf1cb1d29787305c99700d669561952cea0af&v=4
url: https://github.com/frankie567
- login: Mause
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: ArcLightSlavik
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: gyKa
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/1000842?v=4
url: https://github.com/gyKa
- login: ricky-sb
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/10700079?v=4
url: https://github.com/ricky-sb
- login: captainCapitalism
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/32553875?v=4
url: https://github.com/captainCapitalism
- login: acidjunk
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/685002?u=b5094ab4527fc84b006c0ac9ff54367bdebb2267&v=4
url: https://github.com/acidjunk
top_contributors:
- login: waynerv
count: 25
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: tokusumi
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
url: https://github.com/tokusumi
- login: dmontagu
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: euri10
count: 13
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: mariacamilagl
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
url: https://github.com/mariacamilagl
- login: RunningIkkyu
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
url: https://github.com/RunningIkkyu
- login: Serrones
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
url: https://github.com/Serrones
- login: hard-coders
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: wshayes
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: SwftAlpc
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/52768429?u=6a3aa15277406520ad37f6236e89466ed44bc5b8&v=4
url: https://github.com/SwftAlpc
- login: Attsun1031
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/1175560?v=4
url: https://github.com/Attsun1031
- login: jekirl
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/2546697?v=4
url: https://github.com/jekirl
- login: komtaki
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/39375566?u=5a44657c0544111ee3c132d9bb9951c2804f7969&v=4
url: https://github.com/komtaki
- login: Smlep
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/16785985?v=4
url: https://github.com/Smlep
top_reviewers:
- login: Kludex
count: 80
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: tokusumi
count: 44
avatarUrl: https://avatars.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
url: https://github.com/tokusumi
- login: Laineyzhang55
count: 42
avatarUrl: https://avatars.githubusercontent.com/u/59285379?v=4
url: https://github.com/Laineyzhang55
- login: ycd
count: 41
avatarUrl: https://avatars.githubusercontent.com/u/62724709?u=826f228edf0bab0d19ad1d5c4ba4df1047ccffef&v=4
url: https://github.com/ycd
- login: waynerv
count: 38
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: AdrianDeAnda
count: 28
avatarUrl: https://avatars.githubusercontent.com/u/1024932?u=bb7f8a0d6c9de4e9d0320a9f271210206e202250&v=4
url: https://github.com/AdrianDeAnda
- login: dmontagu
count: 23
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: komtaki
count: 21
avatarUrl: https://avatars.githubusercontent.com/u/39375566?u=5a44657c0544111ee3c132d9bb9951c2804f7969&v=4
url: https://github.com/komtaki
- login: ArcLightSlavik
count: 20
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: cassiobotaro
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/3127847?u=b0a652331da17efeb85cd6e3a4969182e5004804&v=4
url: https://github.com/cassiobotaro
- login: yanever
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/21978760?v=4
url: https://github.com/yanever
- login: SwftAlpc
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/52768429?u=6a3aa15277406520ad37f6236e89466ed44bc5b8&v=4
url: https://github.com/SwftAlpc
- login: pedabraham
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/16860088?u=abf922a7b920bf8fdb7867d8b43e091f1e796178&v=4
url: https://github.com/pedabraham
- login: delhi09
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/63476957?u=6c86e59b48e0394d4db230f37fc9ad4d7e2c27c7&v=4
url: https://github.com/delhi09
- login: RunningIkkyu
count: 12
avatarUrl: https://avatars.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
url: https://github.com/RunningIkkyu
- login: hard-coders
count: 12
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: sh0nk
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/6478810?u=af15d724875cec682ed8088a86d36b2798f981c0&v=4
url: https://github.com/sh0nk
- login: mariacamilagl
count: 10
avatarUrl: https://avatars.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
url: https://github.com/mariacamilagl
- login: Attsun1031
count: 10
avatarUrl: https://avatars.githubusercontent.com/u/1175560?v=4
url: https://github.com/Attsun1031
- login: maoyibo
count: 10
avatarUrl: https://avatars.githubusercontent.com/u/7887703?v=4
url: https://github.com/maoyibo
- login: PandaHun
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/13096845?u=646eba44db720e37d0dbe8e98e77ab534ea78a20&v=4
url: https://github.com/PandaHun
- login: bezaca
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/69092910?u=4ac58eab99bd37d663f3d23551df96d4fbdbf760&v=4
url: https://github.com/bezaca
- login: lsglucas
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/61513630?u=320e43fe4dc7bc6efc64e9b8f325f8075634fd20&v=4
url: https://github.com/lsglucas
- login: rjNemo
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/56785022?u=d5c3a02567c8649e146fcfc51b6060ccaf8adef8&v=4
url: https://github.com/rjNemo
- login: blt232018
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/43393471?u=172b0e0391db1aa6c1706498d6dfcb003c8a4857&v=4
url: https://github.com/blt232018
- login: Serrones
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
url: https://github.com/Serrones
- login: ryuckel
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/36391432?u=094eec0cfddd5013f76f31e55e56147d78b19553&v=4
url: https://github.com/ryuckel
- login: raphaelauv
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
- login: NastasiaSaby
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/8245071?u=b3afd005f9e4bf080c219ef61a592b3a8004b764&v=4
url: https://github.com/NastasiaSaby
- login: Smlep
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/16785985?v=4
url: https://github.com/Smlep
- login: jovicon
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/21287303?u=b049eac3e51a4c0473c2efe66b4d28a7d8f2b572&v=4
url: https://github.com/jovicon
- login: Mause
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: nimctl
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/49960770?u=e39b11d47188744ee07b2a1c7ce1a1bdf3c80760&v=4
url: https://github.com/nimctl
- login: juntatalor
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/8134632?v=4
url: https://github.com/juntatalor
- login: SnkSynthesis
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/63564282?u=0078826509dbecb2fdb543f4e881c9cd06157893&v=4
url: https://github.com/SnkSynthesis
- login: anthonycepeda
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/72019805?u=892f700c79f9732211bd5221bf16eec32356a732&v=4
url: https://github.com/anthonycepeda
- login: euri10
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: rkbeatss
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/23391143?u=56ab6bff50be950fa8cae5cf736f2ae66e319ff3&v=4
url: https://github.com/rkbeatss
- login: aviramha
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/41201924?u=6883cc4fc13a7b2e60d4deddd4be06f9c5287880&v=4
url: https://github.com/aviramha
- login: Zxilly
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/31370133?v=4
url: https://github.com/Zxilly
- login: Bluenix2
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/38372706?u=c9d28aff15958d6ebf1971148bfb3154ff943c4f&v=4
url: https://github.com/Bluenix2
sponsors_50:
- login: johnadjei
avatarUrl: https://avatars.githubusercontent.com/u/767860?v=4
url: https://github.com/johnadjei
- login: wdwinslow
avatarUrl: https://avatars.githubusercontent.com/u/11562137?u=dc01daafb354135603a263729e3d26d939c0c452&v=4
url: https://github.com/wdwinslow
- login: bingwu-chime
avatarUrl: https://avatars.githubusercontent.com/u/67026650?u=603a6b345f25c20c6706a8a6c7f71ae688d649a5&v=4
url: https://github.com/bingwu-chime
sponsors:
- login: kamalgill
avatarUrl: https://avatars.githubusercontent.com/u/133923?u=0df9181d97436ce330e9acf90ab8a54b7022efe7&v=4
url: https://github.com/kamalgill
- login: grillazz
avatarUrl: https://avatars.githubusercontent.com/u/3415861?u=16d7d0ffa5dfb99f8834f8f76d90e138ba09b94a&v=4
url: https://github.com/grillazz
- login: tizz98
avatarUrl: https://avatars.githubusercontent.com/u/5739698?u=f095a3659e3a8e7c69ccd822696990b521ea25f9&v=4
url: https://github.com/tizz98
- login: jmaralc
avatarUrl: https://avatars.githubusercontent.com/u/21101214?u=b15a9f07b7cbf6c9dcdbcb6550bbd2c52f55aa50&v=4
url: https://github.com/jmaralc
- login: psgandalf
avatarUrl: https://avatars.githubusercontent.com/u/8134158?v=4
url: https://github.com/psgandalf
- login: samuelcolvin
avatarUrl: https://avatars.githubusercontent.com/u/4039449?u=807390ba9cfe23906c3bf8a0d56aaca3cf2bfa0d&v=4
url: https://github.com/samuelcolvin
- login: jokull
avatarUrl: https://avatars.githubusercontent.com/u/701?u=0532b62166893d5160ef795c4c8b7512d971af05&v=4
url: https://github.com/jokull
- login: wshayes
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: koxudaxi
avatarUrl: https://avatars.githubusercontent.com/u/630670?u=507d8577b4b3670546b449c4c2ccbc5af40d72f7&v=4
url: https://github.com/koxudaxi
- login: falkben
avatarUrl: https://avatars.githubusercontent.com/u/653031?u=0c8d8f33d87f1aa1a6488d3f02105e9abc838105&v=4
url: https://github.com/falkben
- login: jqueguiner
avatarUrl: https://avatars.githubusercontent.com/u/690878?u=e4835b2a985a0f2d52018e4926cb5a58c26a62e8&v=4
url: https://github.com/jqueguiner
- login: Mazyod
avatarUrl: https://avatars.githubusercontent.com/u/860511?v=4
url: https://github.com/Mazyod
- login: ltieman
avatarUrl: https://avatars.githubusercontent.com/u/1084689?u=e69b17de17cb3ca141a17daa7ccbe173ceb1eb17&v=4
url: https://github.com/ltieman
- login: mrmattwright
avatarUrl: https://avatars.githubusercontent.com/u/1277725?v=4
url: https://github.com/mrmattwright
- login: westonsteimel
avatarUrl: https://avatars.githubusercontent.com/u/1593939?u=0f2c0e3647f916fe295d62fa70da7a4c177115e3&v=4
url: https://github.com/westonsteimel
- login: timdrijvers
avatarUrl: https://avatars.githubusercontent.com/u/1694939?v=4
url: https://github.com/timdrijvers
- login: mrgnw
avatarUrl: https://avatars.githubusercontent.com/u/2504532?u=7ec43837a6d0afa80f96f0788744ea6341b89f97&v=4
url: https://github.com/mrgnw
- login: madisonmay
avatarUrl: https://avatars.githubusercontent.com/u/2645393?u=f22b93c6ea345a4d26a90a3834dfc7f0789fcb63&v=4
url: https://github.com/madisonmay
- login: saivarunk
avatarUrl: https://avatars.githubusercontent.com/u/2976867?u=71f4385e781e9a9e871a52f2d4686f9a8d69ba2f&v=4
url: https://github.com/saivarunk
- login: andre1sk
avatarUrl: https://avatars.githubusercontent.com/u/3148093?v=4
url: https://github.com/andre1sk
- login: Shark009
avatarUrl: https://avatars.githubusercontent.com/u/3163309?v=4
url: https://github.com/Shark009
- login: peterHoburg
avatarUrl: https://avatars.githubusercontent.com/u/3860655?u=f55f47eb2d6a9b495e806ac5a044e3ae01ccc1fa&v=4
url: https://github.com/peterHoburg
- login: dudil
avatarUrl: https://avatars.githubusercontent.com/u/4785835?u=58b7ea39123e0507f3b2996448a27256b16fd697&v=4
url: https://github.com/dudil
- login: ennui93
avatarUrl: https://avatars.githubusercontent.com/u/5300907?u=5b5452725ddb391b2caaebf34e05aba873591c3a&v=4
url: https://github.com/ennui93
- login: sco1
avatarUrl: https://avatars.githubusercontent.com/u/5323929?u=2b8434060d0c9d93de80a2a945baed94a412c31e&v=4
url: https://github.com/sco1
- login: MacroPower
avatarUrl: https://avatars.githubusercontent.com/u/5648814?u=b2730000c9f9a471282b9849d2cc85711d7973d4&v=4
url: https://github.com/MacroPower
- login: ginomempin
avatarUrl: https://avatars.githubusercontent.com/u/6091865?v=4
url: https://github.com/ginomempin
- login: iwpnd
avatarUrl: https://avatars.githubusercontent.com/u/6152183?u=b2286006daafff5f991557344fee20b5da59639a&v=4
url: https://github.com/iwpnd
- login: s3ich4n
avatarUrl: https://avatars.githubusercontent.com/u/6926298?u=ba3025d698e1c986655e776ae383a3d60d9d578e&v=4
url: https://github.com/s3ich4n
- login: Rehket
avatarUrl: https://avatars.githubusercontent.com/u/7015688?u=3afb0ba200feebbc7f958950e92db34df2a3c172&v=4
url: https://github.com/Rehket
- login: christippett
avatarUrl: https://avatars.githubusercontent.com/u/7218120?u=434b9d29287d7de25772d94ddc74a9bd6d969284&v=4
url: https://github.com/christippett
- login: Kludex
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: Shackelford-Arden
avatarUrl: https://avatars.githubusercontent.com/u/7362263?v=4
url: https://github.com/Shackelford-Arden
- login: macleodmac
avatarUrl: https://avatars.githubusercontent.com/u/8996312?u=e39c68c3e0b1d264dcba4850134a291680f46355&v=4
url: https://github.com/macleodmac
- login: cristeaadrian
avatarUrl: https://avatars.githubusercontent.com/u/9112724?v=4
url: https://github.com/cristeaadrian
- login: otivvormes
avatarUrl: https://avatars.githubusercontent.com/u/11317418?u=6de1edefb6afd0108c0ad2816bd6efc4464a9c44&v=4
url: https://github.com/otivvormes
- login: iambobmae
avatarUrl: https://avatars.githubusercontent.com/u/12390270?u=c9a35c2ee5092a9b4135ebb1f91b7f521c467031&v=4
url: https://github.com/iambobmae
- login: ronaldnwilliams
avatarUrl: https://avatars.githubusercontent.com/u/13632749?u=ac41a086d0728bf66a9d2bee9e5e377041ff44a4&v=4
url: https://github.com/ronaldnwilliams
- login: uselessscat
avatarUrl: https://avatars.githubusercontent.com/u/15332878?u=8485a1b7383c274b28f383370ee2d5f9a6cd423b&v=4
url: https://github.com/uselessscat
- login: natenka
avatarUrl: https://avatars.githubusercontent.com/u/15850513?u=00d1083c980d0b4ce32835dc07eee7f43f34fd2f&v=4
url: https://github.com/natenka
- login: la-mar
avatarUrl: https://avatars.githubusercontent.com/u/16618300?u=7755c0521d2bb0d704f35a51464b15c1e2e6c4da&v=4
url: https://github.com/la-mar
- login: robintully
avatarUrl: https://avatars.githubusercontent.com/u/17059673?u=862b9bb01513f5acd30df97433cb97a24dbfb772&v=4
url: https://github.com/robintully
- login: ShaulAb
avatarUrl: https://avatars.githubusercontent.com/u/18129076?u=2c8d48e47f2dbee15c3f89c3d17d4c356504386c&v=4
url: https://github.com/ShaulAb
- login: wedwardbeck
avatarUrl: https://avatars.githubusercontent.com/u/19333237?u=1de4ae2bf8d59eb4c013f21d863cbe0f2010575f&v=4
url: https://github.com/wedwardbeck
- login: linusg
avatarUrl: https://avatars.githubusercontent.com/u/19366641?u=125e390abef8fff3b3b0d370c369cba5d7fd4c67&v=4
url: https://github.com/linusg
- login: RedCarpetUp
avatarUrl: https://avatars.githubusercontent.com/u/20360440?v=4
url: https://github.com/RedCarpetUp
- login: daddycocoaman
avatarUrl: https://avatars.githubusercontent.com/u/21189155?u=756f6a17c71c538b11470f70839baacab43807ef&v=4
url: https://github.com/daddycocoaman
- login: Filimoa
avatarUrl: https://avatars.githubusercontent.com/u/21352040?u=75e02d102d2ee3e3d793e555fa5c63045913ccb0&v=4
url: https://github.com/Filimoa
- login: raminsj13
avatarUrl: https://avatars.githubusercontent.com/u/24259406?u=d51f2a526312ebba150a06936ed187ca0727d329&v=4
url: https://github.com/raminsj13
- login: comoelcometa
avatarUrl: https://avatars.githubusercontent.com/u/25950317?u=c6751efa038561b9bc5fa56d1033d5174e10cd65&v=4
url: https://github.com/comoelcometa
- login: veprimk
avatarUrl: https://avatars.githubusercontent.com/u/29689749?u=f8cb5a15a286e522e5b189bc572d5a1a90217fb2&v=4
url: https://github.com/veprimk
- login: orihomie
avatarUrl: https://avatars.githubusercontent.com/u/29889683?u=6bc2135a52fcb3a49e69e7d50190796618185fda&v=4
url: https://github.com/orihomie
- login: SaltyCoco
avatarUrl: https://avatars.githubusercontent.com/u/31451104?u=6ee4e17c07d21b7054f54a12fa9cc377a1b24ff9&v=4
url: https://github.com/SaltyCoco
- login: mauroalejandrojm
avatarUrl: https://avatars.githubusercontent.com/u/31569442?u=cdada990a1527926a36e95f62c30a8b48bbc49a1&v=4
url: https://github.com/mauroalejandrojm
- login: public-daniel
avatarUrl: https://avatars.githubusercontent.com/u/32238294?u=0377e38dd023395c9643d5388b4e9489a24b4d34&v=4
url: https://github.com/public-daniel
- login: ybressler
avatarUrl: https://avatars.githubusercontent.com/u/40807730?u=6621dc9ab53b697912ab2a32211bb29ae90a9112&v=4
url: https://github.com/ybressler
- login: dbanty
avatarUrl: https://avatars.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
url: https://github.com/dbanty
- login: dudikbender
avatarUrl: https://avatars.githubusercontent.com/u/53487583?u=494f85229115076121b3639a3806bbac1c6ae7f6&v=4
url: https://github.com/dudikbender
- login: primer-io
avatarUrl: https://avatars.githubusercontent.com/u/62146168?v=4
url: https://github.com/primer-io
- login: tkrestiankova
avatarUrl: https://avatars.githubusercontent.com/u/67013045?v=4
url: https://github.com/tkrestiankova
- login: daverin
avatarUrl: https://avatars.githubusercontent.com/u/70378377?u=6d1814195c0de7162820eaad95a25b423a3869c0&v=4
url: https://github.com/daverin
- login: anthonycepeda
avatarUrl: https://avatars.githubusercontent.com/u/72019805?u=892f700c79f9732211bd5221bf16eec32356a732&v=4
url: https://github.com/anthonycepeda
- login: linux-china
avatarUrl: https://avatars.githubusercontent.com/u/46711?v=4
url: https://github.com/linux-china
- login: jhb
avatarUrl: https://avatars.githubusercontent.com/u/142217?v=4
url: https://github.com/jhb
- login: yourkin
avatarUrl: https://avatars.githubusercontent.com/u/178984?v=4
url: https://github.com/yourkin
- login: jmagnusson
avatarUrl: https://avatars.githubusercontent.com/u/190835?v=4
url: https://github.com/jmagnusson
- login: slafs
avatarUrl: https://avatars.githubusercontent.com/u/210173?v=4
url: https://github.com/slafs
- login: adamghill
avatarUrl: https://avatars.githubusercontent.com/u/317045?u=f1349d5ffe84a19f324e204777859fbf69ddf633&v=4
url: https://github.com/adamghill
- login: eteq
avatarUrl: https://avatars.githubusercontent.com/u/346587?v=4
url: https://github.com/eteq
- login: dmig
avatarUrl: https://avatars.githubusercontent.com/u/388564?v=4
url: https://github.com/dmig
- login: hongqn
avatarUrl: https://avatars.githubusercontent.com/u/405587?u=470b4c04832e45141fd5264d3354845cc9fc6466&v=4
url: https://github.com/hongqn
- login: rinckd
avatarUrl: https://avatars.githubusercontent.com/u/546002?u=1fcc7e664dc86524a0af6837a0c222829c3fd4e5&v=4
url: https://github.com/rinckd
- login: Pytlicek
avatarUrl: https://avatars.githubusercontent.com/u/1430522?u=169dba3bfbc04ed214a914640ff435969f19ddb3&v=4
url: https://github.com/Pytlicek
- login: okken
avatarUrl: https://avatars.githubusercontent.com/u/1568356?u=0a991a21bdc62e2bea9ad311652f2c45f453dc84&v=4
url: https://github.com/okken
- login: leogregianin
avatarUrl: https://avatars.githubusercontent.com/u/1684053?u=94ddd387601bd1805034dbe83e6eba0491c15323&v=4
url: https://github.com/leogregianin
- login: cbonoz
avatarUrl: https://avatars.githubusercontent.com/u/2351087?u=fd3e8030b2cc9fbfbb54a65e9890c548a016f58b&v=4
url: https://github.com/cbonoz
- login: rglsk
avatarUrl: https://avatars.githubusercontent.com/u/2768101?u=e349c88673f2155fe021331377c656a9d74bcc25&v=4
url: https://github.com/rglsk
- login: Atem18
avatarUrl: https://avatars.githubusercontent.com/u/2875254?v=4
url: https://github.com/Atem18
- login: paul121
avatarUrl: https://avatars.githubusercontent.com/u/3116995?u=6e2d8691cc345e63ee02e4eb4d7cef82b1fcbedc&v=4
url: https://github.com/paul121
- login: igorcorrea
avatarUrl: https://avatars.githubusercontent.com/u/3438238?u=c57605077c31a8f7b2341fc4912507f91b4a5621&v=4
url: https://github.com/igorcorrea
- login: zsinx6
avatarUrl: https://avatars.githubusercontent.com/u/3532625?u=ba75a5dc744d1116ccfeaaf30d41cb2fe81fe8dd&v=4
url: https://github.com/zsinx6
- login: pawamoy
avatarUrl: https://avatars.githubusercontent.com/u/3999221?u=b030e4c89df2f3a36bc4710b925bdeb6745c9856&v=4
url: https://github.com/pawamoy
- login: spyker77
avatarUrl: https://avatars.githubusercontent.com/u/4953435?u=568baae6469628e020fe0bab16e395b7ae10c7d3&v=4
url: https://github.com/spyker77
- login: serfer2
avatarUrl: https://avatars.githubusercontent.com/u/5196592?u=e8798d87120952ed41876778f0cc8a1ddb47f901&v=4
url: https://github.com/serfer2
- login: JonasKs
avatarUrl: https://avatars.githubusercontent.com/u/5310116?u=98a049f3e1491bffb91e1feb7e93def6881a9389&v=4
url: https://github.com/JonasKs
- login: holec
avatarUrl: https://avatars.githubusercontent.com/u/6438041?u=f5af71ec85b3a9d7b8139cb5af0512b02fa9ab1e&v=4
url: https://github.com/holec
- login: BartlomiejRasztabiga
avatarUrl: https://avatars.githubusercontent.com/u/8852711?u=ed213d60f7a423df31ceb1004aa3ec60e612cb98&v=4
url: https://github.com/BartlomiejRasztabiga
- login: davanstrien
avatarUrl: https://avatars.githubusercontent.com/u/8995957?u=fb2aad2b52bb4e7b56db6d7c8ecc9ae1eac1b984&v=4
url: https://github.com/davanstrien
- login: and-semakin
avatarUrl: https://avatars.githubusercontent.com/u/9129071?u=ea77ddf7de4bc375d546bf2825ed420eaddb7666&v=4
url: https://github.com/and-semakin
- login: VivianSolide
avatarUrl: https://avatars.githubusercontent.com/u/9358572?u=ffb2e2ec522a15dcd3f0af1f9fd1df4afe418afa&v=4
url: https://github.com/VivianSolide
- login: hard-coders
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: satwikkansal
avatarUrl: https://avatars.githubusercontent.com/u/10217535?u=b12d6ef74ea297de9e46da6933b1a5b7ba9e6a61&v=4
url: https://github.com/satwikkansal
- login: pheanex
avatarUrl: https://avatars.githubusercontent.com/u/10408624?u=5b6bab6ee174aa6e991333e06eb29f628741013d&v=4
url: https://github.com/pheanex
- login: wotori
avatarUrl: https://avatars.githubusercontent.com/u/10486621?u=0044c295b91694b8c9bccc0a805681f794250f7b&v=4
url: https://github.com/wotori
- login: JimFawkes
avatarUrl: https://avatars.githubusercontent.com/u/12075115?u=dc58ecfd064d72887c34bf500ddfd52592509acd&v=4
url: https://github.com/JimFawkes
- login: logan-connolly
avatarUrl: https://avatars.githubusercontent.com/u/16244943?u=8ae66dfbba936463cc8aa0dd7a6d2b4c0cc757eb&v=4
url: https://github.com/logan-connolly
- login: iPr0ger
avatarUrl: https://avatars.githubusercontent.com/u/19322290?v=4
url: https://github.com/iPr0ger
- login: sadikkuzu
avatarUrl: https://avatars.githubusercontent.com/u/23168063?u=765ed469c44c004560079210ccdad5b29938eaa9&v=4
url: https://github.com/sadikkuzu
- login: ghandic
avatarUrl: https://avatars.githubusercontent.com/u/23500353?u=e2e1d736f924d9be81e8bfc565b6d8836ba99773&v=4
url: https://github.com/ghandic
- login: MoronVV
avatarUrl: https://avatars.githubusercontent.com/u/24293616?v=4
url: https://github.com/MoronVV
- login: AngusWG
avatarUrl: https://avatars.githubusercontent.com/u/26385612?u=f4d4c8bd2097cdd58eb9e385932b83c78777f3c0&v=4
url: https://github.com/AngusWG
- login: mertguvencli
avatarUrl: https://avatars.githubusercontent.com/u/29762151?u=16a906d90df96c8cff9ea131a575c4bc171b1523&v=4
url: https://github.com/mertguvencli
- login: rgreen32
avatarUrl: https://avatars.githubusercontent.com/u/35779241?u=c9d64ad1ab364b6a1ec8e3d859da9ca802d681d8&v=4
url: https://github.com/rgreen32
- login: askurihin
avatarUrl: https://avatars.githubusercontent.com/u/37978981?v=4
url: https://github.com/askurihin
- login: berrysauce
avatarUrl: https://avatars.githubusercontent.com/u/38889179?u=758ed15a5be8bbd03855f5a74f42c19f7946ee32&v=4
url: https://github.com/berrysauce
- login: JitPackJoyride
avatarUrl: https://avatars.githubusercontent.com/u/40203625?u=9638bfeacfa5940358188f8205ce662bba022b53&v=4
url: https://github.com/JitPackJoyride
- login: es3n1n
avatarUrl: https://avatars.githubusercontent.com/u/40367813?u=e881a3880f1e342d19a1ea7c8e1b6d76c52dc294&v=4
url: https://github.com/es3n1n
- login: ilias-ant
avatarUrl: https://avatars.githubusercontent.com/u/42189572?u=a2d6121bac4d125d92ec207460fa3f1842d37e66&v=4
url: https://github.com/ilias-ant
- login: kbhatiya999
avatarUrl: https://avatars.githubusercontent.com/u/47816034?v=4
url: https://github.com/kbhatiya999
- login: akanz1
avatarUrl: https://avatars.githubusercontent.com/u/51492342?u=2280f57134118714645e16b535c1a37adf6b369b&v=4
url: https://github.com/akanz1
- login: rychardvale
avatarUrl: https://avatars.githubusercontent.com/u/54805553?u=3d20ab05301d05f9ac3500fb79a2bfee3842b753&v=4
url: https://github.com/rychardvale
- login: athemeart
avatarUrl: https://avatars.githubusercontent.com/u/61623624?v=4
url: https://github.com/athemeart
- login: Rhythmicc
avatarUrl: https://avatars.githubusercontent.com/u/29839231?u=2100781089a259707c475c4547bd7995b0fc18ee&v=4
url: https://github.com/Rhythmicc

21
docs/en/data/sponsors.yml Normal file
View File

@@ -0,0 +1,21 @@
gold:
- url: https://www.deta.sh/?ref=fastapi
title: The launchpad for all your (team's) ideas
img: https://fastapi.tiangolo.com/img/sponsors/deta.svg
- url: https://bit.ly/2QSouzH
title: "Jina: build neural search-as-a-service for any kind of data in just minutes."
img: https://fastapi.tiangolo.com/img/sponsors/jina.svg
silver:
- url: https://www.investsuite.com/jobs
title: Wealthtech jobs with FastAPI
img: https://fastapi.tiangolo.com/img/sponsors/investsuite.svg
- url: https://www.vim.so/?utm_source=FastAPI
title: We help you master vim with interactive exercises
img: https://fastapi.tiangolo.com/img/sponsors/vimso.png
- url: https://talkpython.fm/fastapi-sponsor
title: FastAPI video courses on demand from people you trust
img: https://fastapi.tiangolo.com/img/sponsors/talkpython.png
bronze:
- url: https://testdriven.io/courses/tdd-fastapi/
title: Learn to build high-quality web apps with best practices
img: https://fastapi.tiangolo.com/img/sponsors/testdriven.svg

View File

@@ -0,0 +1,240 @@
# Additional Responses in OpenAPI
!!! warning
This is a rather advanced topic.
If you are starting with **FastAPI**, you might not need this.
You can declare additional responses, with additional status codes, media types, descriptions, etc.
Those additional responses will be included in the OpenAPI schema, so they will also appear in the API docs.
But for those additional responses you have to make sure you return a `Response` like `JSONResponse` directly, with your status code and content.
## Additional Response with `model`
You can pass to your *path operation decorators* a parameter `responses`.
It receives a `dict`, the keys are status codes for each response, like `200`, and the values are other `dict`s with the information for each of them.
Each of those response `dict`s can have a key `model`, containing a Pydantic model, just like `response_model`.
**FastAPI** will take that model, generate its JSON Schema and include it in the correct place in OpenAPI.
For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write:
```Python hl_lines="18 23"
{!../../../docs_src/additional_responses/tutorial001.py!}
```
!!! note
Have in mind that you have to return the `JSONResponse` directly.
!!! info
The `model` key is not part of OpenAPI.
**FastAPI** will take the Pydantic model from there, generate the `JSON Schema`, and put it in the correct place.
The correct place is:
* In the key `content`, that has as value another JSON object (`dict`) that contains:
* A key with the media type, e.g. `application/json`, that contains as value another JSON object, that contains:
* A key `schema`, that has as the value the JSON Schema from the model, here's the correct place.
* **FastAPI** adds a reference here to the global JSON Schemas in another place in your OpenAPI instead of including it directly. This way, other applications and clients can use those JSON Schemas directly, provide better code generation tools, etc.
The generated responses in the OpenAPI for this *path operation* will be:
```JSON hl_lines="3-12"
{
"responses": {
"404": {
"description": "Additional Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Message"
}
}
}
},
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Item"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
```
The schemas are referenced to another place inside the OpenAPI schema:
```JSON hl_lines="4-16"
{
"components": {
"schemas": {
"Message": {
"title": "Message",
"required": [
"message"
],
"type": "object",
"properties": {
"message": {
"title": "Message",
"type": "string"
}
}
},
"Item": {
"title": "Item",
"required": [
"id",
"value"
],
"type": "object",
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"value": {
"title": "Value",
"type": "string"
}
}
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"type": "string"
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
}
}
}
}
```
## Additional media types for the main response
You can use this same `responses` parameter to add different media types for the same main response.
For example, you can add an additional media type of `image/png`, declaring that your *path operation* can return a JSON object (with media type `application/json`) or a PNG image:
```Python hl_lines="19-24 28"
{!../../../docs_src/additional_responses/tutorial002.py!}
```
!!! note
Notice that you have to return the image using a `FileResponse` directly.
!!! info
Unless you specify a different media type explicitly in your `responses` parameter, FastAPI will assume the response has the same media type as the main response class (default `application/json`).
But if you have specified a custom response class with `None` as its media type, FastAPI will use `application/json` for any additional response that has an associated model.
## Combining information
You can also combine response information from multiple places, including the `response_model`, `status_code`, and `responses` parameters.
You can declare a `response_model`, using the default status code `200` (or a custom one if you need), and then declare additional information for that same response in `responses`, directly in the OpenAPI schema.
**FastAPI** will keep the additional information from `responses`, and combine it with the JSON Schema from your model.
For example, you can declare a response with a status code `404` that uses a Pydantic model and has a custom `description`.
And a response with a status code `200` that uses your `response_model`, but includes a custom `example`:
```Python hl_lines="20-31"
{!../../../docs_src/additional_responses/tutorial003.py!}
```
It will all be combined and included in your OpenAPI, and shown in the API docs:
<img src="/img/tutorial/additional-responses/image01.png">
## Combine predefined responses and custom ones
You might want to have some predefined responses that apply to many *path operations*, but you want to combine them with custom responses needed by each *path operation*.
For those cases, you can use the Python technique of "unpacking" a `dict` with `**dict_to_unpack`:
```Python
old_dict = {
"old key": "old value",
"second old key": "second old value",
}
new_dict = {**old_dict, "new key": "new value"}
```
Here, `new_dict` will contain all the key-value pairs from `old_dict` plus the new key-value pair:
```Python
{
"old key": "old value",
"second old key": "second old value",
"new key": "new value",
}
```
You can use that technique to re-use some predefined responses in your *path operations* and combine them with additional custom ones.
For example:
```Python hl_lines="13-17 26"
{!../../../docs_src/additional_responses/tutorial004.py!}
```
## More information about OpenAPI responses
To see what exactly you can include in the responses, you can check these sections in the OpenAPI specification:
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#responsesObject" class="external-link" target="_blank">OpenAPI Responses Object</a>, it includes the `Response Object`.
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#responseObject" class="external-link" target="_blank">OpenAPI Response Object</a>, you can include anything from this directly in each response inside your `responses` parameter. Including `description`, `headers`, `content` (inside of this is that you declare different media types and JSON Schemas), and `links`.

View File

@@ -0,0 +1,37 @@
# Additional Status Codes
By default, **FastAPI** will return the responses using a `JSONResponse`, putting the content you return from your *path operation* inside of that `JSONResponse`.
It will use the default status code or the one you set in your *path operation*.
## Additional status codes
If you want to return additional status codes apart from the main one, you can do that by returning a `Response` directly, like a `JSONResponse`, and set the additional status code directly.
For example, let's say that you want to have a *path operation* that allows to update items, and returns HTTP status codes of 200 "OK" when successful.
But you also want it to accept new items. And when the items didn't exist before, it creates them, and returns an HTTP status code of 201 "Created".
To achieve that, import `JSONResponse`, and return your content there directly, setting the `status_code` that you want:
```Python hl_lines="4 23"
{!../../../docs_src/additional_status_codes/tutorial001.py!}
```
!!! warning
When you return a `Response` directly, like in the example above, it will be returned directly.
It won't be serialized with a model, etc.
Make sure it has the data you want it to have, and that the values are valid JSON (if you are using `JSONResponse`).
!!! note "Technical Details"
You could also use `from starlette.responses import JSONResponse`.
**FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette. The same with `status`.
## OpenAPI and API docs
If you return additional status codes and responses directly, they won't be included in the OpenAPI schema (the API docs), because FastAPI doesn't have a way to know beforehand what you are going to return.
But you can document that in your code, using: [Additional Responses](additional-responses.md){.internal-link target=_blank}.

View File

@@ -1,7 +1,4 @@
!!! danger
This is, more or less, an "advanced" chapter.
If you are just starting with **FastAPI** you might want to skip this chapter and come back to it later.
# Advanced Dependencies
## Parameterized dependencies
@@ -22,7 +19,7 @@ Not the class itself (which is already a callable), but an instance of that clas
To do that, we declare a method `__call__`:
```Python hl_lines="10"
{!./src/dependencies/tutorial006.py!}
{!../../../docs_src/dependencies/tutorial011.py!}
```
In this case, this `__call__` is what **FastAPI** will use to check for additional parameters and sub-dependencies, and this is what will be called to pass a value to the parameter in your *path operation function* later.
@@ -32,7 +29,7 @@ In this case, this `__call__` is what **FastAPI** will use to check for addition
And now, we can use `__init__` to declare the parameters of the instance that we can use to "parameterize" the dependency:
```Python hl_lines="7"
{!./src/dependencies/tutorial006.py!}
{!../../../docs_src/dependencies/tutorial011.py!}
```
In this case, **FastAPI** won't ever touch or care about `__init__`, we will use it directly in our code.
@@ -42,7 +39,7 @@ In this case, **FastAPI** won't ever touch or care about `__init__`, we will use
We could create an instance of this class with:
```Python hl_lines="16"
{!./src/dependencies/tutorial006.py!}
{!../../../docs_src/dependencies/tutorial011.py!}
```
And that way we are able to "parameterize" our dependency, that now has `"bar"` inside of it, as the attribute `checker.fixed_content`.
@@ -57,10 +54,10 @@ And when solving the dependency, **FastAPI** will call this `checker` like:
checker(q="somequery")
```
...and pass whatever that returns as the value of the dependency in our path operation function as the parameter `fixed_content_included`:
...and pass whatever that returns as the value of the dependency in our *path operation function* as the parameter `fixed_content_included`:
```Python hl_lines="20"
{!./src/dependencies/tutorial006.py!}
{!../../../docs_src/dependencies/tutorial011.py!}
```
!!! tip
@@ -68,6 +65,6 @@ checker(q="somequery")
These examples are intentionally simple, but show how it all works.
In the chapters about security, you will be using utility functions that are implemented in this same way.
In the chapters about security, there are utility functions that are implemented in this same way.
If you understood all this, you already know how those utility tools for security work underneath.

View File

@@ -0,0 +1,162 @@
# Async SQL (Relational) Databases
You can also use <a href="https://github.com/encode/databases" class="external-link" target="_blank">`encode/databases`</a> with **FastAPI** to connect to databases using `async` and `await`.
It is compatible with:
* PostgreSQL
* MySQL
* SQLite
In this example, we'll use **SQLite**, because it uses a single file and Python has integrated support. So, you can copy this example and run it as is.
Later, for your production application, you might want to use a database server like **PostgreSQL**.
!!! tip
You could adopt ideas from the section about SQLAlchemy ORM ([SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank}), like using utility functions to perform operations in the database, independent of your **FastAPI** code.
This section doesn't apply those ideas, to be equivalent to the counterpart in <a href="https://www.starlette.io/database/" class="external-link" target="_blank">Starlette</a>.
## Import and set up `SQLAlchemy`
* Import `SQLAlchemy`.
* Create a `metadata` object.
* Create a table `notes` using the `metadata` object.
```Python hl_lines="4 14 16-22"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
!!! tip
Notice that all this code is pure SQLAlchemy Core.
`databases` is not doing anything here yet.
## Import and set up `databases`
* Import `databases`.
* Create a `DATABASE_URL`.
* Create a `database` object.
```Python hl_lines="3 9 12"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
!!! tip
If you were connecting to a different database (e.g. PostgreSQL), you would need to change the `DATABASE_URL`.
## Create the tables
In this case, we are creating the tables in the same Python file, but in production, you would probably want to create them with Alembic, integrated with migrations, etc.
Here, this section would run directly, right before starting your **FastAPI** application.
* Create an `engine`.
* Create all the tables from the `metadata` object.
```Python hl_lines="25-28"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
## Create models
Create Pydantic models for:
* Notes to be created (`NoteIn`).
* Notes to be returned (`Note`).
```Python hl_lines="31-33 36-39"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
By creating these Pydantic models, the input data will be validated, serialized (converted), and annotated (documented).
So, you will be able to see it all in the interactive API docs.
## Connect and disconnect
* Create your `FastAPI` application.
* Create event handlers to connect and disconnect from the database.
```Python hl_lines="42 45-47 50-52"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
## Read notes
Create the *path operation function* to read notes:
```Python hl_lines="55-58"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
!!! Note
Notice that as we communicate with the database using `await`, the *path operation function* is declared with `async`.
### Notice the `response_model=List[Note]`
It uses `typing.List`.
That documents (and validates, serializes, filters) the output data, as a `list` of `Note`s.
## Create notes
Create the *path operation function* to create notes:
```Python hl_lines="61-65"
{!../../../docs_src/async_sql_databases/tutorial001.py!}
```
!!! Note
Notice that as we communicate with the database using `await`, the *path operation function* is declared with `async`.
### About `{**note.dict(), "id": last_record_id}`
`note` is a Pydantic `Note` object.
`note.dict()` returns a `dict` with its data, something like:
```Python
{
"text": "Some note",
"completed": False,
}
```
but it doesn't have the `id` field.
So we create a new `dict`, that contains the key-value pairs from `note.dict()` with:
```Python
{**note.dict()}
```
`**note.dict()` "unpacks" the key value pairs directly, so, `{**note.dict()}` would be, more or less, a copy of `note.dict()`.
And then, we extend that copy `dict`, adding another key-value pair: `"id": last_record_id`:
```Python
{**note.dict(), "id": last_record_id}
```
So, the final result returned would be something like:
```Python
{
"id": 1,
"text": "Some note",
"completed": False,
}
```
## Check it
You can copy this code as is, and see the docs at <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
There you can see all your API documented and interact with it:
<img src="/img/tutorial/async-sql-databases/image01.png">
## More info
You can read more about <a href="https://github.com/encode/databases" class="external-link" target="_blank">`encode/databases` at its GitHub page</a>.

View File

@@ -0,0 +1,100 @@
# Async Tests
You have already seen how to test your **FastAPI** applications using the provided `TestClient`, but with it, you can't test or run any other `async` function in your (synchronous) pytest functions.
Being able to use asynchronous functions in your tests could be useful, for example, when you're querying your database asynchronously. Imagine you want to test sending requests to your FastAPI application and then verify that your backend successfully wrote the correct data in the database, while using an async database library.
Let's look at how we can make that work.
## pytest-asyncio
If we want to call asynchronous functions in our tests, our test functions have to be asynchronous. Pytest provides a neat library for this, called `pytest-asyncio`, that allows us to specify that some test functions are to be called asynchronously.
You can install it via:
<div class="termy">
```console
$ pip install pytest-asyncio
---> 100%
```
</div>
## HTTPX
Even if your **FastAPI** application uses normal `def` functions instead of `async def`, it is still an `async` application underneath.
The `TestClient` does some magic inside to call the asynchronous FastAPI application in your normal `def` test functions, using standard pytest. But that magic doesn't work anymore when we're using it inside asynchronous functions. By running our tests asynchronously, we can no longer use the `TestClient` inside our test functions.
Luckily there's a nice alternative, called <a href="https://www.python-httpx.org/" class="external-link" target="_blank">HTTPX</a>.
HTTPX is an HTTP client for Python 3 that allows us to query our FastAPI application similarly to how we did it with the `TestClient`.
If you're familiar with the <a href="https://requests.readthedocs.io/en/master/" class="external-link" target="_blank">Requests</a> library, you'll find that the API of HTTPX is almost identical.
The important difference for us is that with HTTPX we are not limited to synchronous, but can also make asynchronous requests.
## Example
For a simple example, let's consider the following `main.py` module:
```Python
{!../../../docs_src/async_tests/main.py!}
```
The `test_main.py` module that contains the tests for `main.py` could look like this now:
```Python
{!../../../docs_src/async_tests/test_main.py!}
```
## Run it
You can run your tests as usual via:
<div class="termy">
```console
$ pytest
---> 100%
```
</div>
## In Detail
The marker `@pytest.mark.asyncio` tells pytest that this test function should be called asynchronously:
```Python hl_lines="7"
{!../../../docs_src/async_tests/test_main.py!}
```
!!! tip
Note that the test function is now `async def` instead of just `def` as before when using the `TestClient`.
Then we can create an `AsyncClient` with the app, and send async requests to it, using `await`.
```Python hl_lines="9-10"
{!../../../docs_src/async_tests/test_main.py!}
```
This is the equivalent to:
```Python
response = client.get('/')
```
that we used to make our requests with the `TestClient`.
!!! tip
Note that we're using async/await with the new `AsyncClient` - the request is asynchronous.
## Other Asynchronous Function Calls
As the testing function is now asynchronous, you can now also call (and `await`) other `async` functions apart from sending requests to your FastAPI application in your tests, exactly as you would call them anywhere else in your code.
!!! tip
If you encounter a `RuntimeError: Task attached to a different loop` when integrating asynchronous function calls in your tests (e.g. when using <a href="https://stackoverflow.com/questions/41584243/runtimeerror-task-attached-to-a-different-loop" class="external-link" target="_blank">MongoDB's MotorClient</a>) check out <a href="https://github.com/pytest-dev/pytest-asyncio/issues/38#issuecomment-264418154" class="external-link" target="_blank">this issue</a> in the pytest-asyncio repository.

View File

@@ -0,0 +1,346 @@
# Behind a Proxy
In some situations, you might need to use a **proxy** server like Traefik or Nginx with a configuration that adds an extra path prefix that is not seen by your application.
In these cases you can use `root_path` to configure your application.
The `root_path` is a mechanism provided by the ASGI specification (that FastAPI is built on, through Starlette).
The `root_path` is used to handle these specific cases.
And it's also used internally when mounting sub-applications.
## Proxy with a stripped path prefix
Having a proxy with a stripped path prefix, in this case, means that you could declare a path at `/app` in your code, but then, you add a layer on top (the proxy) that would put your **FastAPI** application under a path like `/api/v1`.
In this case, the original path `/app` would actually be served at `/api/v1/app`.
Even though all your code is written assuming there's just `/app`.
And the proxy would be **"stripping"** the **path prefix** on the fly before transmitting the request to Uvicorn, keep your application convinced that it is serving at `/app`, so that you don't have to update all your code to include the prefix `/api/v1`.
Up to here, everything would work as normally.
But then, when you open the integrated docs UI (the frontend), it would expect to get the OpenAPI schema at `/openapi.json`, instead of `/api/v1/openapi.json`.
So, the frontend (that runs in the browser) would try to reach `/openapi.json` and wouldn't be able to get the OpenAPI schema.
Because we have a proxy with a path prefix of `/api/v1` for our app, the frontend needs to fetch the OpenAPI schema at `/api/v1/openapi.json`.
```mermaid
graph LR
browser("Browser")
proxy["Proxy on http://0.0.0.0:9999/api/v1/app"]
server["Server on http://127.0.0.1:8000/app"]
browser --> proxy
proxy --> server
```
!!! tip
The IP `0.0.0.0` is commonly used to mean that the program listens on all the IPs available in that machine/server.
The docs UI would also need the OpenAPI schema to declare that this API `server` is located at `/api/v1` (behind the proxy). For example:
```JSON hl_lines="4-8"
{
"openapi": "3.0.2",
// More stuff here
"servers": [
{
"url": "/api/v1"
}
],
"paths": {
// More stuff here
}
}
```
In this example, the "Proxy" could be something like **Traefik**. And the server would be something like **Uvicorn**, running your FastAPI application.
### Providing the `root_path`
To achieve this, you can use the command line option `--root-path` like:
<div class="termy">
```console
$ uvicorn main:app --root-path /api/v1
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
If you use Hypercorn, it also has the option `--root-path`.
!!! note "Technical Details"
The ASGI specification defines a `root_path` for this use case.
And the `--root-path` command line option provides that `root_path`.
### Checking the current `root_path`
You can get the current `root_path` used by your application for each request, it is part of the `scope` dictionary (that's part of the ASGI spec).
Here we are including it in the message just for demonstration purposes.
```Python hl_lines="8"
{!../../../docs_src/behind_a_proxy/tutorial001.py!}
```
Then, if you start Uvicorn with:
<div class="termy">
```console
$ uvicorn main:app --root-path /api/v1
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
The response would be something like:
```JSON
{
"message": "Hello World",
"root_path": "/api/v1"
}
```
### Setting the `root_path` in the FastAPI app
Alternatively, if you don't have a way to provide a command line option like `--root-path` or equivalent, you can set the `root_path` parameter when creating your FastAPI app:
```Python hl_lines="3"
{!../../../docs_src/behind_a_proxy/tutorial002.py!}
```
Passing the `root_path` to `FastAPI` would be the equivalent of passing the `--root-path` command line option to Uvicorn or Hypercorn.
### About `root_path`
Have in mind that the server (Uvicorn) won't use that `root_path` for anything else than passing it to the app.
But if you go with your browser to <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000/app</a> you will see the normal response:
```JSON
{
"message": "Hello World",
"root_path": "/api/v1"
}
```
So, it won't expect to be accessed at `http://127.0.0.1:8000/api/v1/app`.
Uvicorn will expect the proxy to access Uvicorn at `http://127.0.0.1:8000/app`, and then it would be the proxy's responsibility to add the extra `/api/v1` prefix on top.
## About proxies with a stripped path prefix
Have in mind that a proxy with stripped path prefix is only one of the ways to configure it.
Probably in many cases the default will be that the proxy doesn't have a stripped path prefix.
In a case like that (without a stripped path prefix), the proxy would listen on something like `https://myawesomeapp.com`, and then if the browser goes to `https://myawesomeapp.com/api/v1/app` and your server (e.g. Uvicorn) listens on `http://127.0.0.1:8000` the proxy (without a stripped path prefix) would access Uvicorn at the same path: `http://127.0.0.1:8000/api/v1/app`.
## Testing locally with Traefik
You can easily run the experiment locally with a stripped path prefix using <a href="https://docs.traefik.io/" class="external-link" target="_blank">Traefik</a>.
<a href="https://github.com/containous/traefik/releases" class="external-link" target="_blank">Download Traefik</a>, it's a single binary, you can extract the compressed file and run it directly from the terminal.
Then create a file `traefik.toml` with:
```TOML hl_lines="3"
[entryPoints]
[entryPoints.http]
address = ":9999"
[providers]
[providers.file]
filename = "routes.toml"
```
This tells Traefik to listen on port 9999 and to use another file `routes.toml`.
!!! tip
We are using port 9999 instead of the standard HTTP port 80 so that you don't have to run it with admin (`sudo`) privileges.
Now create that other file `routes.toml`:
```TOML hl_lines="5 12 20"
[http]
[http.middlewares]
[http.middlewares.api-stripprefix.stripPrefix]
prefixes = ["/api/v1"]
[http.routers]
[http.routers.app-http]
entryPoints = ["http"]
service = "app"
rule = "PathPrefix(`/api/v1`)"
middlewares = ["api-stripprefix"]
[http.services]
[http.services.app]
[http.services.app.loadBalancer]
[[http.services.app.loadBalancer.servers]]
url = "http://127.0.0.1:8000"
```
This file configures Traefik to use the path prefix `/api/v1`.
And then it will redirect its requests to your Uvicorn running on `http://127.0.0.1:8000`.
Now start Traefik:
<div class="termy">
```console
$ ./traefik --configFile=traefik.toml
INFO[0000] Configuration loaded from file: /home/user/awesomeapi/traefik.toml
```
</div>
And now start your app with Uvicorn, using the `--root-path` option:
<div class="termy">
```console
$ uvicorn main:app --root-path /api/v1
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
### Check the responses
Now, if you go to the URL with the port for Uvicorn: <a href="http://127.0.0.1:8000/app" class="external-link" target="_blank">http://127.0.0.1:8000/app</a>, you will see the normal response:
```JSON
{
"message": "Hello World",
"root_path": "/api/v1"
}
```
!!! tip
Notice that even though you are accessing it at `http://127.0.0.1:8000/app` it shows the `root_path` of `/api/v1`, taken from the option `--root-path`.
And now open the URL with the port for Traefik, including the path prefix: <a href="http://127.0.0.1:9999/api/v1/app" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/app</a>.
We get the same response:
```JSON
{
"message": "Hello World",
"root_path": "/api/v1"
}
```
but this time at the URL with the prefix path provided by the proxy: `/api/v1`.
Of course, the idea here is that everyone would access the app through the proxy, so the version with the path prefix `/app/v1` is the "correct" one.
And the version without the path prefix (`http://127.0.0.1:8000/app`), provided by Uvicorn directly, would be exclusively for the _proxy_ (Traefik) to access it.
That demonstrates how the Proxy (Traefik) uses the path prefix and how the server (Uvicorn) uses the `root_path` from the option `--root-path`.
### Check the docs UI
But here's the fun part. ✨
The "official" way to access the app would be through the proxy with the path prefix that we defined. So, as we would expect, if you try the docs UI served by Uvicorn directly, without the path prefix in the URL, it won't work, because it expects to be accessed through the proxy.
You can check it at <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>:
<img src="/img/tutorial/behind-a-proxy/image01.png">
But if we access the docs UI at the "official" URL using the proxy with port `9999`, at `/api/v1/docs`, it works correctly! 🎉
You can check it at <a href="http://127.0.0.1:9999/api/v1/docs" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/docs</a>:
<img src="/img/tutorial/behind-a-proxy/image02.png">
Right as we wanted it. ✔️
This is because FastAPI uses this `root_path` to create the default `server` in OpenAPI with the URL provided by `root_path`.
## Additional servers
!!! warning
This is a more advanced use case. Feel free to skip it.
By default, **FastAPI** will create a `server` in the OpenAPI schema with the URL for the `root_path`.
But you can also provide other alternative `servers`, for example if you want *the same* docs UI to interact with a staging and production environments.
If you pass a custom list of `servers` and there's a `root_path` (because your API lives behind a proxy), **FastAPI** will insert a "server" with this `root_path` at the beginning of the list.
For example:
```Python hl_lines="4-7"
{!../../../docs_src/behind_a_proxy/tutorial003.py!}
```
Will generate an OpenAPI schema like:
```JSON hl_lines="5-7"
{
"openapi": "3.0.2",
// More stuff here
"servers": [
{
"url": "/api/v1"
},
{
"url": "https://stag.example.com",
"description": "Staging environment"
},
{
"url": "https://prod.example.com",
"description": "Production environment"
}
],
"paths": {
// More stuff here
}
}
```
!!! tip
Notice the auto-generated server with a `url` value of `/api/v1`, taken from the `root_path`.
In the docs UI at <a href="http://127.0.0.1:9999/api/v1/docs" class="external-link" target="_blank">http://127.0.0.1:9999/api/v1/docs</a> it would look like:
<img src="/img/tutorial/behind-a-proxy/image03.png">
!!! tip
The docs UI will interact with the server that you select.
### Disable automatic server from `root_path`
If you don't want **FastAPI** to include an automatic server using the `root_path`, you can use the parameter `root_path_in_servers=False`:
```Python hl_lines="9"
{!../../../docs_src/behind_a_proxy/tutorial004.py!}
```
and then it won't include it in the OpenAPI schema.
## Mounting a sub-application
If you need to mount a sub-application (as described in [Sub Applications - Mounts](./sub-applications.md){.internal-link target=_blank}) while also using a proxy with `root_path`, you can do it normally, as you would expect.
FastAPI will internally use the `root_path` smartly, so it will just work. ✨

View File

@@ -0,0 +1,58 @@
# Conditional OpenAPI
If you needed to, you could use settings and environment variables to configure OpenAPI conditionally depending on the environment, and even disable it entirely.
## About security, APIs, and docs
Hiding your documentation user interfaces in production *shouldn't* be the way to protect your API.
That doesn't add any extra security to your API, the *path operations* will still be available where they are.
If there's a security flaw in your code, it will still exist.
Hiding the documentation just makes it more difficult to understand how to interact with your API, and could make it more difficult for you to debug it in production. It could be considered simply a form of <a href="https://en.wikipedia.org/wiki/Security_through_obscurity" class="external-link" target="_blank">Security through obscurity</a>.
If you want to secure your API, there are several better things you can do, for example:
* Make sure you have well defined Pydantic models for your request bodies and responses.
* Configure any required permissions and roles using dependencies.
* Never store plaintext passwords, only password hashes.
* Implement and use well-known cryptographic tools, like Passlib and JWT tokens, etc.
* Add more granular permission controls with OAuth2 scopes where needed.
* ...etc.
Nevertheless, you might have a very specific use case where you really need to disable the API docs for some environment (e.g. for production) or depending on configurations from environment variables.
## Conditional OpenAPI from settings and env vars
You can easily use the same Pydantic settings to configure your generated OpenAPI and the docs UIs.
For example:
```Python hl_lines="6 11"
{!../../../docs_src/conditional_openapi/tutorial001.py!}
```
Here we declare the setting `openapi_url` with the same default of `"/openapi.json"`.
And then we use it when creating the `FastAPI` app.
Then you could disable OpenAPI (including the UI docs) by setting the environment variable `OPENAPI_URL` to the empty string, like:
<div class="termy">
```console
$ OPENAPI_URL= uvicorn main:app
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
Then if you go to the URLs at `/openapi.json`, `/docs`, or `/redoc` you will just get a `404 Not Found` error like:
```JSON
{
"detail": "Not Found"
}
```

View File

@@ -0,0 +1,109 @@
# Custom Request and APIRoute class
In some cases, you may want to override the logic used by the `Request` and `APIRoute` classes.
In particular, this may be a good alternative to logic in a middleware.
For example, if you want to read or manipulate the request body before it is processed by your application.
!!! danger
This is an "advanced" feature.
If you are just starting with **FastAPI** you might want to skip this section.
## Use cases
Some use cases include:
* Converting non-JSON request bodies to JSON (e.g. <a href="https://msgpack.org/index.html" class="external-link" target="_blank">`msgpack`</a>).
* Decompressing gzip-compressed request bodies.
* Automatically logging all request bodies.
## Handling custom request body encodings
Let's see how to make use of a custom `Request` subclass to decompress gzip requests.
And an `APIRoute` subclass to use that custom request class.
### Create a custom `GzipRequest` class
!!! tip
This is a toy example to demonstrate how it works, if you need Gzip support, you can use the provided [`GzipMiddleware`](./middleware.md#gzipmiddleware){.internal-link target=_blank}.
First, we create a `GzipRequest` class, which will overwrite the `Request.body()` method to decompress the body in the presence of an appropriate header.
If there's no `gzip` in the header, it will not try to decompress the body.
That way, the same route class can handle gzip compressed or uncompressed requests.
```Python hl_lines="8-15"
{!../../../docs_src/custom_request_and_route/tutorial001.py!}
```
### Create a custom `GzipRoute` class
Next, we create a custom subclass of `fastapi.routing.APIRoute` that will make use of the `GzipRequest`.
This time, it will overwrite the method `APIRoute.get_route_handler()`.
This method returns a function. And that function is what will receive a request and return a response.
Here we use it to create a `GzipRequest` from the original request.
```Python hl_lines="18-26"
{!../../../docs_src/custom_request_and_route/tutorial001.py!}
```
!!! note "Technical Details"
A `Request` has a `request.scope` attribute, that's just a Python `dict` containing the metadata related to the request.
A `Request` also has a `request.receive`, that's a function to "receive" the body of the request.
The `scope` `dict` and `receive` function are both part of the ASGI specification.
And those two things, `scope` and `receive`, are what is needed to create a new `Request` instance.
To learn more about the `Request` check <a href="https://www.starlette.io/requests/" class="external-link" target="_blank">Starlette's docs about Requests</a>.
The only thing the function returned by `GzipRequest.get_route_handler` does differently is convert the `Request` to a `GzipRequest`.
Doing this, our `GzipRequest` will take care of decompressing the data (if necessary) before passing it to our *path operations*.
After that, all of the processing logic is the same.
But because of our changes in `GzipRequest.body`, the request body will be automatically decompressed when it is loaded by **FastAPI** when needed.
## Accessing the request body in an exception handler
!!! tip
To solve this same problem, it's probably a lot easier to use the `body` in a custom handler for `RequestValidationError` ([Handling Errors](../tutorial/handling-errors.md#use-the-requestvalidationerror-body){.internal-link target=_blank}).
But this example is still valid and it shows how to interact with the internal components.
We can also use this same approach to access the request body in an exception handler.
All we need to do is handle the request inside a `try`/`except` block:
```Python hl_lines="13 15"
{!../../../docs_src/custom_request_and_route/tutorial002.py!}
```
If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error:
```Python hl_lines="16-18"
{!../../../docs_src/custom_request_and_route/tutorial002.py!}
```
## Custom `APIRoute` class in a router
You can also set the `route_class` parameter of an `APIRouter`:
```Python hl_lines="26"
{!../../../docs_src/custom_request_and_route/tutorial003.py!}
```
In this example, the *path operations* under the `router` will use the custom `TimedRoute` class, and will have an extra `X-Response-Time` header in the response with the time it took to generate the response:
```Python hl_lines="13-20"
{!../../../docs_src/custom_request_and_route/tutorial003.py!}
```

View File

@@ -0,0 +1,264 @@
# Custom Response - HTML, Stream, File, others
By default, **FastAPI** will return the responses using `JSONResponse`.
You can override it by returning a `Response` directly as seen in [Return a Response directly](response-directly.md){.internal-link target=_blank}.
But if you return a `Response` directly, the data won't be automatically converted, and the documentation won't be automatically generated (for example, including the specific "media type", in the HTTP header `Content-Type` as part of the generated OpenAPI).
But you can also declare the `Response` that you want to be used, in the *path operation decorator*.
The contents that you return from your *path operation function* will be put inside of that `Response`.
And if that `Response` has a JSON media type (`application/json`), like is the case with the `JSONResponse` and `UJSONResponse`, the data you return will be automatically converted (and filtered) with any Pydantic `response_model` that you declared in the *path operation decorator*.
!!! note
If you use a response class with no media type, FastAPI will expect your response to have no content, so it will not document the response format in its generated OpenAPI docs.
## Use `ORJSONResponse`
For example, if you are squeezing performance, you can install and use <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a> and set the response to be `ORJSONResponse`.
Import the `Response` class (sub-class) you want to use and declare it in the *path operation decorator*.
```Python hl_lines="2 7"
{!../../../docs_src/custom_response/tutorial001b.py!}
```
!!! info
The parameter `response_class` will also be used to define the "media type" of the response.
In this case, the HTTP header `Content-Type` will be set to `application/json`.
And it will be documented as such in OpenAPI.
!!! tip
The `ORJSONResponse` is currently only available in FastAPI, not in Starlette.
## HTML Response
To return a response with HTML directly from **FastAPI**, use `HTMLResponse`.
* Import `HTMLResponse`.
* Pass `HTMLResponse` as the parameter `response_class` of your *path operation decorator*.
```Python hl_lines="2 7"
{!../../../docs_src/custom_response/tutorial002.py!}
```
!!! info
The parameter `response_class` will also be used to define the "media type" of the response.
In this case, the HTTP header `Content-Type` will be set to `text/html`.
And it will be documented as such in OpenAPI.
### Return a `Response`
As seen in [Return a Response directly](response-directly.md){.internal-link target=_blank}, you can also override the response directly in your *path operation*, by returning it.
The same example from above, returning an `HTMLResponse`, could look like:
```Python hl_lines="2 7 19"
{!../../../docs_src/custom_response/tutorial003.py!}
```
!!! warning
A `Response` returned directly by your *path operation function* won't be documented in OpenAPI (for example, the `Content-Type` won't be documented) and won't be visible in the automatic interactive docs.
!!! info
Of course, the actual `Content-Type` header, status code, etc, will come from the `Response` object your returned.
### Document in OpenAPI and override `Response`
If you want to override the response from inside of the function but at the same time document the "media type" in OpenAPI, you can use the `response_class` parameter AND return a `Response` object.
The `response_class` will then be used only to document the OpenAPI *path operation*, but your `Response` will be used as is.
#### Return an `HTMLResponse` directly
For example, it could be something like:
```Python hl_lines="7 21 23"
{!../../../docs_src/custom_response/tutorial004.py!}
```
In this example, the function `generate_html_response()` already generates and returns a `Response` instead of returning the HTML in a `str`.
By returning the result of calling `generate_html_response()`, you are already returning a `Response` that will override the default **FastAPI** behavior.
But as you passed the `HTMLResponse` in the `response_class` too, **FastAPI** will know how to document it in OpenAPI and the interactive docs as HTML with `text/html`:
<img src="/img/tutorial/custom-response/image01.png">
## Available responses
Here are some of the available responses.
Have in mind that you can use `Response` to return anything else, or even create a custom sub-class.
!!! note "Technical Details"
You could also use `from starlette.responses import HTMLResponse`.
**FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
### `Response`
The main `Response` class, all the other responses inherit from it.
You can return it directly.
It accepts the following parameters:
* `content` - A `str` or `bytes`.
* `status_code` - An `int` HTTP status code.
* `headers` - A `dict` of strings.
* `media_type` - A `str` giving the media type. E.g. `"text/html"`.
FastAPI (actually Starlette) will automatically include a Content-Length header. It will also include a Content-Type header, based on the media_type and appending a charset for text types.
```Python hl_lines="1 18"
{!../../../docs_src/response_directly/tutorial002.py!}
```
### `HTMLResponse`
Takes some text or bytes and returns an HTML response, as you read above.
### `PlainTextResponse`
Takes some text or bytes and returns an plain text response.
```Python hl_lines="2 7 9"
{!../../../docs_src/custom_response/tutorial005.py!}
```
### `JSONResponse`
Takes some data and returns an `application/json` encoded response.
This is the default response used in **FastAPI**, as you read above.
### `ORJSONResponse`
A fast alternative JSON response using <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a>, as you read above.
### `UJSONResponse`
An alternative JSON response using <a href="https://github.com/ultrajson/ultrajson" class="external-link" target="_blank">`ujson`</a>.
!!! warning
`ujson` is less careful than Python's built-in implementation in how it handles some edge-cases.
```Python hl_lines="2 7"
{!../../../docs_src/custom_response/tutorial001.py!}
```
!!! tip
It's possible that `ORJSONResponse` might be a faster alternative.
### `RedirectResponse`
Returns an HTTP redirect. Uses a 307 status code (Temporary Redirect) by default.
You can return a `RedirectResponse` directly:
```Python hl_lines="2 9"
{!../../../docs_src/custom_response/tutorial006.py!}
```
---
Or you can use it in the `response_class` parameter:
```Python hl_lines="2 7 9"
{!../../../docs_src/custom_response/tutorial006b.py!}
```
If you do that, then you can return the URL directly from your *path operation* function.
In this case, the `status_code` used will be the default one for the `RedirectResponse`, which is `307`.
---
You can also use the `status_code` parameter combined with the `response_class` parameter:
```Python hl_lines="2 7 9"
{!../../../docs_src/custom_response/tutorial006c.py!}
```
### `StreamingResponse`
Takes an async generator or a normal generator/iterator and streams the response body.
```Python hl_lines="2 14"
{!../../../docs_src/custom_response/tutorial007.py!}
```
#### Using `StreamingResponse` with file-like objects
If you have a file-like object (e.g. the object returned by `open()`), you can create a generator function to iterate over that file-like object.
That way, you don't have to read it all first in memory, and you can pass that generator function to the `StreamingResponse`, and return it.
This includes many libraries to interact with cloud storage, video processing, and others.
```{ .python .annotate hl_lines="2 10-12 14" }
{!../../../docs_src/custom_response/tutorial008.py!}
```
1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
2. By using a `with` block, we make sure that the file-like object is closed after the generator function is done. So, after it finishes sending the response.
3. This `yield from` tells the function to iterate over that thing named `file_like`. And then, for each part iterated, yield that part as coming from this generator function.
So, it is a generator function that transfers the "generating" work to something else internally.
By doing it this way, we can put it in a `with` block, and that way, ensure that it is closed after finishing.
!!! tip
Notice that here as we are using standard `open()` that doesn't support `async` and `await`, we declare the path operation with normal `def`.
### `FileResponse`
Asynchronously streams a file as the response.
Takes a different set of arguments to instantiate than the other response types:
* `path` - The filepath to the file to stream.
* `headers` - Any custom headers to include, as a dictionary.
* `media_type` - A string giving the media type. If unset, the filename or path will be used to infer a media type.
* `filename` - If set, this will be included in the response `Content-Disposition`.
File responses will include appropriate `Content-Length`, `Last-Modified` and `ETag` headers.
```Python hl_lines="2 10"
{!../../../docs_src/custom_response/tutorial009.py!}
```
You can also use the `response_class` parameter:
```Python hl_lines="2 8 10"
{!../../../docs_src/custom_response/tutorial009b.py!}
```
In this case, you can return the file path directly from your *path operation* function.
## Default response class
When creating a **FastAPI** class instance or an `APIRouter` you can specify which response class to use by default.
The parameter that defines this is `default_response_class`.
In the example below, **FastAPI** will use `ORJSONResponse` by default, in all *path operations*, instead of `JSONResponse`.
```Python hl_lines="2 4"
{!../../../docs_src/custom_response/tutorial010.py!}
```
!!! tip
You can still override `response_class` in *path operations* as before.
## Additional documentation
You can also declare the media type and many other details in OpenAPI using `responses`: [Additional Responses in OpenAPI](additional-responses.md){.internal-link target=_blank}.

View File

@@ -0,0 +1,47 @@
# Events: startup - shutdown
You can define event handlers (functions) that need to be executed before the application starts up, or when the application is shutting down.
These functions can be declared with `async def` or normal `def`.
!!! warning
Only event handlers for the main application will be executed, not for [Sub Applications - Mounts](./sub-applications.md){.internal-link target=_blank}.
## `startup` event
To add a function that should be run before the application starts, declare it with the event `"startup"`:
```Python hl_lines="8"
{!../../../docs_src/events/tutorial001.py!}
```
In this case, the `startup` event handler function will initialize the items "database" (just a `dict`) with some values.
You can add more than one event handler function.
And your application won't start receiving requests until all the `startup` event handlers have completed.
## `shutdown` event
To add a function that should be run when the application is shutting down, declare it with the event `"shutdown"`:
```Python hl_lines="6"
{!../../../docs_src/events/tutorial002.py!}
```
Here, the `shutdown` event handler function will write a text line `"Application shutdown"` to a file `log.txt`.
!!! info
In the `open()` function, the `mode="a"` means "append", so, the line will be added after whatever is on that file, without overwriting the previous contents.
!!! tip
Notice that in this case we are using a standard Python `open()` function that interacts with a file.
So, it involves I/O (input/output), that requires "waiting" for things to be written to disk.
But `open()` doesn't use `async` and `await`.
So, we declare the event handler function with standard `def` instead of `async def`.
!!! info
You can read more about these event handlers in <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette's Events' docs</a>.

View File

@@ -0,0 +1,250 @@
# Extending OpenAPI
!!! warning
This is a rather advanced feature. You probably can skip it.
If you are just following the tutorial - user guide, you can probably skip this section.
If you already know that you need to modify the generated OpenAPI schema, continue reading.
There are some cases where you might need to modify the generated OpenAPI schema.
In this section you will see how.
## The normal process
The normal (default) process, is as follows.
A `FastAPI` application (instance) has an `.openapi()` method that is expected to return the OpenAPI schema.
As part of the application object creation, a *path operation* for `/openapi.json` (or for whatever you set your `openapi_url`) is registered.
It just returns a JSON response with the result of the application's `.openapi()` method.
By default, what the method `.openapi()` does is check the property `.openapi_schema` to see if it has contents and return them.
If it doesn't, it generates them using the utility function at `fastapi.openapi.utils.get_openapi`.
And that function `get_openapi()` receives as parameters:
* `title`: The OpenAPI title, shown in the docs.
* `version`: The version of your API, e.g. `2.5.0`.
* `openapi_version`: The version of the OpenAPI specification used. By default, the latest: `3.0.2`.
* `description`: The description of your API.
* `routes`: A list of routes, these are each of the registered *path operations*. They are taken from `app.routes`.
## Overriding the defaults
Using the information above, you can use the same utility function to generate the OpenAPI schema and override each part that you need.
For example, let's add <a href="https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md#x-logo" class="external-link" target="_blank">ReDoc's OpenAPI extension to include a custom logo</a>.
### Normal **FastAPI**
First, write all your **FastAPI** application as normally:
```Python hl_lines="1 4 7-9"
{!../../../docs_src/extending_openapi/tutorial001.py!}
```
### Generate the OpenAPI schema
Then, use the same utility function to generate the OpenAPI schema, inside a `custom_openapi()` function:
```Python hl_lines="2 15-20"
{!../../../docs_src/extending_openapi/tutorial001.py!}
```
### Modify the OpenAPI schema
Now you can add the ReDoc extension, adding a custom `x-logo` to the `info` "object" in the OpenAPI schema:
```Python hl_lines="21-23"
{!../../../docs_src/extending_openapi/tutorial001.py!}
```
### Cache the OpenAPI schema
You can use the property `.openapi_schema` as a "cache", to store your generated schema.
That way, your application won't have to generate the schema every time a user opens your API docs.
It will be generated only once, and then the same cached schema will be used for the next requests.
```Python hl_lines="13-14 24-25"
{!../../../docs_src/extending_openapi/tutorial001.py!}
```
### Override the method
Now you can replace the `.openapi()` method with your new function.
```Python hl_lines="28"
{!../../../docs_src/extending_openapi/tutorial001.py!}
```
### Check it
Once you go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a> you will see that you are using your custom logo (in this example, **FastAPI**'s logo):
<img src="/img/tutorial/extending-openapi/image01.png">
## Self-hosting JavaScript and CSS for docs
The API docs use **Swagger UI** and **ReDoc**, and each of those need some JavaScript and CSS files.
By default, those files are served from a <abbr title="Content Delivery Network: A service, normally composed of several servers, that provides static files, like JavaScript and CSS. It's commonly used to serve those files from the server closer to the client, improving performance.">CDN</abbr>.
But it's possible to customize it, you can set a specific CDN, or serve the files yourself.
That's useful, for example, if you need your app to keep working even while offline, without open Internet access, or in a local network.
Here you'll see how to serve those files yourself, in the same FastAPI app, and configure the docs to use them.
### Project file structure
Let's say your project file structure looks like this:
```
.
├── app
│ ├── __init__.py
│ ├── main.py
```
Now create a directory to store those static files.
Your new file structure could look like this:
```
.
├── app
│   ├── __init__.py
│   ├── main.py
└── static/
```
### Download the files
Download the static files needed for the docs and put them on that `static/` directory.
You can probably right-click each link and select an option similar to `Save link as...`.
**Swagger UI** uses the files:
* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js" class="external-link" target="_blank">`swagger-ui-bundle.js`</a>
* <a href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui.css" class="external-link" target="_blank">`swagger-ui.css`</a>
And **ReDoc** uses the file:
* <a href="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
After that, your file structure could look like:
```
.
├── app
│   ├── __init__.py
│   ├── main.py
└── static
├── redoc.standalone.js
├── swagger-ui-bundle.js
└── swagger-ui.css
```
### Install `aiofiles`
Now you need to install `aiofiles`:
<div class="termy">
```console
$ pip install aiofiles
---> 100%
```
</div>
### Serve the static files
* Import `StaticFiles`.
* "Mount" a `StaticFiles()` instance in a specific path.
```Python hl_lines="7 11"
{!../../../docs_src/extending_openapi/tutorial002.py!}
```
### Test the static files
Start your application and go to <a href="http://127.0.0.1:8000/static/redoc.standalone.js" class="external-link" target="_blank">http://127.0.0.1:8000/static/redoc.standalone.js</a>.
You should see a very long JavaScript file for **ReDoc**.
It could start with something like:
```JavaScript
/*!
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
* -------------------------------------------------------------
* Version: "2.0.0-rc.18"
* Repo: https://github.com/Redocly/redoc
*/
!function(e,t){"object"==typeof exports&&"object"==typeof m
...
```
That confirms that you are being able to serve static files from your app, and that you placed the static files for the docs in the correct place.
Now we can configure the app to use those static files for the docs.
### Disable the automatic docs
The first step is to disable the automatic docs, as those use the CDN by default.
To disable them, set their URLs to `None` when creating your `FastAPI` app:
```Python hl_lines="9"
{!../../../docs_src/extending_openapi/tutorial002.py!}
```
### Include the custom docs
Now you can create the *path operations* for the custom docs.
You can re-use FastAPI's internal functions to create the HTML pages for the docs, and pass them the needed arguments:
* `openapi_url`: the URL where the HTML page for the docs can get the OpenAPI schema for your API. You can use here the attribute `app.openapi_url`.
* `title`: the title of your API.
* `oauth2_redirect_url`: you can use `app.swagger_ui_oauth2_redirect_url` here to use the default.
* `swagger_js_url`: the URL where the HTML for your Swagger UI docs can get the **JavaScript** file. This is the one that your own app is now serving.
* `swagger_css_url`: the URL where the HTML for your Swagger UI docs can get the **CSS** file. This is the one that your own app is now serving.
And similarly for ReDoc...
```Python hl_lines="2-6 14-22 25-27 30-36"
{!../../../docs_src/extending_openapi/tutorial002.py!}
```
!!! tip
The *path operation* for `swagger_ui_redirect` is a helper for when you use OAuth2.
If you integrate your API with an OAuth2 provider, you will be able to authenticate and come back to the API docs with the acquired credentials. And interact with it using the real OAuth2 authentication.
Swagger UI will handle it behind the scenes for you, but it needs this "redirect" helper.
### Create a *path operation* to test it
Now, to be able to test that everything works, create a *path operation*:
```Python hl_lines="39-41"
{!../../../docs_src/extending_openapi/tutorial002.py!}
```
### Test it
Now, you should be able to disconnect your WiFi, go to your docs at <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>, and reload the page.
And even without Internet, you would be able to see the docs for your API and interact with it.

View File

@@ -0,0 +1,44 @@
# GraphQL
**FastAPI** has optional support for GraphQL (provided by Starlette directly), using the `graphene` library.
You can combine normal FastAPI *path operations* with GraphQL on the same application.
## Import and use `graphene`
GraphQL is implemented with Graphene, you can check <a href="https://docs.graphene-python.org/en/latest/quickstart/" class="external-link" target="_blank">Graphene's docs</a> for more details.
Import `graphene` and define your GraphQL data:
```Python hl_lines="1 6-10"
{!../../../docs_src/graphql/tutorial001.py!}
```
## Add Starlette's `GraphQLApp`
Then import and add Starlette's `GraphQLApp`:
```Python hl_lines="3 14"
{!../../../docs_src/graphql/tutorial001.py!}
```
!!! info
Here we are using `.add_route`, that is the way to add a route in Starlette (inherited by FastAPI) without declaring the specific operation (as would be with `.get()`, `.post()`, etc).
## Check it
Run it with Uvicorn and open your browser at <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000</a>.
You will see GraphiQL web user interface:
<img src="/img/tutorial/graphql/image01.png">
## More details
For more details, including:
* Accessing request information
* Adding background tasks
* Using normal or async functions
check the official <a href="https://www.starlette.io/graphql/" class="external-link" target="_blank">Starlette GraphQL docs</a>.

View File

@@ -0,0 +1,24 @@
# Advanced User Guide - Intro
## Additional Features
The main [Tutorial - User Guide](../tutorial/){.internal-link target=_blank} should be enough to give you a tour through all the main features of **FastAPI**.
In the next sections you will see other options, configurations, and additional features.
!!! tip
The next sections are **not necessarily "advanced"**.
And it's possible that for your use case, the solution is in one of them.
## Read the Tutorial first
You could still use most of the features in **FastAPI** with the knowledge from the main [Tutorial - User Guide](../tutorial/){.internal-link target=_blank}.
And the next sections assume you already read it, and assume that you know those main ideas.
## TestDriven.io course
If you would like to take an advanced-beginner course to complement this section of the docs, you might want to check: <a href="https://testdriven.io/courses/tdd-fastapi/" class="external-link" target="_blank">Test-Driven Development with FastAPI and Docker</a> by **TestDriven.io**.
They are currently donating 10% of all profits to the development of **FastAPI**. 🎉 😄

View File

@@ -0,0 +1,99 @@
# Advanced Middleware
In the main tutorial you read how to add [Custom Middleware](../tutorial/middleware.md){.internal-link target=_blank} to your application.
And then you also read how to handle [CORS with the `CORSMiddleware`](../tutorial/cors.md){.internal-link target=_blank}.
In this section we'll see how to use other middlewares.
## Adding ASGI middlewares
As **FastAPI** is based on Starlette and implements the <abbr title="Asynchronous Server Gateway Interface">ASGI</abbr> specification, you can use any ASGI middleware.
A middleware doesn't have to be made for FastAPI or Starlette to work, as long as it follows the ASGI spec.
In general, ASGI middlewares are classes that expect to receive an ASGI app as the first argument.
So, in the documentation for third-party ASGI middlewares they will probably tell you to do something like:
```Python
from unicorn import UnicornMiddleware
app = SomeASGIApp()
new_app = UnicornMiddleware(app, some_config="rainbow")
```
But FastAPI (actually Starlette) provides a simpler way to do it that makes sure that the internal middlewares to handle server errors and custom exception handlers work properly.
For that, you use `app.add_middleware()` (as in the example for CORS).
```Python
from fastapi import FastAPI
from unicorn import UnicornMiddleware
app = FastAPI()
app.add_middleware(UnicornMiddleware, some_config="rainbow")
```
`app.add_middleware()` receives a middleware class as the first argument and any additional arguments to be passed to the middleware.
## Integrated middlewares
**FastAPI** includes several middlewares for common use cases, we'll see next how to use them.
!!! note "Technical Details"
For the next examples, you could also use `from starlette.middleware.something import SomethingMiddleware`.
**FastAPI** provides several middlewares in `fastapi.middleware` just as a convenience for you, the developer. But most of the available middlewares come directly from Starlette.
## `HTTPSRedirectMiddleware`
Enforces that all incoming requests must either be `https` or `wss`.
Any incoming requests to `http` or `ws` will be redirected to the secure scheme instead.
```Python hl_lines="2 6"
{!../../../docs_src/advanced_middleware/tutorial001.py!}
```
## `TrustedHostMiddleware`
Enforces that all incoming requests have a correctly set `Host` header, in order to guard against HTTP Host Header attacks.
```Python hl_lines="2 6-8"
{!../../../docs_src/advanced_middleware/tutorial002.py!}
```
The following arguments are supported:
* `allowed_hosts` - A list of domain names that should be allowed as hostnames. Wildcard domains such as `*.example.com` are supported for matching subdomains to allow any hostname either use `allowed_hosts=["*"]` or omit the middleware.
If an incoming request does not validate correctly then a `400` response will be sent.
## `GZipMiddleware`
Handles GZip responses for any request that includes `"gzip"` in the `Accept-Encoding` header.
The middleware will handle both standard and streaming responses.
```Python hl_lines="2 6"
{!../../../docs_src/advanced_middleware/tutorial003.py!}
```
The following arguments are supported:
* `minimum_size` - Do not GZip responses that are smaller than this minimum size in bytes. Defaults to `500`.
## Other middlewares
There are many other ASGI middlewares.
For example:
* <a href="https://docs.sentry.io/platforms/python/asgi/" class="external-link" target="_blank">Sentry</a>
* <a href="https://github.com/encode/uvicorn/blob/master/uvicorn/middleware/proxy_headers.py" class="external-link" target="_blank">Uvicorn's `ProxyHeadersMiddleware`</a>
* <a href="https://github.com/florimondmanca/msgpack-asgi" class="external-link" target="_blank">MessagePack</a>
To see other available middlewares check <a href="https://www.starlette.io/middleware/" class="external-link" target="_blank">Starlette's Middleware docs</a> and the <a href="https://github.com/florimondmanca/awesome-asgi" class="external-link" target="_blank">ASGI Awesome List</a>.

View File

@@ -1,6 +1,8 @@
# NoSQL (Distributed / Big Data) Databases
**FastAPI** can also be integrated with any <abbr title="Distributed database (Big Data), also 'Not Only SQL'">NoSQL</abbr>.
Here we'll see an example using **<a href="https://www.couchbase.com/" target="_blank">Couchbase</a>**, a <abbr title="Document here refers to a JSON object (a dict), with keys and values, and those values can also be other JSON objects, arrays (lists), numbers, strings, booleans, etc.">document</abbr> based NoSQL database.
Here we'll see an example using **<a href="https://www.couchbase.com/" class="external-link" target="_blank">Couchbase</a>**, a <abbr title="Document here refers to a JSON object (a dict), with keys and values, and those values can also be other JSON objects, arrays (lists), numbers, strings, booleans, etc.">document</abbr> based NoSQL database.
You can adapt it to any other NoSQL database like:
@@ -11,14 +13,14 @@ You can adapt it to any other NoSQL database like:
* **ElasticSearch**, etc.
!!! tip
There is an official project generator with **FastAPI** and **Couchbase**, all based on **Docker**, including a frontend and more tools: <a href="https://github.com/tiangolo/full-stack-fastapi-couchbase" target="_blank">https://github.com/tiangolo/full-stack-fastapi-couchbase</a>
There is an official project generator with **FastAPI** and **Couchbase**, all based on **Docker**, including a frontend and more tools: <a href="https://github.com/tiangolo/full-stack-fastapi-couchbase" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-fastapi-couchbase</a>
## Import Couchbase components
For now, don't pay attention to the rest, only the imports:
```Python hl_lines="6 7 8"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="3-5"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
## Define a constant to use as a "document type"
@@ -27,8 +29,8 @@ We will use it later as a fixed field `type` in our documents.
This is not required by Couchbase, but is a good practice that will help you afterwards.
```Python hl_lines="10"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="9"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
## Add a function to get a `Bucket`
@@ -52,8 +54,8 @@ This utility function will:
* Set defaults for timeouts.
* Return it.
```Python hl_lines="13 14 15 16 17 18 19 20 21 22"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="12-21"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
## Create Pydantic models
@@ -64,11 +66,11 @@ As **Couchbase** "documents" are actually just "JSON objects", we can model them
First, let's create a `User` model:
```Python hl_lines="25 26 27 28 29"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="24-28"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
We will use this model in our path operation function, so, we don't include in it the `hashed_password`.
We will use this model in our *path operation function*, so, we don't include in it the `hashed_password`.
### `UserInDB` model
@@ -78,15 +80,14 @@ This will have the data that is actually stored in the database.
We don't create it as a subclass of Pydantic's `BaseModel` but as a subclass of our own `User`, because it will have all the attributes in `User` plus a couple more:
```Python hl_lines="32 33 34"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="31-33"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
!!! note
Notice that we have a `hashed_password` and a `type` field that will be stored in the database.
But it is not part of the general `User` model (the one we will return in the path operation).
But it is not part of the general `User` model (the one we will return in the *path operation*).
## Get the user
@@ -97,21 +98,21 @@ Now create a function that will:
* Get the document with that ID.
* Put the contents of the document in a `UserInDB` model.
By creating a function that is only dedicated to getting your user from a `username` (or any other parameter) independent of your path operation function, you can more easily re-use it in multiple parts and also add <abbr title="Automated test, written in code, that checks if another piece of code is working correctly.">unit tests</abbr> for it:
By creating a function that is only dedicated to getting your user from a `username` (or any other parameter) independent of your *path operation function*, you can more easily re-use it in multiple parts and also add <abbr title="Automated test, written in code, that checks if another piece of code is working correctly.">unit tests</abbr> for it:
```Python hl_lines="37 38 39 40 41 42 43"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="36-42"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
### f-strings
If you are not familiar with the `f"userprofile::{username}"`, it is a Python "<a href="https://docs.python.org/3/glossary.html#term-f-string" target="_blank">f-string</a>".
If you are not familiar with the `f"userprofile::{username}"`, it is a Python "<a href="https://docs.python.org/3/glossary.html#term-f-string" class="external-link" target="_blank">f-string</a>".
Any variable that is put inside of `{}` in an f-string will be expanded / injected in the string.
### `dict` unpacking
If you are not familiar with the `UserInDB(**result.value)`, <a href="https://docs.python.org/3/glossary.html#term-argument" target="_blank">it is using `dict` "unpacking"</a>.
If you are not familiar with the `UserInDB(**result.value)`, <a href="https://docs.python.org/3/glossary.html#term-argument" class="external-link" target="_blank">it is using `dict` "unpacking"</a>.
It will take the `dict` at `result.value`, and take each of its keys and values and pass them as key-values to `UserInDB` as keyword arguments.
@@ -134,18 +135,18 @@ UserInDB(username="johndoe", hashed_password="some_hash")
### Create the `FastAPI` app
```Python hl_lines="47"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="46"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
### Create the path operation function
### Create the *path operation function*
As our code is calling Couchbase and we are not using the <a href="https://docs.couchbase.com/python-sdk/2.5/async-programming.html#asyncio-python-3-5" target="_blank">experimental Python <code>await</code> support</a>, we should declare our function with normal `def` instead of `async def`.
As our code is calling Couchbase and we are not using the <a href="https://docs.couchbase.com/python-sdk/2.5/async-programming.html#asyncio-python-3-5" class="external-link" target="_blank">experimental Python <code>await</code> support</a>, we should declare our function with normal `def` instead of `async def`.
Also, Couchbase recommends not using a single `Bucket` object in multiple "<abbr title="A sequence of code being executed by the program, while at the same time, or at intervals, there can be others being executed too.">thread</abbr>s", so, we can get just get the bucket directly and pass it to our utility functions:
Also, Couchbase recommends not using a single `Bucket` object in multiple "<abbr title="A sequence of code being executed by the program, while at the same time, or at intervals, there can be others being executed too.">thread</abbr>s", so, we can just get the bucket directly and pass it to our utility functions:
```Python hl_lines="50 51 52 53 54"
{!./src/nosql_databases/tutorial001.py!}
```Python hl_lines="49-53"
{!../../../docs_src/nosql_databases/tutorial001.py!}
```
## Recap

View File

@@ -0,0 +1,179 @@
# OpenAPI Callbacks
You could create an API with a *path operation* that could trigger a request to an *external API* created by someone else (probably the same developer that would be *using* your API).
The process that happens when your API app calls the *external API* is named a "callback". Because the software that the external developer wrote sends a request to your API and then your API *calls back*, sending a request to an *external API* (that was probably created by the same developer).
In this case, you could want to document how that external API *should* look like. What *path operation* it should have, what body it should expect, what response it should return, etc.
## An app with callbacks
Let's see all this with an example.
Imagine you develop an app that allows creating invoices.
These invoices will have an `id`, `title` (optional), `customer`, and `total`.
The user of your API (an external developer) will create an invoice in your API with a POST request.
Then your API will (let's imagine):
* Send the invoice to some customer of the external developer.
* Collect the money.
* Send a notification back to the API user (the external developer).
* This will be done by sending a POST request (from *your API*) to some *external API* provided by that external developer (this is the "callback").
## The normal **FastAPI** app
Let's first see how the normal API app would look like before adding the callback.
It will have a *path operation* that will receive an `Invoice` body, and a query parameter `callback_url` that will contain the URL for the callback.
This part is pretty normal, most of the code is probably already familiar to you:
```Python hl_lines="10-14 37-54"
{!../../../docs_src/openapi_callbacks/tutorial001.py!}
```
!!! tip
The `callback_url` query parameter uses a Pydantic <a href="https://pydantic-docs.helpmanual.io/usage/types/#urls" class="external-link" target="_blank">URL</a> type.
The only new thing is the `callbacks=messages_callback_router.routes` as an argument to the *path operation decorator*. We'll see what that is next.
## Documenting the callback
The actual callback code will depend heavily on your own API app.
And it will probably vary a lot from one app to the next.
It could be just one or two lines of code, like:
```Python
callback_url = "https://example.com/api/v1/invoices/events/"
requests.post(callback_url, json={"description": "Invoice paid", "paid": True})
```
But possibly the most important part of the callback is making sure that your API user (the external developer) implements the *external API* correctly, according to the data that *your API* is going to send in the request body of the callback, etc.
So, what we will do next is add the code to document how that *external API* should look like to receive the callback from *your API*.
That documentation will show up in the Swagger UI at `/docs` in your API, and it will let external developers know how to build the *external API*.
This example doesn't implement the callback itself (that could be just a line of code), only the documentation part.
!!! tip
The actual callback is just an HTTP request.
When implementing the callback yourself, you could use something like <a href="https://www.encode.io/httpx/" class="external-link" target="_blank">HTTPX</a> or <a href="https://requests.readthedocs.io/" class="external-link" target="_blank">Requests</a>.
## Write the callback documentation code
This code won't be executed in your app, we only need it to *document* how that *external API* should look like.
But, you already know how to easily create automatic documentation for an API with **FastAPI**.
So we are going to use that same knowledge to document how the *external API* should look like... by creating the *path operation(s)* that the external API should implement (the ones your API will call).
!!! tip
When writing the code to document a callback, it might be useful to imagine that you are that *external developer*. And that you are currently implementing the *external API*, not *your API*.
Temporarily adopting this point of view (of the *external developer*) can help you feel like it's more obvious where to put the parameters, the Pydantic model for the body, for the response, etc. for that *external API*.
### Create a callback `APIRouter`
First create a new `APIRouter` that will contain one or more callbacks.
```Python hl_lines="5 26"
{!../../../docs_src/openapi_callbacks/tutorial001.py!}
```
### Create the callback *path operation*
To create the callback *path operation* use the same `APIRouter` you created above.
It should look just like a normal FastAPI *path operation*:
* It should probably have a declaration of the body it should receive, e.g. `body: InvoiceEvent`.
* And it could also have a declaration of the response it should return, e.g. `response_model=InvoiceEventReceived`.
```Python hl_lines="17-19 22-23 29-33"
{!../../../docs_src/openapi_callbacks/tutorial001.py!}
```
There are 2 main differences from a normal *path operation*:
* It doesn't need to have any actual code, because your app will never call this code. It's only used to document the *external API*. So, the function could just have `pass`.
* The *path* can contain an <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#key-expression" class="external-link" target="_blank">OpenAPI 3 expression</a> (see more below) where it can use variables with parameters and parts of the original request sent to *your API*.
### The callback path expression
The callback *path* can have an <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#key-expression" class="external-link" target="_blank">OpenAPI 3 expression</a> that can contain parts of the original request sent to *your API*.
In this case, it's the `str`:
```Python
"{$callback_url}/invoices/{$request.body.id}"
```
So, if your API user (the external developer) sends a request to *your API* to:
```
https://yourapi.com/invoices/?callback_url=https://www.external.org/events
```
with a JSON body of:
```JSON
{
"id": "2expen51ve",
"customer": "Mr. Richie Rich",
"total": "9999"
}
```
Then *your API* will process the invoice, and at some point later, send a callback request to the `callback_url` (the *external API*):
```
https://www.external.org/events/invoices/2expen51ve
```
with a JSON body containing something like:
```JSON
{
"description": "Payment celebration",
"paid": true
}
```
and it would expect a response from that *external API* with a JSON body like:
```JSON
{
"ok": true
}
```
!!! tip
Notice how the callback URL used contains the URL received as a query parameter in `callback_url` (`https://www.external.org/events`) and also the invoice `id` from inside of the JSON body (`2expen51ve`).
### Add the callback router
At this point you have the *callback path operation(s)* needed (the one(s) that the *external developer* should implement in the *external API*) in the callback router you created above.
Now use the parameter `callbacks` in *your API's path operation decorator* to pass the attribute `.routes` (that's actually just a `list` of routes/*path operations*) from that callback router:
```Python hl_lines="36"
{!../../../docs_src/openapi_callbacks/tutorial001.py!}
```
!!! tip
Notice that you are not passing the router itself (`invoices_callback_router`) to `callback=`, but the attribute `.routes`, as in `invoices_callback_router.routes`.
### Check the docs
Now you can start your app with Uvicorn and go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
You will see your docs including a "Callback" section for your *path operation* that shows how the *external API* should look like:
<img src="/img/tutorial/openapi-callbacks/image01.png">

View File

@@ -0,0 +1,52 @@
# Path Operation Advanced Configuration
## OpenAPI operationId
!!! warning
If you are not an "expert" in OpenAPI, you probably don't need this.
You can set the OpenAPI `operationId` to be used in your *path operation* with the parameter `operation_id`.
You would have to make sure that it is unique for each operation.
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### Using the *path operation function* name as the operationId
If you want to use your APIs' function names as `operationId`s, you can iterate over all of them and override each *path operation's* `operation_id` using their `APIRoute.name`.
You should do it after adding all your *path operations*.
```Python hl_lines="2 12-21 24"
{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
!!! tip
If you manually call `app.openapi()`, you should update the `operationId`s before that.
!!! warning
If you do this, you have to make sure each one of your *path operation functions* has a unique name.
Even if they are in different modules (Python files).
## Exclude from OpenAPI
To exclude a *path operation* from the generated OpenAPI schema (and thus, from the automatic documentation systems), use the parameter `include_in_schema` and set it to `False`;
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## Advanced description from docstring
You can limit the lines used from the docstring of a *path operation function* for OpenAPI.
Adding an `\f` (an escaped "form feed" character) causes **FastAPI** to truncate the output used for OpenAPI at this point.
It won't show up in the documentation, but other tools (such as Sphinx) will be able to use the rest.
```Python hl_lines="19-29"
{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```

View File

@@ -0,0 +1,33 @@
# Response - Change Status Code
You probably read before that you can set a default [Response Status Code](../tutorial/response-status-code.md){.internal-link target=_blank}.
But in some cases you need to return a different status code than the default.
## Use case
For example, imagine that you want to return an HTTP status code of "OK" `200` by default.
But if the data didn't exist, you want to create it, and return an HTTP status code of "CREATED" `201`.
But you still want to be able to filter and convert the data you return with a `response_model`.
For those cases, you can use a `Response` parameter.
## Use a `Response` parameter
You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies and headers).
And then you can set the `status_code` in that *temporal* response object.
```Python hl_lines="1 9 12"
{!../../../docs_src/response_change_status_code/tutorial001.py!}
```
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
And if you declared a `response_model`, it will still be used to filter and convert the object you returned.
**FastAPI** will use that *temporal* response to extract the status code (also cookies and headers), and will put them in the final response that contains the value you returned, filtered by any `response_model`.
You can also declare the `Response` parameter in dependencies, and set the status code in them. But have in mind that the last one to be set will win.

View File

@@ -0,0 +1,49 @@
# Response Cookies
## Use a `Response` parameter
You can declare a parameter of type `Response` in your *path operation function*.
And then you can set cookies in that *temporal* response object.
```Python hl_lines="1 8-9"
{!../../../docs_src/response_cookies/tutorial002.py!}
```
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
And if you declared a `response_model`, it will still be used to filter and convert the object you returned.
**FastAPI** will use that *temporal* response to extract the cookies (also headers and status code), and will put them in the final response that contains the value you returned, filtered by any `response_model`.
You can also declare the `Response` parameter in dependencies, and set cookies (and headers) in them.
## Return a `Response` directly
You can also create cookies when returning a `Response` directly in your code.
To do that, you can create a response as described in [Return a Response Directly](response-directly.md){.internal-link target=_blank}.
Then set Cookies in it, and then return it:
```Python hl_lines="10-12"
{!../../../docs_src/response_cookies/tutorial001.py!}
```
!!! tip
Have in mind that if you return a response directly instead of using the `Response` parameter, FastAPI will return it directly.
So, you will have to make sure your data is of the correct type. E.g. it is compatible with JSON, if you are returning a `JSONResponse`.
And also that you are not sending any data that should have been filtered by a `response_model`.
### More info
!!! note "Technical Details"
You could also use `from starlette.responses import Response` or `from starlette.responses import JSONResponse`.
**FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
And as the `Response` can be used frequently to set headers and cookies, **FastAPI** also provides it at `fastapi.Response`.
To see all the available parameters and options, check the <a href="https://www.starlette.io/responses/#set-cookie" class="external-link" target="_blank">documentation in Starlette</a>.

View File

@@ -0,0 +1,63 @@
# Return a Response Directly
When you create a **FastAPI** *path operation* you can normally return any data from it: a `dict`, a `list`, a Pydantic model, a database model, etc.
By default, **FastAPI** would automatically convert that return value to JSON using the `jsonable_encoder` explained in [JSON Compatible Encoder](../tutorial/encoder.md){.internal-link target=_blank}.
Then, behind the scenes, it would put that JSON-compatible data (e.g. a `dict`) inside of a `JSONResponse` that would be used to send the response to the client.
But you can return a `JSONResponse` directly from your *path operations*.
It might be useful, for example, to return custom headers or cookies.
## Return a `Response`
In fact, you can return any `Response` or any sub-class of it.
!!! tip
`JSONResponse` itself is a sub-class of `Response`.
And when you return a `Response`, **FastAPI** will pass it directly.
It won't do any data conversion with Pydantic models, it won't convert the contents to any type, etc.
This gives you a lot of flexibility. You can return any data type, override any data declaration or validation, etc.
## Using the `jsonable_encoder` in a `Response`
Because **FastAPI** doesn't do any change to a `Response` you return, you have to make sure it's contents are ready for it.
For example, you cannot put a Pydantic model in a `JSONResponse` without first converting it to a `dict` with all the data types (like `datetime`, `UUID`, etc) converted to JSON-compatible types.
For those cases, you can use the `jsonable_encoder` to convert your data before passing it to a response:
```Python hl_lines="6-7 21-22"
{!../../../docs_src/response_directly/tutorial001.py!}
```
!!! note "Technical Details"
You could also use `from starlette.responses import JSONResponse`.
**FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
## Returning a custom `Response`
The example above shows all the parts you need, but it's not very useful yet, as you could have just returned the `item` directly, and **FastAPI** would put it in a `JSONResponse` for you, converting it to a `dict`, etc. All that by default.
Now, let's see how you could use that to return a custom response.
Let's say that you want to return an <a href="https://en.wikipedia.org/wiki/XML" class="external-link" target="_blank">XML</a> response.
You could put your XML content in a string, put it in a `Response`, and return it:
```Python hl_lines="1 18"
{!../../../docs_src/response_directly/tutorial002.py!}
```
## Notes
When you return a `Response` directly its data is not validated, converted (serialized), nor documented automatically.
But you can still document it as described in [Additional Responses in OpenAPI](additional-responses.md){.internal-link target=_blank}.
You can see in later sections how to use/declare these custom `Response`s while still having automatic data conversion, documentation, etc.

View File

@@ -0,0 +1,42 @@
# Response Headers
## Use a `Response` parameter
You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies).
And then you can set headers in that *temporal* response object.
```Python hl_lines="1 7-8"
{!../../../docs_src/response_headers/tutorial002.py!}
```
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
And if you declared a `response_model`, it will still be used to filter and convert the object you returned.
**FastAPI** will use that *temporal* response to extract the headers (also cookies and status code), and will put them in the final response that contains the value you returned, filtered by any `response_model`.
You can also declare the `Response` parameter in dependencies, and set headers (and cookies) in them.
## Return a `Response` directly
You can also add headers when you return a `Response` directly.
Create a response as described in [Return a Response Directly](response-directly.md){.internal-link target=_blank} and pass the headers as an additional parameter:
```Python hl_lines="10-12"
{!../../../docs_src/response_headers/tutorial001.py!}
```
!!! note "Technical Details"
You could also use `from starlette.responses import Response` or `from starlette.responses import JSONResponse`.
**FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
And as the `Response` can be used frequently to set headers and cookies, **FastAPI** also provides it at `fastapi.Response`.
## Custom Headers
Have in mind that custom proprietary headers can be added <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">using the 'X-' prefix</a>.
But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your CORS configurations (read more in [CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}), using the parameter `expose_headers` documented in <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette's CORS docs</a>.

View File

@@ -0,0 +1,107 @@
# HTTP Basic Auth
For the simplest cases, you can use HTTP Basic Auth.
In HTTP Basic Auth, the application expects a header that contains a username and a password.
If it doesn't receive it, it returns an HTTP 401 "Unauthorized" error.
And returns a header `WWW-Authenticate` with a value of `Basic`, and an optional `realm` parameter.
That tells the browser to show the integrated prompt for a username and password.
Then, when you type that username and password, the browser sends them in the header automatically.
## Simple HTTP Basic Auth
* Import `HTTPBasic` and `HTTPBasicCredentials`.
* Create a "`security` scheme" using `HTTPBasic`.
* Use that `security` with a dependency in your *path operation*.
* It returns an object of type `HTTPBasicCredentials`:
* It contains the `username` and `password` sent.
```Python hl_lines="2 6 10"
{!../../../docs_src/security/tutorial006.py!}
```
When you try to open the URL for the first time (or click the "Execute" button in the docs) the browser will ask you for your username and password:
<img src="/img/tutorial/security/image12.png">
## Check the username
Here's a more complete example.
Use a dependency to check if the username and password are correct.
For this, use the Python standard module <a href="https://docs.python.org/3/library/secrets.html" class="external-link" target="_blank">`secrets`</a> to check the username and password:
```Python hl_lines="1 11-13"
{!../../../docs_src/security/tutorial007.py!}
```
This will ensure that `credentials.username` is `"stanleyjobson"`, and that `credentials.password` is `"swordfish"`. This would be similar to:
```Python
if not (credentials.username == "stanleyjobson") or not (credentials.password == "swordfish"):
# Return some error
...
```
But by using the `secrets.compare_digest()` it will be secure against a type of attacks called "timing attacks".
### Timing Attacks
But what's a "timing attack"?
Let's imagine some attackers are trying to guess the username and password.
And they send a request with a username `johndoe` and a password `love123`.
Then the Python code in your application would be equivalent to something like:
```Python
if "johndoe" == "stanleyjobson" and "love123" == "swordfish":
...
```
But right at the moment Python compares the first `j` in `johndoe` to the first `s` in `stanleyjobson`, it will return `False`, because it already knows that those two strings are not the same, thinking that "there's no need to waste more computation comparing the rest of the letters". And your application will say "incorrect user or password".
But then the attackers try with username `stanleyjobsox` and password `love123`.
And your application code does something like:
```Python
if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
...
```
Python will have to compare the whole `stanleyjobso` in both `stanleyjobsox` and `stanleyjobson` before realizing that both strings are not the same. So it will take some extra microseconds to reply back "incorrect user or password".
#### The time to answer helps the attackers
At that point, by noticing that the server took some microseconds longer to send the "incorrect user or password" response, the attackers will know that they got _something_ right, some of the initial letters were right.
And then they can try again knowing that it's probably something more similar to `stanleyjobsox` than to `johndoe`.
#### A "professional" attack
Of course, the attackers would not try all this by hand, they would write a program to do it, possibly with thousands or millions of tests per second. And would get just one extra correct letter at a time.
But doing that, in some minutes or hours the attackers would have guessed the correct username and password, with the "help" of our application, just using the time taken to answer.
#### Fix it with `secrets.compare_digest()`
But in our code we are actually using `secrets.compare_digest()`.
In short, it will take the same time to compare `stanleyjobsox` to `stanleyjobson` than it takes to compare `johndoe` to `stanleyjobson`. And the same for the password.
That way, using `secrets.compare_digest()` in your application code, it will be safe against this whole range of security attacks.
### Return the error
After detecting that the credentials are incorrect, return an `HTTPException` with a status code 401 (the same returned when no credentials are provided) and add the header `WWW-Authenticate` to make the browser show the login prompt again:
```Python hl_lines="15-19"
{!../../../docs_src/security/tutorial007.py!}
```

View File

@@ -0,0 +1,16 @@
# Advanced Security - Intro
## Additional Features
There are some extra features to handle security apart from the ones covered in the [Tutorial - User Guide: Security](../../tutorial/security/){.internal-link target=_blank}.
!!! tip
The next sections are **not necessarily "advanced"**.
And it's possible that for your use case, the solution is in one of them.
## Read the Tutorial first
The next sections assume you already read the main [Tutorial - User Guide: Security](../../tutorial/security/){.internal-link target=_blank}.
They are all based on the same concepts, but allow some extra functionalities.

View File

@@ -0,0 +1,269 @@
# OAuth2 scopes
You can use OAuth2 scopes directly with **FastAPI**, they are integrated to work seamlessly.
This would allow you to have a more fine-grained permission system, following the OAuth2 standard, integrated into your OpenAPI application (and the API docs).
OAuth2 with scopes is the mechanism used by many big authentication providers, like Facebook, Google, GitHub, Microsoft, Twitter, etc. They use it to provide specific permissions to users and applications.
Every time you "log in with" Facebook, Google, GitHub, Microsoft, Twitter, that application is using OAuth2 with scopes.
In this section you will see how to manage authentication and authorization with the same OAuth2 with scopes in your **FastAPI** application.
!!! warning
This is a more or less advanced section. If you are just starting, you can skip it.
You don't necessarily need OAuth2 scopes, and you can handle authentication and authorization however you want.
But OAuth2 with scopes can be nicely integrated into your API (with OpenAPI) and your API docs.
Nevertheless, you still enforce those scopes, or any other security/authorization requirement, however you need, in your code.
In many cases, OAuth2 with scopes can be an overkill.
But if you know you need it, or you are curious, keep reading.
## OAuth2 scopes and OpenAPI
The OAuth2 specification defines "scopes" as a list of strings separated by spaces.
The content of each of these strings can have any format, but should not contain spaces.
These scopes represent "permissions".
In OpenAPI (e.g. the API docs), you can define "security schemes".
When one of these security schemes uses OAuth2, you can also declare and use scopes.
Each "scope" is just a string (without spaces).
They are normally used to declare specific security permissions, for example:
* `users:read` or `users:write` are common examples.
* `instagram_basic` is used by Facebook / Instagram.
* `https://www.googleapis.com/auth/drive` is used by Google.
!!! info
In OAuth2 a "scope" is just a string that declares a specific permission required.
It doesn't matter if it has other characters like `:` or if it is a URL.
Those details are implementation specific.
For OAuth2 they are just strings.
## Global view
First, let's quickly see the parts that change from the examples in the main **Tutorial - User Guide** for [OAuth2 with Password (and hashing), Bearer with JWT tokens](../../tutorial/security/oauth2-jwt.md){.internal-link target=_blank}. Now using OAuth2 scopes:
```Python hl_lines="2 4 8 12 46 64 105 107-115 121-124 128-134 139 153"
{!../../../docs_src/security/tutorial005.py!}
```
Now let's review those changes step by step.
## OAuth2 Security scheme
The first change is that now we are declaring the OAuth2 security scheme with two available scopes, `me` and `items`.
The `scopes` parameter receives a `dict` with each scope as a key and the description as the value:
```Python hl_lines="62-65"
{!../../../docs_src/security/tutorial005.py!}
```
Because we are now declaring those scopes, they will show up in the API docs when you log-in/authorize.
And you will be able to select which scopes you want to give access to: `me` and `items`.
This is the same mechanism used when you give permissions while logging in with Facebook, Google, GitHub, etc:
<img src="/img/tutorial/security/image11.png">
## JWT token with scopes
Now, modify the token *path operation* to return the scopes requested.
We are still using the same `OAuth2PasswordRequestForm`. It includes a property `scopes` with a `list` of `str`, with each scope it received in the request.
And we return the scopes as part of the JWT token.
!!! danger
For simplicity, here we are just adding the scopes received directly to the token.
But in your application, for security, you should make sure you only add the scopes that the user is actually able to have, or the ones you have predefined.
```Python hl_lines="153"
{!../../../docs_src/security/tutorial005.py!}
```
## Declare scopes in *path operations* and dependencies
Now we declare that the *path operation* for `/users/me/items/` requires the scope `items`.
For this, we import and use `Security` from `fastapi`.
You can use `Security` to declare dependencies (just like `Depends`), but `Security` also receives a parameter `scopes` with a list of scopes (strings).
In this case, we pass a dependency function `get_current_active_user` to `Security` (the same way we would do with `Depends`).
But we also pass a `list` of scopes, in this case with just one scope: `items` (it could have more).
And the dependency function `get_current_active_user` can also declare sub-dependencies, not only with `Depends` but also with `Security`. Declaring its own sub-dependency function (`get_current_user`), and more scope requirements.
In this case, it requires the scope `me` (it could require more than one scope).
!!! note
You don't necessarily need to add different scopes in different places.
We are doing it here to demonstrate how **FastAPI** handles scopes declared at different levels.
```Python hl_lines="4 139 166"
{!../../../docs_src/security/tutorial005.py!}
```
!!! info "Technical Details"
`Security` is actually a subclass of `Depends`, and it has just one extra parameter that we'll see later.
But by using `Security` instead of `Depends`, **FastAPI** will know that it can declare security scopes, use them internally, and document the API with OpenAPI.
But when you import `Query`, `Path`, `Depends`, `Security` and others from `fastapi`, those are actually functions that return special classes.
## Use `SecurityScopes`
Now update the dependency `get_current_user`.
This is the one used by the dependencies above.
Here's were we are using the same OAuth2 scheme we created before, declaring it as a dependency: `oauth2_scheme`.
Because this dependency function doesn't have any scope requirements itself, we can use `Depends` with `oauth2_scheme`, we don't have to use `Security` when we don't need to specify security scopes.
We also declare a special parameter of type `SecurityScopes`, imported from `fastapi.security`.
This `SecurityScopes` class is similar to `Request` (`Request` was used to get the request object directly).
```Python hl_lines="8 105"
{!../../../docs_src/security/tutorial005.py!}
```
## Use the `scopes`
The parameter `security_scopes` will be of type `SecurityScopes`.
It will have a property `scopes` with a list containing all the scopes required by itself and all the dependencies that use this as a sub-dependency. That means, all the "dependants"... this might sound confusing, it is explained again later below.
The `security_scopes` object (of class `SecurityScopes`) also provides a `scope_str` attribute with a single string, containing those scopes separated by spaces (we are going to use it).
We create an `HTTPException` that we can re-use (`raise`) later at several points.
In this exception, we include the scopes required (if any) as a string separated by spaces (using `scope_str`). We put that string containing the scopes in the `WWW-Authenticate` header (this is part of the spec).
```Python hl_lines="105 107-115"
{!../../../docs_src/security/tutorial005.py!}
```
## Verify the `username` and data shape
We verify that we get a `username`, and extract the scopes.
And then we validate that data with the Pydantic model (catching the `ValidationError` exception), and if we get an error reading the JWT token or validating the data with Pydantic, we raise the `HTTPException` we created before.
For that, we update the Pydantic model `TokenData` with a new property `scopes`.
By validating the data with Pydantic we can make sure that we have, for example, exactly a `list` of `str` with the scopes and a `str` with the `username`.
Instead of, for example, a `dict`, or something else, as it could break the application at some point later, making it a security risk.
We also verify that we have a user with that username, and if not, we raise that same exception we created before.
```Python hl_lines="46 116-127"
{!../../../docs_src/security/tutorial005.py!}
```
## Verify the `scopes`
We now verify that all the scopes required, by this dependency and all the dependants (including *path operations*), are included in the scopes provided in the token received, otherwise raise an `HTTPException`.
For this, we use `security_scopes.scopes`, that contains a `list` with all these scopes as `str`.
```Python hl_lines="128-134"
{!../../../docs_src/security/tutorial005.py!}
```
## Dependency tree and scopes
Let's review again this dependency tree and the scopes.
As the `get_current_active_user` dependency has as a sub-dependency on `get_current_user`, the scope `"me"` declared at `get_current_active_user` will be included in the list of required scopes in the `security_scopes.scopes` passed to `get_current_user`.
The *path operation* itself also declares a scope, `"items"`, so this will also be in the list of `security_scopes.scopes` passed to `get_current_user`.
Here's how the hierarchy of dependencies and scopes looks like:
* The *path operation* `read_own_items` has:
* Required scopes `["items"]` with the dependency:
* `get_current_active_user`:
* The dependency function `get_current_active_user` has:
* Required scopes `["me"]` with the dependency:
* `get_current_user`:
* The dependency function `get_current_user` has:
* No scopes required by itself.
* A dependency using `oauth2_scheme`.
* A `security_scopes` parameter of type `SecurityScopes`:
* This `security_scopes` parameter has a property `scopes` with a `list` containing all these scopes declared above, so:
* `security_scopes.scopes` will contain `["me", "items"]` for the *path operation* `read_own_items`.
* `security_scopes.scopes` will contain `["me"]` for the *path operation* `read_users_me`, because it is declared in the dependency `get_current_active_user`.
* `security_scopes.scopes` will contain `[]` (nothing) for the *path operation* `read_system_status`, because it didn't declare any `Security` with `scopes`, and its dependency, `get_current_user`, doesn't declare any `scope` either.
!!! tip
The important and "magic" thing here is that `get_current_user` will have a different list of `scopes` to check for each *path operation*.
All depending on the `scopes` declared in each *path operation* and each dependency in the dependency tree for that specific *path operation*.
## More details about `SecurityScopes`
You can use `SecurityScopes` at any point, and in multiple places, it doesn't have to be at the "root" dependency.
It will always have the security scopes declared in the current `Security` dependencies and all the dependants for **that specific** *path operation* and **that specific** dependency tree.
Because the `SecurityScopes` will have all the scopes declared by dependants, you can use it to verify that a token has the required scopes in a central dependency function, and then declare different scope requirements in different *path operations*.
They will be checked independently for each *path operation*.
## Check it
If you open the API docs, you can authenticate and specify which scopes you want to authorize.
<img src="/img/tutorial/security/image11.png">
If you don't select any scope, you will be "authenticated", but when you try to access `/users/me/` or `/users/me/items/` you will get an error saying that you don't have enough permissions. You will still be able to access `/status/`.
And if you select the scope `me` but not the scope `items`, you will be able to access `/users/me/` but not `/users/me/items/`.
That's what would happen to a third party application that tried to access one of these *path operations* with a token provided by a user, depending on how many permissions the user gave the application.
## About third party integrations
In this example we are using the OAuth2 "password" flow.
This is appropriate when we are logging in to our own application, probably with our own frontend.
Because we can trust it to receive the `username` and `password`, as we control it.
But if you are building an OAuth2 application that others would connect to (i.e., if you are building an authentication provider equivalent to Facebook, Google, GitHub, etc.) you should use one of the other flows.
The most common is the implicit flow.
The most secure is the code flow, but is more complex to implement as it requires more steps. As it is more complex, many providers end up suggesting the implicit flow.
!!! note
It's common that each authentication provider names their flows in a different way, to make it part of their brand.
But in the end, they are implementing the same OAuth2 standard.
**FastAPI** includes utilities for all these OAuth2 authentication flows in `fastapi.security.oauth2`.
## `Security` in decorator `dependencies`
The same way you can define a `list` of `Depends` in the decorator's `dependencies` parameter (as explained in [Dependencies in path operation decorators](../../tutorial/dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank}), you could also use `Security` with `scopes` there.

View File

@@ -0,0 +1,382 @@
# Settings and Environment Variables
In many cases your application could need some external settings or configurations, for example secret keys, database credentials, credentials for email services, etc.
Most of these settings are variable (can change), like database URLs. And many could be sensitive, like secrets.
For this reason it's common to provide them in environment variables that are read by the application.
## Environment Variables
!!! tip
If you already know what "environment variables" are and how to use them, feel free to skip to the next section below.
An <a href="https://en.wikipedia.org/wiki/Environment_variable" class="external-link" target="_blank">environment variable</a> (also known as "env var") is a variable that lives outside of the Python code, in the operating system, and could be read by your Python code (or by other programs as well).
You can create and use environment variables in the shell, without needing Python:
=== "Linux, macOS, Windows Bash"
<div class="termy">
```console
// You could create an env var MY_NAME with
$ export MY_NAME="Wade Wilson"
// Then you could use it with other programs, like
$ echo "Hello $MY_NAME"
Hello Wade Wilson
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
// Create an env var MY_NAME
$ $Env:MY_NAME = "Wade Wilson"
// Use it with other programs, like
$ echo "Hello $Env:MY_NAME"
Hello Wade Wilson
```
</div>
### Read env vars in Python
You could also create environment variables outside of Python, in the terminal (or with any other method), and then read them in Python.
For example you could have a file `main.py` with:
```Python hl_lines="3"
import os
name = os.getenv("MY_NAME", "World")
print(f"Hello {name} from Python")
```
!!! tip
The second argument to <a href="https://docs.python.org/3.8/library/os.html#os.getenv" class="external-link" target="_blank">`os.getenv()`</a> is the default value to return.
If not provided, it's `None` by default, here we provide `"World"` as the default value to use.
Then you could call that Python program:
<div class="termy">
```console
// Here we don't set the env var yet
$ python main.py
// As we didn't set the env var, we get the default value
Hello World from Python
// But if we create an environment variable first
$ export MY_NAME="Wade Wilson"
// And then call the program again
$ python main.py
// Now it can read the environment variable
Hello Wade Wilson from Python
```
</div>
As environment variables can be set outside of the code, but can be read by the code, and don't have to be stored (committed to `git`) with the rest of the files, it's common to use them for configurations or settings.
You can also create an environment variable only for a specific program invocation, that is only available to that program, and only for its duration.
To do that, create it right before the program itself, on the same line:
<div class="termy">
```console
// Create an env var MY_NAME in line for this program call
$ MY_NAME="Wade Wilson" python main.py
// Now it can read the environment variable
Hello Wade Wilson from Python
// The env var no longer exists afterwards
$ python main.py
Hello World from Python
```
</div>
!!! tip
You can read more about it at <a href="https://12factor.net/config" class="external-link" target="_blank">The Twelve-Factor App: Config</a>.
### Types and validation
These environment variables can only handle text strings, as they are external to Python and have to be compatible with other programs and the rest of the system (and even with different operating systems, as Linux, Windows, macOS).
That means that any value read in Python from an environment variable will be a `str`, and any conversion to a different type or validation has to be done in code.
## Pydantic `Settings`
Fortunately, Pydantic provides a great utility to handle these settings coming from environment variables with <a href="https://pydantic-docs.helpmanual.io/usage/settings/" class="external-link" target="_blank">Pydantic: Settings management</a>.
### Create the `Settings` object
Import `BaseSettings` from Pydantic and create a sub-class, very much like with a Pydantic model.
The same way as with Pydantic models, you declare class attributes with type annotations, and possibly default values.
You can use all the same validation features and tools you use for Pydantic models, like different data types and additional validations with `Field()`.
```Python hl_lines="2 5-8 11"
{!../../../docs_src/settings/tutorial001.py!}
```
!!! tip
If you want something quick to copy and paste, don't use this example, use the last one below.
Then, when you create an instance of that `Settings` class (in this case, in the `settings` object), Pydantic will read the environment variables in a case-insensitive way, so, an upper-case variable `APP_NAME` will still be read for the attribute `app_name`.
Next it will convert and validate the data. So, when you use that `settings` object, you will have data of the types you declared (e.g. `items_per_user` will be an `int`).
### Use the `settings`
Then you can use the new `settings` object in your application:
```Python hl_lines="18-20"
{!../../../docs_src/settings/tutorial001.py!}
```
### Run the server
Next, you would run the server passing the configurations as environment variables, for example you could set an `ADMIN_EMAIL` and `APP_NAME` with:
<div class="termy">
```console
$ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
!!! tip
To set multiple env vars for a single command just separate them with a space, and put them all before the command.
And then the `admin_email` setting would be set to `"deadpool@example.com"`.
The `app_name` would be `"ChimichangApp"`.
And the `items_per_user` would keep its default value of `50`.
## Settings in another module
You could put those settings in another module file as you saw in [Bigger Applications - Multiple Files](../tutorial/bigger-applications.md){.internal-link target=_blank}.
For example, you could have a file `config.py` with:
```Python
{!../../../docs_src/settings/app01/config.py!}
```
And then use it in a file `main.py`:
```Python hl_lines="3 11-13"
{!../../../docs_src/settings/app01/main.py!}
```
!!! tip
You would also need a file `__init__.py` as you saw on [Bigger Applications - Multiple Files](../tutorial/bigger-applications.md){.internal-link target=_blank}.
## Settings in a dependency
In some occasions it might be useful to provide the settings from a dependency, instead of having a global object with `settings` that is used everywhere.
This could be especially useful during testing, as it's very easy to override a dependency with your own custom settings.
### The config file
Coming from the previous example, your `config.py` file could look like:
```Python hl_lines="10"
{!../../../docs_src/settings/app02/config.py!}
```
Notice that now we don't create a default instance `settings = Settings()`.
### The main app file
Now we create a dependency that returns a new `config.Settings()`.
```Python hl_lines="5 11-12"
{!../../../docs_src/settings/app02/main.py!}
```
!!! tip
We'll discuss the `@lru_cache()` in a bit.
For now you can assume `get_settings()` is a normal function.
And then we can require it from the *path operation function* as a dependency and use it anywhere we need it.
```Python hl_lines="16 18-20"
{!../../../docs_src/settings/app02/main.py!}
```
### Settings and testing
Then it would be very easy to provide a different settings object during testing by creating a dependency override for `get_settings`:
```Python hl_lines="8-9 12 21"
{!../../../docs_src/settings/app02/test_main.py!}
```
In the dependency override we set a new value for the `admin_email` when creating the new `Settings` object, and then we return that new object.
Then we can test that it is used.
## Reading a `.env` file
If you have many settings that possibly change a lot, maybe in different environments, it might be useful to put them on a file and then read them from it as if they were environment variables.
This practice is common enough that it has a name, these environment variables are commonly placed in a file `.env`, and the file is called a "dotenv".
!!! tip
A file starting with a dot (`.`) is a hidden file in Unix-like systems, like Linux and macOS.
But a dotenv file doesn't really have to have that exact filename.
Pydantic has support for reading from these types of files using an external library. You can read more at <a href="https://pydantic-docs.helpmanual.io/usage/settings/#dotenv-env-support" class="external-link" target="_blank">Pydantic Settings: Dotenv (.env) support</a>.
!!! tip
For this to work, you need to `pip install python-dotenv`.
### The `.env` file
You could have a `.env` file with:
```bash
ADMIN_EMAIL="deadpool@example.com"
APP_NAME="ChimichangApp"
```
### Read settings from `.env`
And then update your `config.py` with:
```Python hl_lines="9-10"
{!../../../docs_src/settings/app03/config.py!}
```
Here we create a class `Config` inside of your Pydantic `Settings` class, and set the `env_file` to the filename with the dotenv file we want to use.
!!! tip
The `Config` class is used just for Pydantic configuration. You can read more at <a href="https://pydantic-docs.helpmanual.io/usage/model_config/" class="external-link" target="_blank">Pydantic Model Config</a>
### Creating the `Settings` only once with `lru_cache`
Reading a file from disk is normally a costly (slow) operation, so you probably want to do it only once and then re-use the same settings object, instead of reading it for each request.
But every time we do:
```Python
config.Settings()
```
a new `Settings` object would be created, and at creation it would read the `.env` file again.
If the dependency function was just like:
```Python
def get_settings():
return config.Settings()
```
we would create that object for each request, and we would be reading the `.env` file for each request. ⚠️
But as we are using the `@lru_cache()` decorator on top, the `Settings` object will be created only once, the first time it's called. ✔️
```Python hl_lines="1 10"
{!../../../docs_src/settings/app03/main.py!}
```
Then for any subsequent calls of `get_settings()` in the dependencies for the next requests, instead of executing the internal code of `get_settings()` and creating a new `Settings` object, it will return the same object that was returned on the first call, again and again.
#### `lru_cache` Technical Details
`@lru_cache()` modifies the function it decorates to return the same value that was returned the first time, instead of computing it again, executing the code of the function every time.
So, the function below it will be executed once for each combination of arguments. And then the values returned by each of those combinations of arguments will be used again and again whenever the function is called with exactly the same combination of arguments.
For example, if you have a function:
```Python
@lru_cache()
def say_hi(name: str, salutation: str = "Ms."):
return f"Hello {salutation} {name}"
```
your program could execute like this:
```mermaid
sequenceDiagram
participant code as Code
participant function as say_hi()
participant execute as Execute function
rect rgba(0, 255, 0, .1)
code ->> function: say_hi(name="Camila")
function ->> execute: execute function code
execute ->> code: return the result
end
rect rgba(0, 255, 255, .1)
code ->> function: say_hi(name="Camila")
function ->> code: return stored result
end
rect rgba(0, 255, 0, .1)
code ->> function: say_hi(name="Rick")
function ->> execute: execute function code
execute ->> code: return the result
end
rect rgba(0, 255, 0, .1)
code ->> function: say_hi(name="Rick", salutation="Mr.")
function ->> execute: execute function code
execute ->> code: return the result
end
rect rgba(0, 255, 255, .1)
code ->> function: say_hi(name="Rick")
function ->> code: return stored result
end
rect rgba(0, 255, 255, .1)
code ->> function: say_hi(name="Camila")
function ->> code: return stored result
end
```
In the case of our dependency `get_settings()`, the function doesn't even take any arguments, so it always returns the same value.
That way, it behaves almost as if it was just a global variable. But as it uses a dependency function, then we can override it easily for testing.
`@lru_cache()` is part of `functools` which is part of Python's standard library, you can read more about it in the <a href="https://docs.python.org/3/library/functools.html#functools.lru_cache" class="external-link" target="_blank">Python docs for `@lru_cache()`</a>.
## Recap
You can use Pydantic Settings to handle the settings or configurations for your application, with all the power of Pydantic models.
* By using a dependency you can simplify testing.
* You can use `.env` files with it.
* Using `@lru_cache()` lets you avoid reading the dotenv file again and again for each request, while allowing you to override it during testing.

View File

@@ -0,0 +1,529 @@
# SQL (Relational) Databases with Peewee
!!! warning
If you are just starting, the tutorial [SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank} that uses SQLAlchemy should be enough.
Feel free to skip this.
If you are starting a project from scratch, you are probably better off with SQLAlchemy ORM ([SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank}), or any other async ORM.
If you already have a code base that uses <a href="https://docs.peewee-orm.com/en/latest/" class="external-link" target="_blank">Peewee ORM</a>, you can check here how to use it with **FastAPI**.
!!! warning "Python 3.7+ required"
You will need Python 3.7 or above to safely use Peewee with FastAPI.
## Peewee for async
Peewee was not designed for async frameworks, or with them in mind.
Peewee has some heavy assumptions about its defaults and about how it should be used.
If you are developing an application with an older non-async framework, and can work with all its defaults, **it can be a great tool**.
But if you need to change some of the defaults, support more than one predefined database, work with an async framework (like FastAPI), etc, you will need to add quite some complex extra code to override those defaults.
Nevertheless, it's possible to do it, and here you'll see exactly what code you have to add to be able to use Peewee with FastAPI.
!!! note "Technical Details"
You can read more about Peewee's stand about async in Python <a href="https://docs.peewee-orm.com/en/latest/peewee/database.html#async-with-gevent" class="external-link" target="_blank">in the docs</a>, <a href="https://github.com/coleifer/peewee/issues/263#issuecomment-517347032" class="external-link" target="_blank">an issue</a>, <a href="https://github.com/coleifer/peewee/pull/2072#issuecomment-563215132" class="external-link" target="_blank">a PR</a>.
## The same app
We are going to create the same application as in the SQLAlchemy tutorial ([SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank}).
Most of the code is actually the same.
So, we are going to focus only on the differences.
## File structure
Let's say you have a directory named `my_super_project` that contains a sub-directory called `sql_app` with a structure like this:
```
.
└── sql_app
├── __init__.py
├── crud.py
├── database.py
├── main.py
└── schemas.py
```
This is almost the same structure as we had for the SQLAlchemy tutorial.
Now let's see what each file/module does.
## Create the Peewee parts
Let's refer to the file `sql_app/database.py`.
### The standard Peewee code
Let's first check all the normal Peewee code, create a Peewee database:
```Python hl_lines="3 5 22"
{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
```
!!! tip
Have in mind that if you wanted to use a different database, like PostgreSQL, you couldn't just change the string. You would need to use a different Peewee database class.
#### Note
The argument:
```Python
check_same_thread=False
```
is equivalent to the one in the SQLAlchemy tutorial:
```Python
connect_args={"check_same_thread": False}
```
...it is needed only for `SQLite`.
!!! info "Technical Details"
Exactly the same technical details as in [SQL (Relational) Databases](../tutorial/sql-databases.md#note){.internal-link target=_blank} apply.
### Make Peewee async-compatible `PeeweeConnectionState`
The main issue with Peewee and FastAPI is that Peewee relies heavily on <a href="https://docs.python.org/3/library/threading.html#thread-local-data" class="external-link" target="_blank">Python's `threading.local`</a>, and it doesn't have a direct way to override it or let you handle connections/sessions directly (as is done in the SQLAlchemy tutorial).
And `threading.local` is not compatible with the new async features of modern Python.
!!! note "Technical Details"
`threading.local` is used to have a "magic" variable that has a different value for each thread.
This was useful in older frameworks designed to have one single thread per request, no more, no less.
Using this, each request would have its own database connection/session, which is the actual final goal.
But FastAPI, using the new async features, could handle more than one request on the same thread. And at the same time, for a single request, it could run multiple things in different threads (in a threadpool), depending on if you use `async def` or normal `def`. This is what gives all the performance improvements to FastAPI.
But Python 3.7 and above provide a more advanced alternative to `threading.local`, that can also be used in the places where `threading.local` would be used, but is compatible with the new async features.
We are going to use that. It's called <a href="https://docs.python.org/3/library/contextvars.html" class="external-link" target="_blank">`contextvars`</a>.
We are going to override the internal parts of Peewee that use `threading.local` and replace them with `contextvars`, with the corresponding updates.
This might seem a bit complex (and it actually is), you don't really need to completely understand how it works to use it.
We will create a `PeeweeConnectionState`:
```Python hl_lines="10-19"
{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
```
This class inherits from a special internal class used by Peewee.
It has all the logic to make Peewee use `contextvars` instead of `threading.local`.
`contextvars` works a bit differently than `threading.local`. But the rest of Peewee's internal code assumes that this class works with `threading.local`.
So, we need to do some extra tricks to make it work as if it was just using `threading.local`. The `__init__`, `__setattr__`, and `__getattr__` implement all the required tricks for this to be used by Peewee without knowing that it is now compatible with FastAPI.
!!! tip
This will just make Peewee behave correctly when used with FastAPI. Not randomly opening or closing connections that are being used, creating errors, etc.
But it doesn't give Peewee async super-powers. You should still use normal `def` functions and not `async def`.
### Use the custom `PeeweeConnectionState` class
Now, overwrite the `._state` internal attribute in the Peewee database `db` object using the new `PeeweeConnectionState`:
```Python hl_lines="24"
{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
```
!!! tip
Make sure you overwrite `db._state` *after* creating `db`.
!!! tip
You would do the same for any other Peewee database, including `PostgresqlDatabase`, `MySQLDatabase`, etc.
## Create the database models
Let's now see the file `sql_app/models.py`.
### Create Peewee models for our data
Now create the Peewee models (classes) for `User` and `Item`.
This is the same you would do if you followed the Peewee tutorial and updated the models to have the same data as in the SQLAlchemy tutorial.
!!! tip
Peewee also uses the term "**model**" to refer to these classes and instances that interact with the database.
But Pydantic also uses the term "**model**" to refer to something different, the data validation, conversion, and documentation classes and instances.
Import `db` from `database` (the file `database.py` from above) and use it here.
```Python hl_lines="3 6-12 15-21"
{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
```
!!! tip
Peewee creates several magic attributes.
It will automatically add an `id` attribute as an integer to be the primary key.
It will chose the name of the tables based on the class names.
For the `Item`, it will create an attribute `owner_id` with the integer ID of the `User`. But we don't declare it anywhere.
## Create the Pydantic models
Now let's check the file `sql_app/schemas.py`.
!!! tip
To avoid confusion between the Peewee *models* and the Pydantic *models*, we will have the file `models.py` with the Peewee models, and the file `schemas.py` with the Pydantic models.
These Pydantic models define more or less a "schema" (a valid data shape).
So this will help us avoiding confusion while using both.
### Create the Pydantic *models* / schemas
Create all the same Pydantic models as in the SQLAlchemy tutorial:
```Python hl_lines="16-18 21-22 25-30 34-35 38-39 42-48"
{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
```
!!! tip
Here we are creating the models with an `id`.
We didn't explicitly specify an `id` attribute in the Peewee models, but Peewee adds one automatically.
We are also adding the magic `owner_id` attribute to `Item`.
### Create a `PeeweeGetterDict` for the Pydantic *models* / schemas
When you access a relationship in a Peewee object, like in `some_user.items`, Peewee doesn't provide a `list` of `Item`.
It provides a special custom object of class `ModelSelect`.
It's possible to create a `list` of its items with `list(some_user.items)`.
But the object itself is not a `list`. And it's also not an actual Python <a href="https://docs.python.org/3/glossary.html#term-generator" class="external-link" target="_blank">generator</a>. Because of this, Pydantic doesn't know by default how to convert it to a `list` of Pydantic *models* / schemas.
But recent versions of Pydantic allow providing a custom class that inherits from `pydantic.utils.GetterDict`, to provide the functionality used when using the `orm_mode = True` to retrieve the values for ORM model attributes.
We are going to create a custom `PeeweeGetterDict` class and use it in all the same Pydantic *models* / schemas that use `orm_mode`:
```Python hl_lines="3 8-13 31 49"
{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
```
Here we are checking if the attribute that is being accessed (e.g. `.items` in `some_user.items`) is an instance of `peewee.ModelSelect`.
And if that's the case, just return a `list` with it.
And then we use it in the Pydantic *models* / schemas that use `orm_mode = True`, with the configuration variable `getter_dict = PeeweeGetterDict`.
!!! tip
We only need to create one `PeeweeGetterDict` class, and we can use it in all the Pydantic *models* / schemas.
## CRUD utils
Now let's see the file `sql_app/crud.py`.
### Create all the CRUD utils
Create all the same CRUD utils as in the SQLAlchemy tutorial, all the code is very similar:
```Python hl_lines="1 4-5 8-9 12-13 16-20 23-24 27-30"
{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
```
There are some differences with the code for the SQLAlchemy tutorial.
We don't pass a `db` attribute around. Instead we use the models directly. This is because the `db` object is a global object, that includes all the connection logic. That's why we had to do all the `contextvars` updates above.
Aso, when returning several objects, like in `get_users`, we directly call `list`, like in:
```Python
list(models.User.select())
```
This is for the same reason that we had to create a custom `PeeweeGetterDict`. But by returning something that is already a `list` instead of the `peewee.ModelSelect` the `response_model` in the *path operation* with `List[models.User]` (that we'll see later) will work correctly.
## Main **FastAPI** app
And now in the file `sql_app/main.py` let's integrate and use all the other parts we created before.
### Create the database tables
In a very simplistic way create the database tables:
```Python hl_lines="9-11"
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
### Create a dependency
Create a dependency that will connect the database right at the beginning of a request and disconnect it at the end:
```Python hl_lines="23-29"
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
Here we have an empty `yield` because we are actually not using the database object directly.
It is connecting to the database and storing the connection data in an internal variable that is independent for each request (using the `contextvars` tricks from above).
Because the database connection is potentially I/O blocking, this dependency is created with a normal `def` function.
And then, in each *path operation function* that needs to access the database we add it as a dependency.
But we are not using the value given by this dependency (it actually doesn't give any value, as it has an empty `yield`). So, we don't add it to the *path operation function* but to the *path operation decorator* in the `dependencies` parameter:
```Python hl_lines="32 40 47 59 65 72"
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
### Context variable sub-dependency
For all the `contextvars` parts to work, we need to make sure we have an independent value in the `ContextVar` for each request that uses the database, and that value will be used as the database state (connection, transactions, etc) for the whole request.
For that, we need to create another `async` dependency `reset_db_state()` that is used as a sub-dependency in `get_db()`. It will set the value for the context variable (with just a default `dict`) that will be used as the database state for the whole request. And then the dependency `get_db()` will store in it the database state (connection, transactions, etc).
```Python hl_lines="18-20"
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
For the **next request**, as we will reset that context variable again in the `async` dependency `reset_db_state()` and then create a new connection in the `get_db()` dependency, that new request will have its own database state (connection, transactions, etc).
!!! tip
As FastAPI is an async framework, one request could start being processed, and before finishing, another request could be received and start processing as well, and it all could be processed in the same thread.
But context variables are aware of these async features, so, a Peewee database state set in the `async` dependency `reset_db_state()` will keep its own data throughout the entire request.
And at the same time, the other concurrent request will have its own database state that will be independent for the whole request.
#### Peewee Proxy
If you are using a <a href="https://docs.peewee-orm.com/en/latest/peewee/database.html#dynamically-defining-a-database" class="external-link" target="_blank">Peewee Proxy</a>, the actual database is at `db.obj`.
So, you would reset it with:
```Python hl_lines="3-4"
async def reset_db_state():
database.db.obj._state._state.set(db_state_default.copy())
database.db.obj._state.reset()
```
### Create your **FastAPI** *path operations*
Now, finally, here's the standard **FastAPI** *path operations* code.
```Python hl_lines="32-37 40-43 46-53 56-62 65-68 71-79"
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
### About `def` vs `async def`
The same as with SQLAlchemy, we are not doing something like:
```Python
user = await models.User.select().first()
```
...but instead we are using:
```Python
user = models.User.select().first()
```
So, again, we should declare the *path operation functions* and the dependency without `async def`, just with a normal `def`, as:
```Python hl_lines="2"
# Something goes here
def read_users(skip: int = 0, limit: int = 100):
# Something goes here
```
## Testing Peewee with async
This example includes an extra *path operation* that simulates a long processing request with `time.sleep(sleep_time)`.
It will have the database connection open at the beginning and will just wait some seconds before replying back. And each new request will wait one second less.
This will easily let you test that your app with Peewee and FastAPI is behaving correctly with all the stuff about threads.
If you want to check how Peewee would break your app if used without modification, go the the `sql_app/database.py` file and comment the line:
```Python
# db._state = PeeweeConnectionState()
```
And in the file `sql_app/main.py` file, comment the body of the `async` dependency `reset_db_state()` and replace it with a `pass`:
```Python
async def reset_db_state():
# database.db._state._state.set(db_state_default.copy())
# database.db._state.reset()
pass
```
Then run your app with Uvicorn:
<div class="termy">
```console
$ uvicorn sql_app.main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
Open your browser at <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a> and create a couple of users.
Then open 10 tabs at <a href="http://127.0.0.1:8000/docs#/default/read_slow_users_slowusers__get" class="external-link" target="_blank">http://127.0.0.1:8000/docs#/default/read_slow_users_slowusers__get</a> at the same time.
Go to the *path operation* "Get `/slowusers/`" in all of the tabs. Use the "Try it out" button and execute the request in each tab, one right after the other.
The tabs will wait for a bit and then some of them will show `Internal Server Error`.
### What happens
The first tab will make your app create a connection to the database and wait for some seconds before replying back and closing the database connection.
Then, for the request in the next tab, your app will wait for one second less, and so on.
This means that it will end up finishing some of the last tabs' requests earlier than some of the previous ones.
Then one the last requests that wait less seconds will try to open a database connection, but as one of those previous requests for the other tabs will probably be handled in the same thread as the first one, it will have the same database connection that is already open, and Peewee will throw an error and you will see it in the terminal, and the response will have an `Internal Server Error`.
This will probably happen for more than one of those tabs.
If you had multiple clients talking to your app exactly at the same time, this is what could happen.
And as your app starts to handle more and more clients at the same time, the waiting time in a single request needs to be shorter and shorter to trigger the error.
### Fix Peewee with FastAPI
Now go back to the file `sql_app/database.py`, and uncomment the line:
```Python
db._state = PeeweeConnectionState()
```
And in the file `sql_app/main.py` file, uncomment the body of the `async` dependency `reset_db_state()`:
```Python
async def reset_db_state():
database.db._state._state.set(db_state_default.copy())
database.db._state.reset()
```
Terminate your running app and start it again.
Repeat the same process with the 10 tabs. This time all of them will wait and you will get all the results without errors.
...You fixed it!
## Review all the files
Remember you should have a directory named `my_super_project` (or however you want) that contains a sub-directory called `sql_app`.
`sql_app` should have the following files:
* `sql_app/__init__.py`: is an empty file.
* `sql_app/database.py`:
```Python
{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
```
* `sql_app/models.py`:
```Python
{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
```
* `sql_app/schemas.py`:
```Python
{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
```
* `sql_app/crud.py`:
```Python
{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
```
* `sql_app/main.py`:
```Python
{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
```
## Technical Details
!!! warning
These are very technical details that you probably don't need.
### The problem
Peewee uses <a href="https://docs.python.org/3/library/threading.html#thread-local-data" class="external-link" target="_blank">`threading.local`</a> by default to store it's database "state" data (connection, transactions, etc).
`threading.local` creates a value exclusive to the current thread, but an async framework would run all the code (e.g. for each request) in the same thread, and possibly not in order.
On top of that, an async framework could run some sync code in a threadpool (using `asyncio.run_in_executor`), but belonging to the same request.
This means that, with Peewee's current implementation, multiple tasks could be using the same `threading.local` variable and end up sharing the same connection and data (that they shouldn't), and at the same time, if they execute sync I/O-blocking code in a threadpool (as with normal `def` functions in FastAPI, in *path operations* and dependencies), that code won't have access to the database state variables, even while it's part of the same request and it should be able to get access to the same database state.
### Context variables
Python 3.7 has <a href="https://docs.python.org/3/library/contextvars.html" class="external-link" target="_blank">`contextvars`</a> that can create a local variable very similar to `threading.local`, but also supporting these async features.
There are several things to have in mind.
The `ContextVar` has to be created at the top of the module, like:
```Python
some_var = ContextVar("some_var", default="default value")
```
To set a value used in the current "context" (e.g. for the current request) use:
```Python
some_var.set("new value")
```
To get a value anywhere inside of the context (e.g. in any part handling the current request) use:
```Python
some_var.get()
```
### Set context variables in the `async` dependency `reset_db_state()`
If some part of the async code sets the value with `some_var.set("updated in function")` (e.g. like the `async` dependency), the rest of the code in it and the code that goes after (including code inside of `async` functions called with `await`) will see that new value.
So, in our case, if we set the Peewee state variable (with a default `dict`) in the `async` dependency, all the rest of the internal code in our app will see this value and will be able to reuse it for the whole request.
And the context variable would be set again for the next request, even if they are concurrent.
### Set database state in the dependency `get_db()`
As `get_db()` is a normal `def` function, **FastAPI** will make it run in a threadpool, with a *copy* of the "context", holding the same value for the context variable (the `dict` with the reset database state). Then it can add database state to that `dict`, like the connection, etc.
But if the value of the context variable (the default `dict`) was set in that normal `def` function, it would create a new value that would stay only in that thread of the threadpool, and the rest of the code (like the *path operation functions*) wouldn't have access to it. In `get_db()` we can only set values in the `dict`, but not the entire `dict` itself.
So, we need to have the `async` dependency `reset_db_state()` to set the `dict` in the context variable. That way, all the code has access to the same `dict` for the database state for a single request.
### Connect and disconnect in the dependency `get_db()`
Then the next question would be, why not just connect and disconnect the database in the `async` dependency itself, instead of in `get_db()`?
The `async` dependency has to be `async` for the context variable to be preserved for the rest of the request, but creating and closing the database connection is potentially blocking, so it could degrade performance if it was there.
So we also need the normal `def` dependency `get_db()`.

View File

@@ -0,0 +1,73 @@
# Sub Applications - Mounts
If you need to have two independent FastAPI applications, with their own independent OpenAPI and their own docs UIs, you can have a main app and "mount" one (or more) sub-application(s).
## Mounting a **FastAPI** application
"Mounting" means adding a completely "independent" application in a specific path, that then takes care of handling everything under that path, with the _path operations_ declared in that sub-application.
### Top-level application
First, create the main, top-level, **FastAPI** application, and its *path operations*:
```Python hl_lines="3 6-8"
{!../../../docs_src/sub_applications/tutorial001.py!}
```
### Sub-application
Then, create your sub-application, and its *path operations*.
This sub-application is just another standard FastAPI application, but this is the one that will be "mounted":
```Python hl_lines="11 14-16"
{!../../../docs_src/sub_applications/tutorial001.py!}
```
### Mount the sub-application
In your top-level application, `app`, mount the sub-application, `subapi`.
In this case, it will be mounted at the path `/subapi`:
```Python hl_lines="11 19"
{!../../../docs_src/sub_applications/tutorial001.py!}
```
### Check the automatic API docs
Now, run `uvicorn` with the main app, if your file is `main.py`, it would be:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
And open the docs at <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
You will see the automatic API docs for the main app, including only its own _path operations_:
<img src="/img/tutorial/sub-applications/image01.png">
And then, open the docs for the sub-application, at <a href="http://127.0.0.1:8000/subapi/docs" class="external-link" target="_blank">http://127.0.0.1:8000/subapi/docs</a>.
You will see the automatic API docs for the sub-application, including only its own _path operations_, all under the correct sub-path prefix `/subapi`:
<img src="/img/tutorial/sub-applications/image02.png">
If you try interacting with any of the two user interfaces, they will work correctly, because the browser will be able to talk to each specific app or sub-app.
### Technical Details: `root_path`
When you mount a sub-application as described above, FastAPI will take care of communicating the mount path for the sub-application using a mechanism from the ASGI specification called a `root_path`.
That way, the sub-application will know to use that path prefix for the docs UI.
And the sub-application could also have its own mounted sub-applications and everything would work correctly, because FastAPI handles all these `root_path`s automatically.
You will learn more about the `root_path` and how to use it explicitly in the section about [Behind a Proxy](./behind-a-proxy.md){.internal-link target=_blank}.

View File

@@ -0,0 +1,89 @@
# Templates
You can use any template engine you want with **FastAPI**.
A common election is Jinja2, the same one used by Flask and other tools.
There are utilities to configure it easily that you can use directly in your **FastAPI** application (provided by Starlette).
## Install dependencies
Install `jinja2`:
<div class="termy">
```console
$ pip install jinja2
---> 100%
```
</div>
If you need to also serve static files (as in this example), install `aiofiles`:
<div class="termy">
```console
$ pip install aiofiles
---> 100%
```
</div>
## Using `Jinja2Templates`
* Import `Jinja2Templates`.
* Create a `templates` object that you can re-use later.
* Declare a `Request` parameter in the *path operation* that will return a template.
* Use the `templates` you created to render and return a `TemplateResponse`, passing the `request` as one of the key-value pairs in the Jinja2 "context".
```Python hl_lines="4 11 15-16"
{!../../../docs_src/templates/tutorial001.py!}
```
!!! note
Notice that you have to pass the `request` as part of the key-value pairs in the context for Jinja2. So, you also have to declare it in your *path operation*.
!!! tip
By declaring `response_class=HTMLResponse` the docs UI will be able to know that the response will be HTML.
!!! note "Technical Details"
You could also use `from starlette.templating import Jinja2Templates`.
**FastAPI** provides the same `starlette.templating` as `fastapi.templating` just as a convenience for you, the developer. But most of the available responses come directly from Starlette. The same with `Request` and `StaticFiles`.
## Writing templates
Then you can write a template at `templates/item.html` with:
```jinja hl_lines="7"
{!../../../docs_src/templates/templates/item.html!}
```
It will show the `id` taken from the "context" `dict` you passed:
```Python
{"request": request, "id": id}
```
## Templates and static files
And you can also use `url_for()` inside of the template, and use it, for example, with the `StaticFiles` you mounted.
```jinja hl_lines="4"
{!../../../docs_src/templates/templates/item.html!}
```
In this example, it would link to a CSS file at `static/styles.css` with:
```CSS hl_lines="4"
{!../../../docs_src/templates/static/styles.css!}
```
And because you are using `StaticFiles`, that CSS file would be served automatically by your **FastAPI** application at the URL `/static/styles.css`.
## More details
For more details, including how to test templates, check <a href="https://www.starlette.io/templates/" class="external-link" target="_blank">Starlette's docs on templates</a>.

View File

@@ -0,0 +1,95 @@
# Testing a Database
You can use the same dependency overrides from [Testing Dependencies with Overrides](testing-dependencies.md){.internal-link target=_blank} to alter a database for testing.
You could want to set up a different database for testing, rollback the data after the tests, pre-fill it with some testing data, etc.
The main idea is exactly the same you saw in that previous chapter.
## Add tests for the SQL app
Let's update the example from [SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank} to use a testing database.
All the app code is the same, you can go back to that chapter check how it was.
The only changes here are in the new testing file.
Your normal dependency `get_db()` would return a database session.
In the test, you could use a dependency override to return your *custom* database session instead of the one that would be used normally.
In this example we'll create a temporary database only for the tests.
## File structure
We create a new file at `sql_app/tests/test_sql_app.py`.
So the new file structure looks like:
``` hl_lines="9-11"
.
└── sql_app
├── __init__.py
├── crud.py
├── database.py
├── main.py
├── models.py
├── schemas.py
└── tests
├── __init__.py
└── test_sql_app.py
```
## Create the new database session
First, we create a new database session with the new database.
For the tests we'll use a file `test.db` instead of `sql_app.db`.
But the rest of the session code is more or less the same, we just copy it.
```Python hl_lines="8-13"
{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
```
!!! tip
You could reduce duplication in that code by putting it in a function and using it from both `database.py` and `tests/test_sql_app.py`.
For simplicity and to focus on the specific testing code, we are just copying it.
## Create the database
Because now we are going to use a new database in a new file, we need to make sure we create the database with:
```Python
Base.metadata.create_all(bind=engine)
```
That is normally called in `main.py`, but the line in `main.py` uses the database file `sql_app.db`, and we need to make sure we create `test.db` for the tests.
So we add that line here, with the new file.
```Python hl_lines="16"
{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
```
## Dependency override
Now we create the dependency override and add it to the overrides for our app.
```Python hl_lines="19-24 27"
{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
```
!!! tip
The code for `override_get_db()` is almost exactly the same as for `get_db()`, but in `override_get_db()` we use the `TestingSessionLocal` for the testing database instead.
## Test the app
Then we can just test the app as normally.
```Python hl_lines="32-47"
{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
```
And all the modifications we made in the database during the tests will be in the `test.db` database instead of the main `sql_app.db`.

View File

@@ -0,0 +1,49 @@
# Testing Dependencies with Overrides
## Overriding dependencies during testing
There are some scenarios where you might want to override a dependency during testing.
You don't want the original dependency to run (nor any of the sub-dependencies it might have).
Instead, you want to provide a different dependency that will be used only during tests (possibly only some specific tests), and will provide a value that can be used where the value of the original dependency was used.
### Use cases: external service
An example could be that you have an external authentication provider that you need to call.
You send it a token and it returns an authenticated user.
This provider might be charging you per request, and calling it might take some extra time than if you had a fixed mock user for tests.
You probably want to test the external provider once, but not necessarily call it for every test that runs.
In this case, you can override the dependency that calls that provider, and use a custom dependency that returns a mock user, only for your tests.
### Use the `app.dependency_overrides` attribute
For these cases, your **FastAPI** application has an attribute `app.dependency_overrides`, it is a simple `dict`.
To override a dependency for testing, you put as a key the original dependency (a function), and as the value, your dependency override (another function).
And then **FastAPI** will call that override instead of the original dependency.
```Python hl_lines="26-27 30"
{!../../../docs_src/dependency_testing/tutorial001.py!}
```
!!! tip
You can set a dependency override for a dependency used anywhere in your **FastAPI** application.
The original dependency could be used in a *path operation function*, a *path operation decorator* (when you don't use the return value), a `.include_router()` call, etc.
FastAPI will still be able to override it.
Then you can reset your overrides (remove them) by setting `app.dependency_overrides` to be an empty `dict`:
```Python
app.dependency_overrides = {}
```
!!! tip
If you want to override a dependency only during some tests, you can set the override at the beginning of the test (inside the test function) and reset it at the end (at the end of the test function).

View File

@@ -0,0 +1,7 @@
# Testing Events: startup - shutdown
When you need your event handlers (`startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement:
```Python hl_lines="9-12 20-24"
{!../../../docs_src/app_testing/tutorial003.py!}
```

View File

@@ -0,0 +1,12 @@
# Testing WebSockets
You can use the same `TestClient` to test WebSockets.
For this, you use the `TestClient` in a `with` statement, connecting to the WebSocket:
```Python hl_lines="27-31"
{!../../../docs_src/app_testing/tutorial002.py!}
```
!!! note
For more details, check Starlette's documentation for <a href="https://www.starlette.io/testclient/#testing-websocket-sessions" class="external-link" target="_blank">testing WebSockets</a>.

View File

@@ -0,0 +1,52 @@
# Using the Request Directly
Up to now, you have been declaring the parts of the request that you need with their types.
Taking data from:
* The path as parameters.
* Headers.
* Cookies.
* etc.
And by doing so, **FastAPI** is validating that data, converting it and generating documentation for your API automatically.
But there are situations where you might need to access the `Request` object directly.
## Details about the `Request` object
As **FastAPI** is actually **Starlette** underneath, with a layer of several tools on top, you can use Starlette's <a href="https://www.starlette.io/requests/" class="external-link" target="_blank">`Request`</a> object directly when you need to.
It would also mean that if you get data from the `Request` object directly (for example, read the body) it won't be validated, converted or documented (with OpenAPI, for the automatic API user interface) by FastAPI.
Although any other parameter declared normally (for example, the body with a Pydantic model) would still be validated, converted, annotated, etc.
But there are specific cases where it's useful to get the `Request` object.
## Use the `Request` object directly
Let's imagine you want to get the client's IP address/host inside of your *path operation function*.
For that you need to access the request directly.
```Python hl_lines="1 7-8"
{!../../../docs_src/using_request_directly/tutorial001.py!}
```
By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
!!! tip
Note that in this case, we are declaring a path parameter beside the request parameter.
So, the path parameter will be extracted, validated, converted to the specified type and annotated with OpenAPI.
The same way, you can declare any other parameter as normally, and additionally, get the `Request` too.
## `Request` documentation
You can read more details about the <a href="https://www.starlette.io/requests/" class="external-link" target="_blank">`Request` object in the official Starlette documentation site</a>.
!!! note "Technical Details"
You could also use `from starlette.requests import Request`.
**FastAPI** provides it directly just as a convenience for you, the developer. But it comes directly from Starlette.

View File

@@ -0,0 +1,172 @@
# WebSockets
You can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API" class="external-link" target="_blank">WebSockets</a> with **FastAPI**.
## WebSockets client
### In production
In your production system, you probably have a frontend created with a modern framework like React, Vue.js or Angular.
And to communicate using WebSockets with your backend you would probably use your frontend's utilities.
Or you might have a native mobile application that communicates with your WebSocket backend directly, in native code.
Or you might have any other way to communicate with the WebSocket endpoint.
---
But for this example, we'll use a very simple HTML document with some JavaScript, all inside a long string.
This, of course, is not optimal and you wouldn't use it for production.
In production you would have one of the options above.
But it's the simplest way to focus on the server-side of WebSockets and have a working example:
```Python hl_lines="2 6-38 41-43"
{!../../../docs_src/websockets/tutorial001.py!}
```
## Create a `websocket`
In your **FastAPI** application, create a `websocket`:
```Python hl_lines="1 46-47"
{!../../../docs_src/websockets/tutorial001.py!}
```
!!! note "Technical Details"
You could also use `from starlette.websockets import WebSocket`.
**FastAPI** provides the same `WebSocket` directly just as a convenience for you, the developer. But it comes directly from Starlette.
## Await for messages and send messages
In your WebSocket route you can `await` for messages and send messages.
```Python hl_lines="48-52"
{!../../../docs_src/websockets/tutorial001.py!}
```
You can receive and send binary, text, and JSON data.
## Try it
If your file is named `main.py`, run your application with:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
Open your browser at <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000</a>.
You will see a simple page like:
<img src="/img/tutorial/websockets/image01.png">
You can type messages in the input box, and send them:
<img src="/img/tutorial/websockets/image02.png">
And your **FastAPI** application with WebSockets will respond back:
<img src="/img/tutorial/websockets/image03.png">
You can send (and receive) many messages:
<img src="/img/tutorial/websockets/image04.png">
And all of them will use the same WebSocket connection.
## Using `Depends` and others
In WebSocket endpoints you can import from `fastapi` and use:
* `Depends`
* `Security`
* `Cookie`
* `Header`
* `Path`
* `Query`
They work the same way as for other FastAPI endpoints/*path operations*:
```Python hl_lines="58-65 68-83"
{!../../../docs_src/websockets/tutorial002.py!}
```
!!! info
In a WebSocket it doesn't really make sense to raise an `HTTPException`. So it's better to close the WebSocket connection directly.
You can use a closing code from the <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">valid codes defined in the specification</a>.
In the future, there will be a `WebSocketException` that you will be able to `raise` from anywhere, and add exception handlers for it. It depends on the <a href="https://github.com/encode/starlette/pull/527" class="external-link" target="_blank">PR #527</a> in Starlette.
### Try the WebSockets with dependencies
If your file is named `main.py`, run your application with:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
Open your browser at <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000</a>.
There you can set:
* The "Item ID", used in the path.
* The "Token" used as a query parameter.
!!! tip
Notice that the query `token` will be handled by a dependency.
With that you can connect the WebSocket and then send and receive messages:
<img src="/img/tutorial/websockets/image05.png">
## Handling disconnections and multiple clients
When a WebSocket connection is closed, the `await websocket.receive_text()` will raise a `WebSocketDisconnect` exception, which you can then catch and handle like in this example.
```Python hl_lines="81-83"
{!../../../docs_src/websockets/tutorial003.py!}
```
To try it out:
* Open the app with several browser tabs.
* Write messages from them.
* Then close one of the tabs.
That will raise the `WebSocketDisconnect` exception, and all the other clients will receive a message like:
```
Client #1596980209979 left the chat
```
!!! tip
The app above is a minimal and simple example to demonstrate how to handle and broadcast messages to several WebSocket connections.
But have in mind that, as everything is handled in memory, in a single list, it will only work while the process is running, and will only work with a single process.
If you need something easy to integrate with FastAPI but that is more robust, supported by Redis, PostgreSQL or others, check <a href="https://github.com/encode/broadcaster" class="external-link" target="_blank">encode/broadcaster</a>.
## More info
To learn more about the options, check Starlette's documentation for:
* <a href="https://www.starlette.io/websockets/" class="external-link" target="_blank">The `WebSocket` class</a>.
* <a href="https://www.starlette.io/endpoints/#websocketendpoint" class="external-link" target="_blank">Class-based WebSocket handling</a>.

View File

@@ -0,0 +1,37 @@
# Including WSGI - Flask, Django, others
You can mount WSGI applications as you saw with [Sub Applications - Mounts](./sub-applications.md){.internal-link target=_blank}, [Behind a Proxy](./behind-a-proxy.md){.internal-link target=_blank}.
For that, you can use the `WSGIMiddleware` and use it to wrap your WSGI application, for example, Flask, Django, etc.
## Using `WSGIMiddleware`
You need to import `WSGIMiddleware`.
Then wrap the WSGI (e.g. Flask) app with the middleware.
And then mount that under a path.
```Python hl_lines="2-3 22"
{!../../../docs_src/wsgi/tutorial001.py!}
```
## Check it
Now, every request under the path `/v1/` will be handled by the Flask application.
And the rest will be handled by **FastAPI**.
If you run it with Uvicorn and go to <a href="http://localhost:8000/v1/" class="external-link" target="_blank">http://localhost:8000/v1/</a> you will see the response from Flask:
```txt
Hello, World from Flask!
```
And if you go to <a href="http://localhost:8000/v2" class="external-link" target="_blank">http://localhost:8000/v2</a> you will see the response from FastAPI:
```JSON
{
"message": "Hello World"
}
```

View File

@@ -1,3 +1,5 @@
# Alternatives, Inspiration and Comparisons
What inspired **FastAPI**, how it compares to other alternatives and what it learned from them.
## Intro
@@ -12,7 +14,7 @@ But at some point, there was no other option than creating something that provid
## Previous tools
### <a href="https://www.djangoproject.com/" target="_blank">Django</a>
### <a href="https://www.djangoproject.com/" class="external-link" target="_blank">Django</a>
It's the most popular Python framework and is widely trusted. It is used to build systems like Instagram.
@@ -20,7 +22,7 @@ It's relatively tightly coupled with relational databases (like MySQL or Postgre
It was created to generate the HTML in the backend, not to create APIs used by a modern frontend (like React, Vue.js and Angular) or by other systems (like <abbr title="Internet of Things">IoT</abbr> devices) communicating with it.
### <a href="https://www.django-rest-framework.org/" target="_blank">Django REST Framework</a>
### <a href="https://www.django-rest-framework.org/" class="external-link" target="_blank">Django REST Framework</a>
Django REST framework was created to be a flexible toolkit for building Web APIs using Django underneath, to improve its API capabilities.
@@ -35,7 +37,7 @@ It was one of the first examples of **automatic API documentation**, and this wa
!!! check "Inspired **FastAPI** to"
Have an automatic API documentation web user interface.
### <a href="http://flask.pocoo.org/" target="_blank">Flask</a>
### <a href="https://flask.palletsprojects.com" class="external-link" target="_blank">Flask</a>
Flask is a "microframework", it doesn't include database integrations nor many of the things that come by default in Django.
@@ -55,7 +57,7 @@ Given the simplicity of Flask, it seemed like a good match for building APIs. Th
Have a simple and easy to use routing system.
### <a href="http://docs.python-requests.org" target="_blank">Requests</a>
### <a href="https://requests.readthedocs.io" class="external-link" target="_blank">Requests</a>
**FastAPI** is not actually an alternative to **Requests**. Their scope is very different.
@@ -79,7 +81,7 @@ The way you use it is very simple. For example, to do a `GET` request, you would
response = requests.get("http://example.com/some/url")
```
The FastAPI counterpart API path operation could look like:
The FastAPI counterpart API *path operation* could look like:
```Python hl_lines="1"
@app.get("/some/url")
@@ -95,7 +97,7 @@ See the similarities in `requests.get(...)` and `@app.get(...)`.
* Have sensible defaults, but powerful customizations.
### <a href="https://swagger.io/" target="_blank">Swagger</a> / <a href="https://github.com/OAI/OpenAPI-Specification/" target="_blank">OpenAPI</a>
### <a href="https://swagger.io/" class="external-link" target="_blank">Swagger</a> / <a href="https://github.com/OAI/OpenAPI-Specification/" class="external-link" target="_blank">OpenAPI</a>
The main feature I wanted from Django REST Framework was the automatic API documentation.
@@ -112,8 +114,8 @@ That's why when talking about version 2.0 it's common to say "Swagger", and for
And integrate standards-based user interface tools:
* <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a>
* <a href="https://github.com/Rebilly/ReDoc" target="_blank">ReDoc</a>
* <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>
* <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>
These two were chosen for being fairly popular and stable, but doing a quick search, you could find dozens of additional alternative user interfaces for OpenAPI (that you can use with **FastAPI**).
@@ -121,9 +123,9 @@ That's why when talking about version 2.0 it's common to say "Swagger", and for
There are several Flask REST frameworks, but after investing the time and work into investigating them, I found that many are discontinued or abandoned, with several standing issues that made them unfit.
### <a href="https://marshmallow.readthedocs.io/en/3.0/" target="_blank">Marshmallow</a>
### <a href="https://marshmallow.readthedocs.io/en/3.0/" class="external-link" target="_blank">Marshmallow</a>
One of the main features needed by API systems is data "<abbr title="also called marshalling, convertion">serialization</abbr>" which is taking data from the code (Python) and converting it into something that can be sent through the network. For example, converting an object containing data from a database into a JSON object. Converting `datetime` objects into strings, etc.
One of the main features needed by API systems is data "<abbr title="also called marshalling, conversion">serialization</abbr>" which is taking data from the code (Python) and converting it into something that can be sent through the network. For example, converting an object containing data from a database into a JSON object. Converting `datetime` objects into strings, etc.
Another big feature needed by APIs is data validation, making sure that the data is valid, given certain parameters. For example, that some field is an `int`, and not some random string. This is especially useful for incoming data.
@@ -136,23 +138,23 @@ But it was created before there existed Python type hints. So, to define every <
!!! check "Inspired **FastAPI** to"
Use code to define "schemas" that provide data types and validation, automatically.
### <a href="https://webargs.readthedocs.io/en/latest/" target="_blank">Webargs</a>
### <a href="https://webargs.readthedocs.io/en/latest/" class="external-link" target="_blank">Webargs</a>
Another big feature required by APIs is <abbr title="reading and converting to Python data">parsing</abbr> data from incoming requests.
Webargs is a tool that was made to provide that on top of several frameworks, including Flask.
It uses Marshmallow underneath to do the data validation. And it was created by the same guys.
It uses Marshmallow underneath to do the data validation. And it was created by the same developers.
It's a great tool and I have used it a lot too, before having **FastAPI**.
!!! info
Webargs was created by the same Marshmallow guys.
Webargs was created by the same Marshmallow developers.
!!! check "Inspired **FastAPI** to"
Have automatic validation of incoming request data.
### <a href="https://apispec.readthedocs.io/en/stable/" target="_blank">APISpec</a>
### <a href="https://apispec.readthedocs.io/en/stable/" class="external-link" target="_blank">APISpec</a>
Marshmallow and Webargs provide validation, parsing and serialization as plug-ins.
@@ -171,13 +173,13 @@ But then, we have again the problem of having a micro-syntax, inside of a Python
The editor can't help much with that. And if we modify parameters or Marshmallow schemas and forget to also modify that YAML docstring, the generated schema would be obsolete.
!!! info
APISpec was created by the same Marshmallow guys.
APISpec was created by the same Marshmallow developers.
!!! check "Inspired **FastAPI** to"
Support the open standard for APIs, OpenAPI.
### <a href="https://flask-apispec.readthedocs.io/en/latest/" target="_blank">Flask-apispec</a>
### <a href="https://flask-apispec.readthedocs.io/en/latest/" class="external-link" target="_blank">Flask-apispec</a>
It's a Flask plug-in, that ties together Webargs, Marshmallow and APISpec.
@@ -191,19 +193,19 @@ This combination of Flask, Flask-apispec with Marshmallow and Webargs was my fav
Using it led to the creation of several Flask full-stack generators. These are the main stack I (and several external teams) have been using up to now:
* <a href="https://github.com/tiangolo/full-stack" target="_blank">https://github.com/tiangolo/full-stack</a>
* <a href="https://github.com/tiangolo/full-stack-flask-couchbase" target="_blank">https://github.com/tiangolo/full-stack-flask-couchbase</a>
* <a href="https://github.com/tiangolo/full-stack-flask-couchdb" target="_blank">https://github.com/tiangolo/full-stack-flask-couchdb</a>
* <a href="https://github.com/tiangolo/full-stack" class="external-link" target="_blank">https://github.com/tiangolo/full-stack</a>
* <a href="https://github.com/tiangolo/full-stack-flask-couchbase" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-flask-couchbase</a>
* <a href="https://github.com/tiangolo/full-stack-flask-couchdb" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-flask-couchdb</a>
And these same full-stack generators were the base of the <a href="/project-generation/" target="_blank">**FastAPI** project generator</a>.
And these same full-stack generators were the base of the [**FastAPI** Project Generators](project-generation.md){.internal-link target=_blank}.
!!! info
Flask-apispec was created by the same Marshmallow guys.
Flask-apispec was created by the same Marshmallow developers.
!!! check "Inspired **FastAPI** to"
Generate the OpenAPI schema automatically, from the same code that defines serialization and validation.
### <a href="https://nestjs.com/" target="_blank">NestJS</a> (and <a href="https://angular.io/" target="_blank">Angular</a>)
### <a href="https://nestjs.com/" class="external-link" target="_blank">NestJS</a> (and <a href="https://angular.io/" class="external-link" target="_blank">Angular</a>)
This isn't even Python, NestJS is a JavaScript (TypeScript) NodeJS framework inspired by Angular.
@@ -222,21 +224,38 @@ It can't handle nested models very well. So, if the JSON body in the request is
Have a powerful dependency injection system. Find a way to minimize code repetition.
### <a href="https://sanic.readthedocs.io/en/latest/" target="_blank">Sanic</a>
### <a href="https://sanic.readthedocs.io/en/latest/" class="external-link" target="_blank">Sanic</a>
It was one of the first extremely fast Python frameworks based on `asyncio`. It was made to be very similar to Flask.
!!! note "Technical Details"
It used <a href="https://github.com/MagicStack/uvloop" target="_blank">`uvloop`</a> instead of the default Python `asyncio` loop. That's what made it so fast.
It used <a href="https://github.com/MagicStack/uvloop" class="external-link" target="_blank">`uvloop`</a> instead of the default Python `asyncio` loop. That's what made it so fast.
It <a href="https://github.com/huge-success/sanic/issues/761" target="_blank">still doesn't implement the ASGI spec for Python asynchronous web development</a>, but it clearly inspired Uvicorn and Starlette, that are currently faster than Sanic in open benchmarks.
It clearly inspired Uvicorn and Starlette, that are currently faster than Sanic in open benchmarks.
!!! check "Inspired **FastAPI** to"
Find a way to have a crazy performance.
That's why **FastAPI** is based on Starlette, as it is the fastest framework available (tested by third-party benchmarks).
### <a href="https://moltenframework.com/" target="_blank">Molten</a>
### <a href="https://falconframework.org/" class="external-link" target="_blank">Falcon</a>
Falcon is another high performance Python framework, it is designed to be minimal, and work as the foundation of other frameworks like Hug.
It uses the previous standard for Python web frameworks (WSGI) which is synchronous, so it can't handle WebSockets and other use cases. Nevertheless, it also has a very good performance.
It is designed to have functions that receive two parameters, one "request" and one "response". Then you "read" parts from the request, and "write" parts to the response. Because of this design, it is not possible to declare request parameters and bodies with standard Python type hints as function parameters.
So, data validation, serialization, and documentation, have to be done in code, not automatically. Or they have to be implemented as a framework on top of Falcon, like Hug. This same distinction happens in other frameworks that are inspired by Falcon's design, of having one request object and one response object as parameters.
!!! check "Inspired **FastAPI** to"
Find ways to get great performance.
Along with Hug (as Hug is based on Falcon) inspired **FastAPI** to declare a `response` parameter in functions.
Although in FastAPI it's optional, and is used mainly to set headers, cookies, and alternative status codes.
### <a href="https://moltenframework.com/" class="external-link" target="_blank">Molten</a>
I discovered Molten in the first stages of building **FastAPI**. And it has quite similar ideas:
@@ -257,11 +276,35 @@ Routes are declared in a single place, using functions declared in other places
This actually inspired updating parts of Pydantic, to support the same validation declaration style (all this functionality is now already available in Pydantic).
### <a href="https://github.com/encode/apistar" target="_blank">APIStar</a> (<= 0.5)
### <a href="https://www.hug.rest/" class="external-link" target="_blank">Hug</a>
Hug was one of the first frameworks to implement the declaration of API parameter types using Python type hints. This was a great idea that inspired other tools to do the same.
It used custom types in its declarations instead of standard Python types, but it was still a huge step forward.
It also was one of the first frameworks to generate a custom schema declaring the whole API in JSON.
It was not based on a standard like OpenAPI and JSON Schema. So it wouldn't be straightforward to integrate it with other tools, like Swagger UI. But again, it was a very innovative idea.
It has an interesting, uncommon feature: using the same framework, it's possible to create APIs and also CLIs.
As it is based on the previous standard for synchronous Python web frameworks (WSGI), it can't handle Websockets and other things, although it still has high performance too.
!!! info
Hug was created by Timothy Crosley, the same creator of <a href="https://github.com/timothycrosley/isort" class="external-link" target="_blank">`isort`</a>, a great tool to automatically sort imports in Python files.
!!! check "Ideas inspired in **FastAPI**"
Hug inspired parts of APIStar, and was one of the tools I found most promising, alongside APIStar.
Hug helped inspiring **FastAPI** to use Python type hints to declare parameters, and to generate a schema defining the API automatically.
Hug inspired **FastAPI** to declare a `response` parameter in functions to set headers and cookies.
### <a href="https://github.com/encode/apistar" class="external-link" target="_blank">APIStar</a> (<= 0.5)
Right before deciding to build **FastAPI** I found **APIStar** server. It had almost everything I was looking for and had a great design.
It was actually the first implementation of a framework using Python type hints to declare parameters and requests that I ever saw (before NestJS and Molten).
It was one of the first implementations of a framework using Python type hints to declare parameters and requests that I ever saw (before NestJS and Molten). I found it more or less at the same time as Hug. But APIStar used the OpenAPI standard.
It had automatic data validation, data serialization and OpenAPI schema generation based on the same type hints in several places.
@@ -301,7 +344,7 @@ Now APIStar is a set of tools to validate OpenAPI specifications, not a web fram
## Used by **FastAPI**
### <a href="https://pydantic-docs.helpmanual.io/" target="_blank">Pydantic</a>
### <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>
Pydantic is a library to define data validation, serialization and documentation (using JSON Schema) based on Python type hints.
@@ -314,7 +357,7 @@ It is comparable to Marshmallow. Although it's faster than Marshmallow in benchm
**FastAPI** then takes that JSON Schema data and puts it in OpenAPI, apart from all the other things it does.
### <a href="https://www.starlette.io/" target="_blank">Starlette</a>
### <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>
Starlette is a lightweight <abbr title="The new standard for building asynchronous Python web">ASGI</abbr> framework/toolkit, which is ideal for building high-performance asyncio services.
@@ -354,7 +397,7 @@ That's one of the main things that **FastAPI** adds on top, all based on Python
So, anything that you can do with Starlette, you can do it directly with **FastAPI**, as it is basically Starlette on steroids.
### <a href="https://www.uvicorn.org/" target="_blank">Uvicorn</a>
### <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>
Uvicorn is a lightning-fast ASGI server, built on uvloop and httptools.
@@ -365,10 +408,10 @@ It is the recommended server for Starlette and **FastAPI**.
!!! check "**FastAPI** recommends it as"
The main web server to run **FastAPI** applications.
You can combine it with Gunicorn, to have an asynchronous multiprocess server.
You can combine it with Gunicorn, to have an asynchronous multi-process server.
Check more details in the <a href="/deployment/" target="_blank">Deployment</a> section.
Check more details in the [Deployment](deployment/index.md){.internal-link target=_blank} section.
## Benchmarks and speed
To understand, compare, and see the difference between Uvicorn, Starlette and FastAPI, check the section about [Benchmarks](/benchmarks/).
To understand, compare, and see the difference between Uvicorn, Starlette and FastAPI, check the section about [Benchmarks](benchmarks.md){.internal-link target=_blank}.

394
docs/en/docs/async.md Normal file
View File

@@ -0,0 +1,394 @@
# Concurrency and async / await
Details about the `async def` syntax for *path operation functions* and some background about asynchronous code, concurrency, and parallelism.
## In a hurry?
<abbr title="too long; didn't read"><strong>TL;DR:</strong></abbr>
If you are using third party libraries that tell you to call them with `await`, like:
```Python
results = await some_library()
```
Then, declare your *path operation functions* with `async def` like:
```Python hl_lines="2"
@app.get('/')
async def read_results():
results = await some_library()
return results
```
!!! note
You can only use `await` inside of functions created with `async def`.
---
If you are using a third party library that communicates with something (a database, an API, the file system, etc) and doesn't have support for using `await`, (this is currently the case for most database libraries), then declare your *path operation functions* as normally, with just `def`, like:
```Python hl_lines="2"
@app.get('/')
def results():
results = some_library()
return results
```
---
If your application (somehow) doesn't have to communicate with anything else and wait for it to respond, use `async def`.
---
If you just don't know, use normal `def`.
---
**Note**: you can mix `def` and `async def` in your *path operation functions* as much as you need and define each one using the best option for you. FastAPI will do the right thing with them.
Anyway, in any of the cases above, FastAPI will still work asynchronously and be extremely fast.
But by following the steps above, it will be able to do some performance optimizations.
## Technical Details
Modern versions of Python have support for **"asynchronous code"** using something called **"coroutines"**, with **`async` and `await`** syntax.
Let's see that phrase by parts in the sections below:
* **Asynchronous Code**
* **`async` and `await`**
* **Coroutines**
## Asynchronous Code
Asynchronous code just means that the language 💬 has a way to tell the computer / program 🤖 that at some point in the code, it 🤖 will have to wait for *something else* to finish somewhere else. Let's say that *something else* is called "slow-file" 📝.
So, during that time, the computer can go and do some other work, while "slow-file" 📝 finishes.
Then the computer / program 🤖 will come back every time it has a chance because it's waiting again, or whenever it 🤖 finished all the work it had at that point. And it 🤖 will see if any of the tasks it was waiting for have already finished, doing whatever it had to do.
Next, it 🤖 takes the first task to finish (let's say, our "slow-file" 📝) and continues whatever it had to do with it.
That "wait for something else" normally refers to <abbr title="Input and Output">I/O</abbr> operations that are relatively "slow" (compared to the speed of the processor and the RAM memory), like waiting for:
* the data from the client to be sent through the network
* the data sent by your program to be received by the client through the network
* the contents of a file in the disk to be read by the system and given to your program
* the contents your program gave to the system to be written to disk
* a remote API operation
* a database operation to finish
* a database query to return the results
* etc.
As the execution time is consumed mostly by waiting for <abbr title="Input and Output">I/O</abbr> operations, they call them "I/O bound" operations.
It's called "asynchronous" because the computer / program doesn't have to be "synchronized" with the slow task, waiting for the exact moment that the task finishes, while doing nothing, to be able to take the task result and continue the work.
Instead of that, by being an "asynchronous" system, once finished, the task can wait in line a little bit (some microseconds) for the computer / program to finish whatever it went to do, and then come back to take the results and continue working with them.
For "synchronous" (contrary to "asynchronous") they commonly also use the term "sequential", because the computer / program follows all the steps in sequence before switching to a different task, even if those steps involve waiting.
### Concurrency and Burgers
This idea of **asynchronous** code described above is also sometimes called **"concurrency"**. It is different from **"parallelism"**.
**Concurrency** and **parallelism** both relate to "different things happening more or less at the same time".
But the details between *concurrency* and *parallelism* are quite different.
To see the difference, imagine the following story about burgers:
### Concurrent Burgers
You go with your crush 😍 to get fast food 🍔, you stand in line while the cashier 💁 takes the orders from the people in front of you.
Then it's your turn, you place your order of 2 very fancy burgers 🍔 for your crush 😍 and you.
You pay 💸.
The cashier 💁 says something to the guy in the kitchen 👨‍🍳 so he knows he has to prepare your burgers 🍔 (even though he is currently preparing the ones for the previous clients).
The cashier 💁 gives you the number of your turn.
While you are waiting, you go with your crush 😍 and pick a table, you sit and talk with your crush 😍 for a long time (as your burgers are very fancy and take some time to prepare ✨🍔✨).
As you are sitting on the table with your crush 😍, while you wait for the burgers 🍔, you can spend that time admiring how awesome, cute and smart your crush is ✨😍✨.
While waiting and talking to your crush 😍, from time to time, you check the number displayed on the counter to see if it's your turn already.
Then at some point, it finally is your turn. You go to the counter, get your burgers 🍔 and come back to the table.
You and your crush 😍 eat the burgers 🍔 and have a nice time ✨.
---
Imagine you are the computer / program 🤖 in that story.
While you are at the line, you are just idle 😴, waiting for your turn, not doing anything very "productive". But the line is fast because the cashier 💁 is only taking the orders (not preparing them), so that's fine.
Then, when it's your turn, you do actual "productive" work 🤓, you process the menu, decide what you want, get your crush's 😍 choice, pay 💸, check that you give the correct bill or card, check that you are charged correctly, check that the order has the correct items, etc.
But then, even though you still don't have your burgers 🍔, your work with the cashier 💁 is "on pause" ⏸, because you have to wait 🕙 for your burgers to be ready.
But as you go away from the counter and sit on the table with a number for your turn, you can switch 🔀 your attention to your crush 😍, and "work" ⏯ 🤓 on that. Then you are again doing something very "productive" 🤓, as is flirting with your crush 😍.
Then the cashier 💁 says "I'm finished with doing the burgers" 🍔 by putting your number on the counter's display, but you don't jump like crazy immediately when the displayed number changes to your turn number. You know no one will steal your burgers 🍔 because you have the number of your turn, and they have theirs.
So you wait for your crush 😍 to finish the story (finish the current work ⏯ / task being processed 🤓), smile gently and say that you are going for the burgers ⏸.
Then you go to the counter 🔀, to the initial task that is now finished ⏯, pick the burgers 🍔, say thanks and take them to the table. That finishes that step / task of interaction with the counter ⏹. That in turn, creates a new task, of "eating burgers" 🔀 ⏯, but the previous one of "getting burgers" is finished ⏹.
### Parallel Burgers
Now let's imagine these aren't "Concurrent Burgers", but "Parallel Burgers".
You go with your crush 😍 to get parallel fast food 🍔.
You stand in line while several (let's say 8) cashiers that at the same time are cooks 👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳 take the orders from the people in front of you.
Everyone before you is waiting 🕙 for their burgers 🍔 to be ready before leaving the counter because each of the 8 cashiers goes himself and prepares the burger right away before getting the next order.
Then it's finally your turn, you place your order of 2 very fancy burgers 🍔 for your crush 😍 and you.
You pay 💸.
The cashier goes to the kitchen 👨‍🍳.
You wait, standing in front of the counter 🕙, so that no one else takes your burgers 🍔 before you do, as there are no numbers for turns.
As you and your crush 😍 are busy not letting anyone get in front of you and take your burgers whenever they arrive 🕙, you cannot pay attention to your crush 😞.
This is "synchronous" work, you are "synchronized" with the cashier/cook 👨‍🍳. You have to wait 🕙 and be there at the exact moment that the cashier/cook 👨‍🍳 finishes the burgers 🍔 and gives them to you, or otherwise, someone else might take them.
Then your cashier/cook 👨‍🍳 finally comes back with your burgers 🍔, after a long time waiting 🕙 there in front of the counter.
You take your burgers 🍔 and go to the table with your crush 😍.
You just eat them, and you are done 🍔 ⏹.
There was not much talk or flirting as most of the time was spent waiting 🕙 in front of the counter 😞.
---
In this scenario of the parallel burgers, you are a computer / program 🤖 with two processors (you and your crush 😍), both waiting 🕙 and dedicating their attention ⏯ to be "waiting on the counter" 🕙 for a long time.
The fast food store has 8 processors (cashiers/cooks) 👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳. While the concurrent burgers store might have had only 2 (one cashier and one cook) 💁 👨‍🍳.
But still, the final experience is not the best 😞.
---
This would be the parallel equivalent story for burgers 🍔.
For a more "real life" example of this, imagine a bank.
Up to recently, most of the banks had multiple cashiers 👨‍💼👨‍💼👨‍💼👨‍💼 and a big line 🕙🕙🕙🕙🕙🕙🕙🕙.
All of the cashiers doing all the work with one client after the other 👨‍💼⏯.
And you have to wait 🕙 in the line for a long time or you lose your turn.
You probably wouldn't want to take your crush 😍 with you to do errands at the bank 🏦.
### Burger Conclusion
In this scenario of "fast food burgers with your crush", as there is a lot of waiting 🕙, it makes a lot more sense to have a concurrent system ⏸🔀⏯.
This is the case for most of the web applications.
Many, many users, but your server is waiting 🕙 for their not-so-good connection to send their requests.
And then waiting 🕙 again for the responses to come back.
This "waiting" 🕙 is measured in microseconds, but still, summing it all, it's a lot of waiting in the end.
That's why it makes a lot of sense to use asynchronous ⏸🔀⏯ code for web APIs.
Most of the existing popular Python frameworks (including Flask and Django) were created before the new asynchronous features in Python existed. So, the ways they can be deployed support parallel execution and an older form of asynchronous execution that is not as powerful as the new capabilities.
Even though the main specification for asynchronous web Python (ASGI) was developed at Django, to add support for WebSockets.
That kind of asynchronicity is what made NodeJS popular (even though NodeJS is not parallel) and that's the strength of Go as a programming language.
And that's the same level of performance you get with **FastAPI**.
And as you can have parallelism and asynchronicity at the same time, you get higher performance than most of the tested NodeJS frameworks and on par with Go, which is a compiled language closer to C <a href="https://www.techempower.com/benchmarks/#section=data-r17&hw=ph&test=query&l=zijmkf-1" class="external-link" target="_blank">(all thanks to Starlette)</a>.
### Is concurrency better than parallelism?
Nope! That's not the moral of the story.
Concurrency is different than parallelism. And it is better on **specific** scenarios that involve a lot of waiting. Because of that, it generally is a lot better than parallelism for web application development. But not for everything.
So, to balance that out, imagine the following short story:
> You have to clean a big, dirty house.
*Yep, that's the whole story*.
---
There's no waiting 🕙 anywhere, just a lot of work to be done, on multiple places of the house.
You could have turns as in the burgers example, first the living room, then the kitchen, but as you are not waiting 🕙 for anything, just cleaning and cleaning, the turns wouldn't affect anything.
It would take the same amount of time to finish with or without turns (concurrency) and you would have done the same amount of work.
But in this case, if you could bring the 8 ex-cashier/cooks/now-cleaners 👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳, and each one of them (plus you) could take a zone of the house to clean it, you could do all the work in **parallel**, with the extra help, and finish much sooner.
In this scenario, each one of the cleaners (including you) would be a processor, doing their part of the job.
And as most of the execution time is taken by actual work (instead of waiting), and the work in a computer is done by a <abbr title="Central Processing Unit">CPU</abbr>, they call these problems "CPU bound".
---
Common examples of CPU bound operations are things that require complex math processing.
For example:
* **Audio** or **image processing**.
* **Computer vision**: an image is composed of millions of pixels, each pixel has 3 values / colors, processing that normally requires computing something on those pixels, all at the same time.
* **Machine Learning**: it normally requires lots of "matrix" and "vector" multiplications. Think of a huge spreadsheet with numbers and multiplying all of them together at the same time.
* **Deep Learning**: this is a sub-field of Machine Learning, so, the same applies. It's just that there is not a single spreadsheet of numbers to multiply, but a huge set of them, and in many cases, you use a special processor to build and / or use those models.
### Concurrency + Parallelism: Web + Machine Learning
With **FastAPI** you can take the advantage of concurrency that is very common for web development (the same main attractive of NodeJS).
But you can also exploit the benefits of parallelism and multiprocessing (having multiple processes running in parallel) for **CPU bound** workloads like those in Machine Learning systems.
That, plus the simple fact that Python is the main language for **Data Science**, Machine Learning and especially Deep Learning, make FastAPI a very good match for Data Science / Machine Learning web APIs and applications (among many others).
To see how to achieve this parallelism in production see the section about [Deployment](deployment/index.md){.internal-link target=_blank}.
## `async` and `await`
Modern versions of Python have a very intuitive way to define asynchronous code. This makes it look just like normal "sequential" code and do the "awaiting" for you at the right moments.
When there is an operation that will require waiting before giving the results and has support for these new Python features, you can code it like:
```Python
burgers = await get_burgers(2)
```
The key here is the `await`. It tells Python that it has to wait ⏸ for `get_burgers(2)` to finish doing its thing 🕙 before storing the results in `burgers`. With that, Python will know that it can go and do something else 🔀 ⏯ in the meanwhile (like receiving another request).
For `await` to work, it has to be inside a function that supports this asynchronicity. To do that, you just declare it with `async def`:
```Python hl_lines="1"
async def get_burgers(number: int):
# Do some asynchronous stuff to create the burgers
return burgers
```
...instead of `def`:
```Python hl_lines="2"
# This is not asynchronous
def get_sequential_burgers(number: int):
# Do some sequential stuff to create the burgers
return burgers
```
With `async def`, Python knows that, inside that function, it has to be aware of `await` expressions, and that it can "pause" ⏸ the execution of that function and go do something else 🔀 before coming back.
When you want to call an `async def` function, you have to "await" it. So, this won't work:
```Python
# This won't work, because get_burgers was defined with: async def
burgers = get_burgers(2)
```
---
So, if you are using a library that tells you that you can call it with `await`, you need to create the *path operation functions* that uses it with `async def`, like in:
```Python hl_lines="2-3"
@app.get('/burgers')
async def read_burgers():
burgers = await get_burgers(2)
return burgers
```
### More technical details
You might have noticed that `await` can only be used inside of functions defined with `async def`.
But at the same time, functions defined with `async def` have to be "awaited". So, functions with `async def` can only be called inside of functions defined with `async def` too.
So, about the egg and the chicken, how do you call the first `async` function?
If you are working with **FastAPI** you don't have to worry about that, because that "first" function will be your *path operation function*, and FastAPI will know how to do the right thing.
But if you want to use `async` / `await` without FastAPI, <a href="https://docs.python.org/3/library/asyncio-task.html#coroutine" class="external-link" target="_blank">check the official Python docs</a>.
### Other forms of asynchronous code
This style of using `async` and `await` is relatively new in the language.
But it makes working with asynchronous code a lot easier.
This same syntax (or almost identical) was also included recently in modern versions of JavaScript (in Browser and NodeJS).
But before that, handling asynchronous code was quite more complex and difficult.
In previous versions of Python, you could have used threads or <a href="https://www.gevent.org/" class="external-link" target="_blank">Gevent</a>. But the code is way more complex to understand, debug, and think about.
In previous versions of NodeJS / Browser JavaScript, you would have used "callbacks". Which leads to <a href="http://callbackhell.com/" class="external-link" target="_blank">callback hell</a>.
## Coroutines
**Coroutine** is just the very fancy term for the thing returned by an `async def` function. Python knows that it is something like a function that it can start and that it will end at some point, but that it might be paused ⏸ internally too, whenever there is an `await` inside of it.
But all this functionality of using asynchronous code with `async` and `await` is many times summarized as using "coroutines". It is comparable to the main key feature of Go, the "Goroutines".
## Conclusion
Let's see the same phrase from above:
> Modern versions of Python have support for **"asynchronous code"** using something called **"coroutines"**, with **`async` and `await`** syntax.
That should make more sense now. ✨
All that is what powers FastAPI (through Starlette) and what makes it have such an impressive performance.
## Very Technical Details
!!! warning
You can probably skip this.
These are very technical details of how **FastAPI** works underneath.
If you have quite some technical knowledge (co-routines, threads, blocking, etc) and are curious about how FastAPI handles `async def` vs normal `def`, go ahead.
### Path operation functions
When you declare a *path operation function* with normal `def` instead of `async def`, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).
If you are coming from another async framework that does not work in the way described above and you are used to define trivial compute-only *path operation functions* with plain `def` for a tiny performance gain (about 100 nanoseconds), please note that in **FastAPI** the effect would be quite opposite. In these cases, it's better to use `async def` unless your *path operation functions* use code that performs blocking <abbr title="Input/Output: disk reading or writing, network communications.">I/O</abbr>.
Still, in both situations, chances are that **FastAPI** will [still be faster](/#performance){.internal-link target=_blank} than (or at least comparable to) your previous framework.
### Dependencies
The same applies for dependencies. If a dependency is a standard `def` function instead of `async def`, it is run in the external threadpool.
### Sub-dependencies
You can have multiple dependencies and sub-dependencies requiring each other (as parameters of the function definitions), some of them might be created with `async def` and some with normal `def`. It would still work, and the ones created with normal `def` would be called on an external thread (from the threadpool) instead of being "awaited".
### Other utility functions
Any other utility function that you call directly can be created with normal `def` or `async def` and FastAPI won't affect the way you call it.
This is in contrast to the functions that FastAPI calls for you: *path operation functions* and dependencies.
If your utility function is a normal function with `def`, it will be called directly (as you write it in your code), not in a threadpool, if the function is created with `async def` then you should `await` for that function when you call it in your code.
---
Again, these are very technical details that would probably be useful if you came searching for them.
Otherwise, you should be good with the guidelines from the section above: <a href="#in-a-hurry">In a hurry?</a>.

View File

@@ -1,4 +1,6 @@
Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <a href="https://www.techempower.com/benchmarks/#section=test&runid=a979de55-980d-4721-a46f-77298b3f3923&hw=ph&test=fortune&l=zijzen-7" target="_blank">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
# Benchmarks
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). (*)
But when checking benchmarks and comparisons you should have the following in mind.
@@ -8,7 +10,7 @@ When you check the benchmarks, it is common to see several tools of different ty
Specifically, to see Uvicorn, Starlette and FastAPI compared together (among many other tools).
The simplest the problem solved by the tool, the better performance it will get. And most of the benchmarks don't test the additional features provided by the tool.
The simpler the problem solved by the tool, the better performance it will get. And most of the benchmarks don't test the additional features provided by the tool.
The hierarchy is like:

View File

@@ -0,0 +1,501 @@
# Development - Contributing
First, you might want to see the basic ways to [help FastAPI and get help](help-fastapi.md){.internal-link target=_blank}.
## Developing
If you already cloned the repository and you know that you need to deep dive in the code, here are some guidelines to set up your environment.
### Virtual environment with `venv`
You can create a virtual environment in a directory using Python's `venv` module:
<div class="termy">
```console
$ python -m venv env
```
</div>
That will create a directory `./env/` with the Python binaries and then you will be able to install packages for that isolated environment.
### Activate the environment
Activate the new environment with:
=== "Linux, macOS"
<div class="termy">
```console
$ source ./env/bin/activate
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ .\env\Scripts\Activate.ps1
```
</div>
=== "Windows Bash"
Or if you use Bash for Windows (e.g. <a href="https://gitforwindows.org/" class="external-link" target="_blank">Git Bash</a>):
<div class="termy">
```console
$ source ./env/Scripts/activate
```
</div>
To check it worked, use:
=== "Linux, macOS, Windows Bash"
<div class="termy">
```console
$ which pip
some/directory/fastapi/env/bin/pip
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ Get-Command pip
some/directory/fastapi/env/bin/pip
```
</div>
If it shows the `pip` binary at `env/bin/pip` then it worked. 🎉
!!! tip
Every time you install a new package with `pip` under that environment, activate the environment again.
This makes sure that if you use a terminal program installed by that package (like `flit`), you use the one from your local environment and not any other that could be installed globally.
### Flit
**FastAPI** uses <a href="https://flit.readthedocs.io/en/latest/index.html" class="external-link" target="_blank">Flit</a> to build, package and publish the project.
After activating the environment as described above, install `flit`:
<div class="termy">
```console
$ pip install flit
---> 100%
```
</div>
Now re-activate the environment to make sure you are using the `flit` you just installed (and not a global one).
And now use `flit` to install the development dependencies:
=== "Linux, macOS"
<div class="termy">
```console
$ flit install --deps develop --symlink
---> 100%
```
</div>
=== "Windows"
If you are on Windows, use `--pth-file` instead of `--symlink`:
<div class="termy">
```console
$ flit install --deps develop --pth-file
---> 100%
```
</div>
It will install all the dependencies and your local FastAPI in your local environment.
#### Using your local FastAPI
If you create a Python file that imports and uses FastAPI, and run it with the Python from your local environment, it will use your local FastAPI source code.
And if you update that local FastAPI source code, as it is installed with `--symlink` (or `--pth-file` on Windows), when you run that Python file again, it will use the fresh version of FastAPI you just edited.
That way, you don't have to "install" your local version to be able to test every change.
### Format
There is a script that you can run that will format and clean all your code:
<div class="termy">
```console
$ bash scripts/format.sh
```
</div>
It will also auto-sort all your imports.
For it to sort them correctly, you need to have FastAPI installed locally in your environment, with the command in the section above using `--symlink` (or `--pth-file` on Windows).
### Format imports
There is another script that formats all the imports and makes sure you don't have unused imports:
<div class="termy">
```console
$ bash scripts/format-imports.sh
```
</div>
As it runs one command after the other and modifies and reverts many files, it takes a bit longer to run, so it might be easier to use `scripts/format.sh` frequently and `scripts/format-imports.sh` only before committing.
## Docs
First, make sure you set up your environment as described above, that will install all the requirements.
The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.
And there are extra tools/scripts in place to handle translations in `./scripts/docs.py`.
!!! tip
You don't need to see the code in `./scripts/docs.py`, you just use it in the command line.
All the documentation is in Markdown format in the directory `./docs/en/`.
Many of the tutorials have blocks of code.
In most of the cases, these blocks of code are actual complete applications that can be run as is.
In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs_src/` directory.
And those Python files are included/injected in the documentation when generating the site.
### Docs for tests
Most of the tests actually run against the example source files in the documentation.
This helps making sure that:
* The documentation is up to date.
* The documentation examples can be run as is.
* Most of the features are covered by the documentation, ensured by test coverage.
During local development, there is a script that builds the site and checks for any changes, live-reloading:
<div class="termy">
```console
$ python ./scripts/docs.py live
<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes
```
</div>
It will serve the documentation on `http://127.0.0.1:8008`.
That way, you can edit the documentation/source files and see the changes live.
#### Typer CLI (optional)
The instructions here show you how to use the script at `./scripts/docs.py` with the `python` program directly.
But you can also use <a href="https://typer.tiangolo.com/typer-cli/" class="external-link" target="_blank">Typer CLI</a>, and you will get autocompletion in your terminal for the commands after installing completion.
If you install Typer CLI, you can install completion with:
<div class="termy">
```console
$ typer --install-completion
zsh completion installed in /home/user/.bashrc.
Completion will take effect once you restart the terminal.
```
</div>
### Apps and docs at the same time
If you run the examples with, e.g.:
<div class="termy">
```console
$ uvicorn tutorial001:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
as Uvicorn by default will use the port `8000`, the documentation on port `8008` won't clash.
### Translations
Help with translations is VERY MUCH appreciated! And it can't be done without the help from the community. 🌎 🚀
Here are the steps to help with translations.
#### Tips and guidelines
* Check the currently <a href="https://github.com/tiangolo/fastapi/pulls" class="external-link" target="_blank">existing pull requests</a> for your language and add reviews requesting changes or approving them.
!!! tip
You can <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request" class="external-link" target="_blank">add comments with change suggestions</a> to existing pull requests.
Check the docs about <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews" class="external-link" target="_blank">adding a pull request review</a> to approve it or request changes.
* Check in the <a href="https://github.com/tiangolo/fastapi/issues" class="external-link" target="_blank">issues</a> to see if there's one coordinating translations for your language.
* Add a single pull request per page translated. That will make it much easier for others to review it.
For the languages I don't speak, I'll wait for several others to review the translation before merging.
* You can also check if there are translations for your language and add a review to them, that will help me know that the translation is correct and I can merge it.
* Use the same Python examples and only translate the text in the docs. You don't have to change anything for this to work.
* Use the same images, file names, and links. You don't have to change anything for it to work.
* To check the 2-letter code for the language you want to translate you can use the table <a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes" class="external-link" target="_blank">List of ISO 639-1 codes</a>.
#### Existing language
Let's say you want to translate a page for a language that already has translations for some pages, like Spanish.
In the case of Spanish, the 2-letter code is `es`. So, the directory for Spanish translations is located at `docs/es/`.
!!! tip
The main ("official") language is English, located at `docs/en/`.
Now run the live server for the docs in Spanish:
<div class="termy">
```console
// Use the command "live" and pass the language code as a CLI argument
$ python ./scripts/docs.py live es
<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes
```
</div>
Now you can go to <a href="http://127.0.0.1:8008" class="external-link" target="_blank">http://127.0.0.1:8008</a> and see your changes live.
If you look at the FastAPI docs website, you will see that every language has all the pages. But some pages are not translated and have a notification about the missing translation.
But when you run it locally like this, you will only see the pages that are already translated.
Now let's say that you want to add a translation for the section [Features](features.md){.internal-link target=_blank}.
* Copy the file at:
```
docs/en/docs/features.md
```
* Paste it in exactly the same location but for the language you want to translate, e.g.:
```
docs/es/docs/features.md
```
!!! tip
Notice that the only change in the path and file name is the language code, from `en` to `es`.
* Now open the MkDocs config file for English at:
```
docs/en/docs/mkdocs.yml
```
* Find the place where that `docs/features.md` is located in the config file. Somewhere like:
```YAML hl_lines="8"
site_name: FastAPI
# More stuff
nav:
- FastAPI: index.md
- Languages:
- en: /
- es: /es/
- features.md
```
* Open the MkDocs config file for the language you are editing, e.g.:
```
docs/es/docs/mkdocs.yml
```
* Add it there at the exact same location it was for English, e.g.:
```YAML hl_lines="8"
site_name: FastAPI
# More stuff
nav:
- FastAPI: index.md
- Languages:
- en: /
- es: /es/
- features.md
```
Make sure that if there are other entries, the new entry with your translation is exactly in the same order as in the English version.
If you go to your browser you will see that now the docs show your new section. 🎉
Now you can translate it all and see how it looks as you save the file.
#### New Language
Let's say that you want to add translations for a language that is not yet translated, not even some pages.
Let's say you want to add translations for Creole, and it's not yet there in the docs.
Checking the link from above, the code for "Creole" is `ht`.
The next step is to run the script to generate a new translation directory:
<div class="termy">
```console
// Use the command new-lang, pass the language code as a CLI argument
$ python ./scripts/docs.py new-lang ht
Successfully initialized: docs/ht
Updating ht
Updating en
```
</div>
Now you can check in your code editor the newly created directory `docs/ht/`.
!!! tip
Create a first pull request with just this, to set up the configuration for the new language, before adding translations.
That way others can help with other pages while you work on the first one. 🚀
Start by translating the main page, `docs/ht/index.md`.
Then you can continue with the previous instructions, for an "Existing Language".
##### New Language not supported
If when running the live server script you get an error about the language not being supported, something like:
```
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: partials/language/xx.html
```
That means that the theme doesn't support that language (in this case, with a fake 2-letter code of `xx`).
But don't worry, you can set the theme language to English and then translate the content of the docs.
If you need to do that, edit the `mkdocs.yml` for your new language, it will have something like:
```YAML hl_lines="5"
site_name: FastAPI
# More stuff
theme:
# More stuff
language: xx
```
Change that language from `xx` (from your language code) to `en`.
Then you can start the live server again.
#### Preview the result
When you use the script at `./scripts/docs.py` with the `live` command it only shows the files and translations available for the current language.
But once you are done, you can test it all as it would look online.
To do that, first build all the docs:
<div class="termy">
```console
// Use the command "build-all", this will take a bit
$ python ./scripts/docs.py build-all
Updating es
Updating en
Building docs for: en
Building docs for: es
Successfully built docs for: es
Copying en index.md to README.md
```
</div>
That generates all the docs at `./docs_build/` for each language. This includes adding any files with missing translations, with a note saying that "this file doesn't have a translation yet". But you don't have to do anything with that directory.
Then it builds all those independent MkDocs sites for each language, combines them, and generates the final output at `./site/`.
Then you can serve that with the command `serve`:
<div class="termy">
```console
// Use the command "serve" after running "build-all"
$ python ./scripts/docs.py serve
Warning: this is a very simple server. For development, use mkdocs serve instead.
This is here only to preview a site with translations already built.
Make sure you run the build-all command first.
Serving at: http://127.0.0.1:8008
```
</div>
## Tests
There is a script that you can run locally to test all the code and generate coverage reports in HTML:
<div class="termy">
```console
$ bash scripts/test-cov-html.sh
```
</div>
This command generates a directory `./htmlcov/`, if you open the file `./htmlcov/index.html` in your browser, you can explore interactively the regions of code that are covered by the tests, and notice if there is any region missing.

101
docs/en/docs/css/custom.css Normal file
View File

@@ -0,0 +1,101 @@
a.external-link::after {
/* \00A0 is a non-breaking space
to make the mark be on the same line as the link
*/
content: "\00A0[↪]";
}
a.internal-link::after {
/* \00A0 is a non-breaking space
to make the mark be on the same line as the link
*/
content: "\00A0↪";
}
/* Give space to lower icons so Gitter chat doesn't get on top of them */
.md-footer-meta {
padding-bottom: 2em;
}
.user-list {
display: flex;
flex-wrap: wrap;
}
.user-list-center {
justify-content: space-evenly;
}
.user {
margin: 1em;
min-width: 7em;
}
.user .avatar-wrapper {
width: 80px;
height: 80px;
margin: 10px auto;
overflow: hidden;
border-radius: 50%;
position: relative;
}
.user .avatar-wrapper img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.user .title {
text-align: center;
}
.user .count {
font-size: 80%;
text-align: center;
}
a.announce-link:link,
a.announce-link:visited {
color: #fff;
}
a.announce-link:hover {
color: var(--md-accent-fg-color);
}
.announce-wrapper {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
}
.announce-wrapper div.item {
display: none;
}
.announce-wrapper .sponsor-badge {
display: block;
position: absolute;
top: -5px;
right: 0;
font-size: 0.5rem;
color: #999;
background-color: #666;
border-radius: 10px;
padding: 0 10px;
z-index: 10;
}
.announce-wrapper .sponsor-image {
display: block;
border-radius: 20px;
}
.announce-wrapper>div {
min-height: 40px;
display: flex;
align-items: center;
}

View File

@@ -0,0 +1,108 @@
/**
* termynal.js
*
* @author Ines Montani <ines@ines.io>
* @version 0.0.1
* @license MIT
*/
:root {
--color-bg: #252a33;
--color-text: #eee;
--color-text-subtle: #a2a2a2;
}
[data-termynal] {
width: 750px;
max-width: 100%;
background: var(--color-bg);
color: var(--color-text);
font-size: 18px;
/* font-family: 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace; */
font-family: 'Roboto Mono', 'Fira Mono', Consolas, Menlo, Monaco, 'Courier New', Courier, monospace;
border-radius: 4px;
padding: 75px 45px 35px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
[data-termynal]:before {
content: '';
position: absolute;
top: 15px;
left: 15px;
display: inline-block;
width: 15px;
height: 15px;
border-radius: 50%;
/* A little hack to display the window buttons in one pseudo element. */
background: #d9515d;
-webkit-box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
box-shadow: 25px 0 0 #f4c025, 50px 0 0 #3ec930;
}
[data-termynal]:after {
content: 'bash';
position: absolute;
color: var(--color-text-subtle);
top: 5px;
left: 0;
width: 100%;
text-align: center;
}
a[data-terminal-control] {
text-align: right;
display: block;
color: #aebbff;
}
[data-ty] {
display: block;
line-height: 2;
}
[data-ty]:before {
/* Set up defaults and ensure empty lines are displayed. */
content: '';
display: inline-block;
vertical-align: middle;
}
[data-ty="input"]:before,
[data-ty-prompt]:before {
margin-right: 0.75em;
color: var(--color-text-subtle);
}
[data-ty="input"]:before {
content: '$';
}
[data-ty][data-ty-prompt]:before {
content: attr(data-ty-prompt);
}
[data-ty-cursor]:after {
content: attr(data-ty-cursor);
font-family: monospace;
margin-left: 0.5em;
-webkit-animation: blink 1s infinite;
animation: blink 1s infinite;
}
/* Cursor animation */
@-webkit-keyframes blink {
50% {
opacity: 0;
}
}
@keyframes blink {
50% {
opacity: 0;
}
}

View File

@@ -0,0 +1,240 @@
# Deploy FastAPI on Deta
In this section you will learn how to easily deploy a **FastAPI** application on <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> using the free plan. 🎁
It will take you about **10 minutes**.
!!! info
<a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> is a **FastAPI** sponsor. 🎉
## A basic **FastAPI** app
* Create a directory for your app, for example `./fastapideta/` and enter in it.
### FastAPI code
* Create a `main.py` file with:
```Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int):
return {"item_id": item_id}
```
### Requirements
Now, in the same directory create a file `requirements.txt` with:
```text
fastapi
```
!!! tip
You don't need to install Uvicorn to deploy on Deta, although you would probably want to install it locally to test your app.
### Directory structure
You will now have one directory `./fastapideta/` with two files:
```
.
└── main.py
└── requirements.txt
```
## Create a free Deta account
Now create a <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">free account on Deta</a>, you just need an email and password.
You don't even need a credit card.
## Install the CLI
Once you have your account, install the Deta <abbr title="Command Line Interface application">CLI</abbr>:
=== "Linux, macOS"
<div class="termy">
```console
$ curl -fsSL https://get.deta.dev/cli.sh | sh
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ iwr https://get.deta.dev/cli.ps1 -useb | iex
```
</div>
After installing it, open a new terminal so that the installed CLI is detected.
In a new terminal, confirm that it was correctly installed with:
<div class="termy">
```console
$ deta --help
Deta command line interface for managing deta micros.
Complete documentation available at https://docs.deta.sh
Usage:
deta [flags]
deta [command]
Available Commands:
auth Change auth settings for a deta micro
...
```
</div>
!!! tip
If you have problems installing the CLI, check the <a href="https://docs.deta.sh/docs/micros/getting_started?ref=fastapi" class="external-link" target="_blank">official Deta docs</a>.
## Login with the CLI
Now login to Deta from the CLI with:
<div class="termy">
```console
$ deta login
Please, log in from the web page. Waiting..
Logged in successfully.
```
</div>
This will open a web browser and authenticate automatically.
## Deploy with Deta
Next, deploy your application with the Deta CLI:
<div class="termy">
```console
$ deta new
Successfully created a new micro
// Notice the "endpoint" 🔍
{
"name": "fastapideta",
"runtime": "python3.7",
"endpoint": "https://qltnci.deta.dev",
"visor": "enabled",
"http_auth": "enabled"
}
Adding dependencies...
---> 100%
Successfully installed fastapi-0.61.1 pydantic-1.7.2 starlette-0.13.6
```
</div>
You will see a JSON message similar to:
```JSON hl_lines="4"
{
"name": "fastapideta",
"runtime": "python3.7",
"endpoint": "https://qltnci.deta.dev",
"visor": "enabled",
"http_auth": "enabled"
}
```
!!! tip
Your deployment will have a different `"endpoint"` URL.
## Check it
Now open your browser in your `endpoint` URL. In the example above it was `https://qltnci.deta.dev`, but yours will be different.
You will see the JSON response from your FastAPI app:
```JSON
{
"Hello": "World"
}
```
And now go to the `/docs` for your API, in the example above it would be `https://qltnci.deta.dev/docs`.
It will show your docs like:
<img src="/img/deployment/deta/image01.png">
## Enable public access
By default, Deta will handle authentication using cookies for your account.
But once you are ready, you can make it public with:
<div class="termy">
```console
$ deta auth disable
Successfully disabled http auth
```
</div>
Now you can share that URL with anyone and they will be able to access your API. 🚀
## HTTPS
Congrats! You deployed your FastAPI app to Deta! 🎉 🍰
Also notice that Deta correctly handles HTTPS for you, so you don't have to take care of that and can be sure that your clients will have a secure encrypted connection. ✅ 🔒
## Check the Visor
From your docs UI (they will be in a URL like `https://qltnci.deta.dev/docs`) send a request to your *path operation* `/items/{item_id}`.
For example with ID `5`.
Now go to <a href="https://web.deta.sh/" class="external-link" target="_blank">https://web.deta.sh</a>.
You will see there's a section to the left called <abbr title="it comes from Micro(server)">"Micros"</abbr> with each of your apps.
You will see a tab with "Details", and also a tab "Visor", go to the tab "Visor".
In there you can inspect the recent requests sent to your app.
You can also edit them and re-play them.
<img src="/img/deployment/deta/image02.png">
## Learn more
At some point you will probably want to store some data for your app in a way that persists through time. For that you can use <a href="https://docs.deta.sh/docs/base/py_tutorial?ref=fastapi" class="external-link" target="_blank">Deta Base</a>, it also has a generous **free tier**.
You can also read more in the <a href="https://docs.deta.sh?ref=fastapi" class="external-link" target="_blank">Deta Docs</a>.

View File

@@ -0,0 +1,179 @@
# Deploy with Docker
In this section you'll see instructions and links to guides to know how to:
* Make your **FastAPI** application a Docker image/container with maximum performance. In about **5 min**.
* (Optionally) understand what you, as a developer, need to know about HTTPS.
* Set up a Docker Swarm mode cluster with automatic HTTPS, even on a simple $5 USD/month server. In about **20 min**.
* Generate and deploy a full **FastAPI** application, using your Docker Swarm cluster, with HTTPS, etc. In about **10 min**.
You can use <a href="https://www.docker.com/" class="external-link" target="_blank">**Docker**</a> for deployment. It has several advantages like security, replicability, development simplicity, etc.
If you are using Docker, you can use the official Docker image:
## <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>
This image has an "auto-tuning" mechanism included, so that you can just add your code and get very high performance automatically. And without making sacrifices.
But you can still change and update all the configurations with environment variables or configuration files.
!!! tip
To see all the configurations and options, go to the Docker image page: <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>.
## Create a `Dockerfile`
* Go to your project directory.
* Create a `Dockerfile` with:
```Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
COPY ./app /app
```
### Bigger Applications
If you followed the section about creating [Bigger Applications with Multiple Files](../tutorial/bigger-applications.md){.internal-link target=_blank}, your `Dockerfile` might instead look like:
```Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
COPY ./app /app/app
```
### Raspberry Pi and other architectures
If you are running Docker in a Raspberry Pi (that has an ARM processor) or any other architecture, you can create a `Dockerfile` from scratch, based on a Python base image (that is multi-architecture) and use Uvicorn alone.
In this case, your `Dockerfile` could look like:
```Dockerfile
FROM python:3.7
RUN pip install fastapi uvicorn
EXPOSE 80
COPY ./app /app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
```
## Create the **FastAPI** Code
* Create an `app` directory and enter in it.
* Create a `main.py` file with:
```Python
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
* You should now have a directory structure like:
```
.
├── app
│ └── main.py
└── Dockerfile
```
## Build the Docker image
* Go to the project directory (in where your `Dockerfile` is, containing your `app` directory).
* Build your FastAPI image:
<div class="termy">
```console
$ docker build -t myimage .
---> 100%
```
</div>
## Start the Docker container
* Run a container based on your image:
<div class="termy">
```console
$ docker run -d --name mycontainer -p 80:80 myimage
```
</div>
Now you have an optimized FastAPI server in a Docker container. Auto-tuned for your current server (and number of CPU cores).
## Check it
You should be able to check it in your Docker container's URL, for example: <a href="http://192.168.99.100/items/5?q=somequery" class="external-link" target="_blank">http://192.168.99.100/items/5?q=somequery</a> or <a href="http://127.0.0.1/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1/items/5?q=somequery</a> (or equivalent, using your Docker host).
You will see something like:
```JSON
{"item_id": 5, "q": "somequery"}
```
## Interactive API docs
Now you can go to <a href="http://192.168.99.100/docs" class="external-link" target="_blank">http://192.168.99.100/docs</a> or <a href="http://127.0.0.1/docs" class="external-link" target="_blank">http://127.0.0.1/docs</a> (or equivalent, using your Docker host).
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>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
## Alternative API docs
And you can also go to <a href="http://192.168.99.100/redoc" class="external-link" target="_blank">http://192.168.99.100/redoc</a> or <a href="http://127.0.0.1/redoc" class="external-link" target="_blank">http://127.0.0.1/redoc</a> (or equivalent, using your Docker host).
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Traefik
<a href="https://traefik.io/" class="external-link" target="_blank">Traefik</a> is a high performance reverse proxy / load balancer. It can do the "TLS Termination Proxy" job (apart from other features).
It has integration with Let's Encrypt. So, it can handle all the HTTPS parts, including certificate acquisition and renewal.
It also has integrations with Docker. So, you can declare your domains in each application configurations and have it read those configurations, generate the HTTPS certificates and serve HTTPS to your application automatically, without requiring any change in its configuration.
---
With this information and tools, continue with the next section to combine everything.
## Docker Swarm mode cluster with Traefik and HTTPS
You can have a Docker Swarm mode cluster set up in minutes (about 20 min) with a main Traefik handling HTTPS (including certificate acquisition and renewal).
By using Docker Swarm mode, you can start with a "cluster" of a single machine (it can even be a $5 USD / month server) and then you can grow as much as you need adding more servers.
To set up a Docker Swarm Mode cluster with Traefik and HTTPS handling, follow this guide:
### <a href="https://medium.com/@tiangolo/docker-swarm-mode-and-traefik-for-a-https-cluster-20328dba6232" class="external-link" target="_blank">Docker Swarm Mode and Traefik for an HTTPS cluster</a>
### Deploy a FastAPI application
The easiest way to set everything up, would be using the [**FastAPI** Project Generators](../project-generation.md){.internal-link target=_blank}.
It is designed to be integrated with this Docker Swarm cluster with Traefik and HTTPS described above.
You can generate a project in about 2 min.
The generated project has instructions to deploy it, doing it takes another 2 min.

View File

@@ -0,0 +1,48 @@
# About HTTPS
It is easy to assume that HTTPS is something that is just "enabled" or not.
But it is way more complex than that.
!!! tip
If you are in a hurry or don't care, continue with the next sections for step by step instructions to set everything up with different techniques.
To learn the basics of HTTPS, from a consumer perspective, check <a href="https://howhttps.works/" class="external-link" target="_blank">https://howhttps.works/</a>.
Now, from a developer's perspective, here are several things to have in mind while thinking about HTTPS:
* For HTTPS, the server needs to have "certificates" generated by a third party.
* Those certificates are actually acquired from the third-party, not "generated".
* Certificates have a lifetime.
* They expire.
* And then they need to be renewed, acquired again from the third party.
* The encryption of the connection happens at the TCP level.
* That's one layer below HTTP.
* So, the certificate and encryption handling is done before HTTP.
* TCP doesn't know about "domains". Only about IP addresses.
* The information about the specific domain requested goes in the HTTP data.
* The HTTPS certificates "certify" a certain domain, but the protocol and encryption happen at the TCP level, before knowing which domain is being dealt with.
* By default, that would mean that you can only have one HTTPS certificate per IP address.
* No matter how big your server is or how small each application you have on it might be.
* There is a solution to this, however.
* There's an extension to the TLS protocol (the one handling the encryption at the TCP level, before HTTP) called <a href="https://en.wikipedia.org/wiki/Server_Name_Indication" class="external-link" target="_blank"><abbr title="Server Name Indication">SNI</abbr></a>.
* This SNI extension allows one single server (with a single IP address) to have several HTTPS certificates and serve multiple HTTPS domains/applications.
* For this to work, a single component (program) running on the server, listening on the public IP address, must have all the HTTPS certificates in the server.
* After obtaining a secure connection, the communication protocol is still HTTP.
* The contents are encrypted, even though they are being sent with the HTTP protocol.
It is a common practice to have one program/HTTP server running on the server (the machine, host, etc.) and managing all the HTTPS parts : sending the decrypted HTTP requests to the actual HTTP application running in the same server (the **FastAPI** application, in this case), take the HTTP response from the application, encrypt it using the appropriate certificate and sending it back to the client using HTTPS. This server is often called a <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" class="external-link" target="_blank">TLS Termination Proxy</a>.
## Let's Encrypt
Before Let's Encrypt, these HTTPS certificates were sold by trusted third-parties.
The process to acquire one of these certificates used to be cumbersome, require quite some paperwork and the certificates were quite expensive.
But then <a href="https://letsencrypt.org/" class="external-link" target="_blank">Let's Encrypt</a> was created.
It is a project from the Linux Foundation. It provides HTTPS certificates for free. In an automated way. These certificates use all the standard cryptographic security, and are short lived (about 3 months), so the security is actually better because of their reduced lifespan.
The domains are securely verified and the certificates are generated automatically. This also allows automating the renewal of these certificates.
The idea is to automate the acquisition and renewal of these certificates, so that you can have secure HTTPS, for free, forever.

View File

@@ -0,0 +1,7 @@
# Deployment - Intro
Deploying a **FastAPI** application is relatively easy.
There are several ways to do it depending on your specific use case and the tools that you use.
You will see more details to have in mind and some of the techniques to do it in the next sections.

View File

@@ -0,0 +1,74 @@
# Deploy manually
You can deploy **FastAPI** manually as well.
You just need to install an ASGI compatible server like:
=== "Uvicorn"
* <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>, a lightning-fast ASGI server, built on uvloop and httptools.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
!!! tip
By adding the `standard`, Uvicorn will install and use some recommended extra dependencies.
That including `uvloop`, the high-performance drop-in replacement for `asyncio`, that provides the big concurrency performance boost.
=== "Hypercorn"
* <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>, an ASGI server also compatible with HTTP/2.
<div class="termy">
```console
$ pip install hypercorn
---> 100%
```
</div>
...or any other ASGI server.
And run your application the same way you have done in the tutorials, but without the `--reload` option, e.g.:
=== "Uvicorn"
<div class="termy">
```console
$ uvicorn main:app --host 0.0.0.0 --port 80
<span style="color: green;">INFO</span>: Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
```
</div>
=== "Hypercorn"
<div class="termy">
```console
$ hypercorn main:app --bind 0.0.0.0:80
Running on 0.0.0.0:8080 over http (CTRL + C to quit)
```
</div>
You might want to set up some tooling to make sure it is restarted automatically if it stops.
You might also want to install <a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a> and <a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">use it as a manager for Uvicorn</a>, or use Hypercorn with multiple workers.
Making sure to fine-tune the number of workers, etc.
But if you are doing all that, you might just use the Docker image that does it automatically.

View File

@@ -0,0 +1,87 @@
# About FastAPI versions
**FastAPI** is already being used in production in many applications and systems. And the test coverage is kept at 100%. But its development is still moving quickly.
New features are added frequently, bugs are fixed regularly, and the code is still continuously improving.
That's why the current versions are still `0.x.x`, this reflects that each version could potentially have breaking changes. This follows the <a href="https://semver.org/" class="external-link" target="_blank">Semantic Versioning</a> conventions.
You can create production applications with **FastAPI** right now (and you have probably been doing it for some time), you just have to make sure that you use a version that works correctly with the rest of your code.
## Pin your `fastapi` version
The first thing you should do is to "pin" the version of **FastAPI** you are using to the specific latest version that you know works correctly for your application.
For example, let's say you are using version `0.45.0` in your app.
If you use a `requirements.txt` file you could specify the version with:
```txt
fastapi==0.45.0
```
that would mean that you would use exactly the version `0.45.0`.
Or you could also pin it with:
```txt
fastapi>=0.45.0,<0.46.0
```
that would mean that you would use the versions `0.45.0` or above, but less than `0.46.0`, for example, a version `0.45.2` would still be accepted.
If you use any other tool to manage your installations, like Poetry, Pipenv, or others, they all have a way that you can use to define specific versions for your packages.
## Available versions
You can see the available versions (e.g. to check what is the current latest) in the [Release Notes](../release-notes.md){.internal-link target=_blank}.
## About versions
Following the Semantic Versioning conventions, any version below `1.0.0` could potentially add breaking changes.
FastAPI also follows the convention that any "PATCH" version change is for bug fixes and non-breaking changes.
!!! tip
The "PATCH" is the last number, for example, in `0.2.3`, the PATCH version is `3`.
So, you should be able to pin to a version like:
```txt
fastapi>=0.45.0,<0.46.0
```
Breaking changes and new features are added in "MINOR" versions.
!!! tip
The "MINOR" is the number in the middle, for example, in `0.2.3`, the MINOR version is `2`.
## Upgrading the FastAPI versions
You should add tests for your app.
With **FastAPI** it's very easy (thanks to Starlette), check the docs: [Testing](../tutorial/testing.md){.internal-link target=_blank}
After you have tests, then you can upgrade the **FastAPI** version to a more recent one, and make sure that all your code is working correctly by running your tests.
If everything is working, or after you make the necessary changes, and all your tests are passing, then you can pin your `fastapi` to that new recent version.
## About Starlette
You shouldn't pin the version of `starlette`.
Different versions of **FastAPI** will use a specific newer version of Starlette.
So, you can just let **FastAPI** use the correct Starlette version.
## About Pydantic
Pydantic includes the tests for **FastAPI** with its own tests, so new versions of Pydantic (above `1.0.0`) are always compatible with FastAPI.
You can pin Pydantic to any version above `1.0.0` that works for you and below `2.0.0`.
For example:
```txt
pydantic>=1.2.0,<2.0.0
```

View File

@@ -0,0 +1,82 @@
# External Links and Articles
**FastAPI** has a great community constantly growing.
There are many posts, articles, tools, and projects, related to **FastAPI**.
Here's an incomplete list of some of them.
!!! tip
If you have an article, project, tool, or anything related to **FastAPI** that is not yet listed here, create a <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">Pull Request adding it</a>.
## Articles
### English
{% if external_links %}
{% for article in external_links.articles.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Japanese
{% if external_links %}
{% for article in external_links.articles.japanese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Vietnamese
{% if external_links %}
{% for article in external_links.articles.vietnamese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Russian
{% if external_links %}
{% for article in external_links.articles.russian %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### German
{% if external_links %}
{% for article in external_links.articles.german %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Podcasts
{% if external_links %}
{% for article in external_links.podcasts.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Talks
{% if external_links %}
{% for article in external_links.talks.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Projects
Latest GitHub projects with the topic `fastapi`:
<div class="github-topic-projects">
</div>

View File

@@ -0,0 +1,177 @@
# FastAPI People
FastAPI has an amazing community that welcomes people from all backgrounds.
## Creator - Maintainer
Hey! 👋
This is me:
{% if people %}
<div class="user-list user-list-center">
{% for user in people.maintainers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Answers: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div>
{% endfor %}
</div>
{% endif %}
I'm the creator and maintainer of **FastAPI**. You can read more about that in [Help FastAPI - Get Help - Connect with the author](help-fastapi.md#connect-with-the-author){.internal-link target=_blank}.
...But here I want to show you the community.
---
**FastAPI** receives a lot of support from the community. And I want to highlight their contributions.
These are the people that:
* [Help others with issues (questions) in GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank}.
* [Create Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}.
* Review Pull Requests, [especially important for translations](contributing.md#translations){.internal-link target=_blank}.
A round of applause to them. 👏 🙇
## Most active users last month
These are the users that have been [helping others the most with issues (questions) in GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank} during the last month. ☕
{% if people %}
<div class="user-list user-list-center">
{% for user in people.last_month_active %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Experts
Here are the **FastAPI Experts**. 🤓
These are the users that have [helped others the most with issues (questions) in GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank} through *all time*.
They have proven to be experts by helping many others. ✨
{% if people %}
<div class="user-list user-list-center">
{% for user in people.experts %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Top Contributors
Here are the **Top Contributors**. 👷
These users have [created the most Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank} that have been *merged*.
They have contributed source code, documentation, translations, etc. 📦
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_contributors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Pull Requests: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
There are many other contributors (more than a hundred), you can see them all in the <a href="https://github.com/tiangolo/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors page</a>. 👷
## Top Reviewers
These users are the **Top Reviewers**. 🕵️
### Reviews for Translations
I only speak a few languages (and not very well 😅). So, the reviewers are the ones that have the [**power to approve translations**](contributing.md#translations){.internal-link target=_blank} of the documentation. Without them, there wouldn't be documentation in several other languages.
---
The **Top Reviewers** 🕵️ have reviewed the most Pull Requests from others, ensuring the quality of the code, documentation, and especially, the **translations**.
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_reviewers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Reviews: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Sponsors
These are the **Sponsors**. 😎
They are supporting my work with **FastAPI** (and others), mainly through <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>.
### Gold Sponsors
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
{% endfor %}
{% endif %}
### Silver Sponsors
{% if sponsors %}
{% for sponsor in sponsors.silver -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
{% endfor %}
{% endif %}
### Bronze Sponsors
{% if sponsors %}
{% for sponsor in sponsors.bronze -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
{% endfor %}
{% endif %}
### Individual Sponsors
{% if people %}
{% if people.sponsors_50 %}
<div class="user-list user-list-center">
{% for user in people.sponsors_50 %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% if people %}
<div class="user-list user-list-center">
{% for user in people.sponsors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
## About the data - technical details
The main intention of this page is to highlight the effort of the community to help others.
Especially including efforts that are normally less visible, and in many cases more arduous, like helping others with issues and reviewing Pull Requests with translations.
The data is calculated each month, you can read the <a href="https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">source code here</a>.
Here I'm also highlighting contributions from sponsors.
I also reserve the right to update the algorithm, sections, thresholds, etc (just in case 🤷).

View File

@@ -1,3 +1,4 @@
# Features
## FastAPI features
@@ -5,8 +6,8 @@
### Based on open standards
* <a href="https://github.com/OAI/OpenAPI-Specification" target="_blank"><strong>OpenAPI</strong></a> for API creation, including declarations of <abbr title="also known as: endpoints, routes">path</abbr> <abbr title="also known as HTTP methods, as POST, GET, PUT, DELETE">operations</abbr>, parameters, body requests, security, etc.
* Automatic data model documentation with <a href="http://json-schema.org/" target="_blank"><strong>JSON Schema</strong></a> (as OpenAPI itself is based on JSON Schema).
* <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank"><strong>OpenAPI</strong></a> for API creation, including declarations of <abbr title="also known as: endpoints, routes">path</abbr> <abbr title="also known as HTTP methods, as POST, GET, PUT, DELETE">operations</abbr>, parameters, body requests, security, etc.
* Automatic data model documentation with <a href="https://json-schema.org/" class="external-link" target="_blank"><strong>JSON Schema</strong></a> (as OpenAPI itself is based on JSON Schema).
* Designed around these standards, after a meticulous study. Instead of an afterthought layer on top.
* This also allows using automatic **client code generation** in many languages.
@@ -14,20 +15,19 @@
Interactive API documentation and exploration web user interfaces. As the framework is based on OpenAPI, there are multiple options, 2 included by default.
* <a href="https://github.com/swagger-api/swagger-ui" target="_blank"><strong>Swagger UI</strong></a>, with interactive exploration, call and test your API directly from the browser.
* <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank"><strong>Swagger UI</strong></a>, with interactive exploration, call and test your API directly from the browser.
![Swagger UI interaction](img/index/index-03-swagger-02.png)
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Alternative API documentation with <a href="https://github.com/Rebilly/ReDoc" target="_blank"><strong>ReDoc</strong></a>.
![ReDoc](img/index/index-06-redoc-02.png)
* Alternative API documentation with <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank"><strong>ReDoc</strong></a>.
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Just Modern Python
It's all based on standard **Python 3.6 type** declarations (thanks to Pydantic). No new syntax to learn. Just standard modern Python.
If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI), check the tutorial section: [Python types](python-types.md).
If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI), check the short tutorial: [Python Types](python-types.md){.internal-link target=_blank}.
You write standard Python with types:
@@ -37,7 +37,7 @@ from datetime import date
from pydantic import BaseModel
# Declare a variable as an str
# Declare a variable as a str
# and get editor support inside the function
def main(user_id: str):
return user_id
@@ -66,14 +66,14 @@ my_second_user: User = User(**second_user_data)
!!! info
`**second_user_data` means:
Pass the keys and values of the `second_user_data` dict directly as key-value arguments, equivalent to: `User(id=4, name="Mary", joined="2018-11-30")`
### Editor support
All the framework was designed to be easy and intuitive to use, all the decisons where tested on multiple editors even before starting development, to ensure the best development experience.
All the framework was designed to be easy and intuitive to use, all the decisions were tested on multiple editors even before starting development, to ensure the best development experience.
In the last Python developer survey it was clear <a href="https://www.jetbrains.com/research/python-developers-survey-2017/#tools-and-features" target="_blank">that the most used feature is "autocompletion"</a>.
In the last Python developer survey it was clear <a href="https://www.jetbrains.com/research/python-developers-survey-2017/#tools-and-features" class="external-link" target="_blank">that the most used feature is "autocompletion"</a>.
The whole **FastAPI** framework is based to satisfy that. Autocompletion works everywhere.
@@ -81,15 +81,15 @@ You will rarely need to come back to the docs.
Here's how your editor might help you:
* in <a href="https://code.visualstudio.com/" target="_blank">Visual Studio Code</a>:
* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>:
![editor support](img/vscode-completion.png)
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
* in <a href="https://www.jetbrains.com/pycharm/" target="_blank">PyCharm</a>:
* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>:
![editor support](img/pycharm-completion.png)
![editor support](https://fastapi.tiangolo.com/img/pycharm-completion.png)
You will get completion in code you might even consider imposible before. As for example, the `price` key inside a JSON body (that could have been nested) that comes from a request.
You will get completion in code you might even consider impossible before. As for example, the `price` key inside a JSON body (that could have been nested) that comes from a request.
No more typing the wrong key names, coming back and forth between docs, or scrolling up and down to find if you finally used `username` or `user_name`.
@@ -122,13 +122,13 @@ Security and authentication integrated. Without any compromise with databases or
All the security schemes defined in OpenAPI, including:
* HTTP Basic.
* **OAuth2** (also with **JWT tokens**). Check the [tutorial on OAuth2 with JWT](tutorial/security/oauth2-jwt.md).
* **OAuth2** (also with **JWT tokens**). Check the tutorial on [OAuth2 with JWT](tutorial/security/oauth2-jwt.md){.internal-link target=_blank}.
* API keys in:
* Headers.
* Query parameters.
* Cookies, etc.
Plus all the security features from Starlette (including **session cookies**).
Plus all the security features from Starlette (including **session cookies**).
All built as reusable tools and components that are easy to integrate with your systems, data stores, relational and NoSQL databases, etc.
@@ -137,19 +137,17 @@ All built as reusable tools and components that are easy to integrate with your
FastAPI includes an extremely easy to use, but extremely powerful <abbr title='also known as "components", "resources", "services", "providers"'><strong>Dependency Injection</strong></abbr> system.
* Even dependencies can have dependencies, creating a hierarchy or **"graph" of dependencies**.
* All **automatically handled** by the framework.
* All **automatically handled** by the framework.
* All the dependencies can require data from requests and **augment the path operation** constraints and automatic documentation.
* **Automatic validation** even for path operation parameters defined in dependencies.
* **Automatic validation** even for *path operation* parameters defined in dependencies.
* Support for complex user authentication systems, **database connections**, etc.
* **No compromise** with databases, frontends, etc. But easy integration with all of them.
### Unlimited "plug-ins"
Or in other way, no need for them, import and use the code you need.
Any integration is designed to be so simple to use (with dependencies) that you can create a "plug-in" for your application in 2 lines of code using the same structure and syntax used for your path operations.
Or in other way, no need for them, import and use the code you need.
Any integration is designed to be so simple to use (with dependencies) that you can create a "plug-in" for your application in 2 lines of code using the same structure and syntax used for your *path operations*.
### Tested
@@ -159,13 +157,13 @@ Any integration is designed to be so simple to use (with dependencies) that you
## Starlette features
**FastAPI** is fully compatible with (and based on) <a href="https://www.starlette.io/" target="_blank"><strong>Starlette</strong></a>. So, any additional Starlette code you have, will also work.
**FastAPI** is fully compatible with (and based on) <a href="https://www.starlette.io/" class="external-link" target="_blank"><strong>Starlette</strong></a>. So, any additional Starlette code you have, will also work.
`FastAPI` is actually a sub-class of `Starlette`. So, if you already know or use Starlette, most of the functionality will work the same way.
With **FastAPI** you get all of **Starlette**'s features (as FastAPI is just Starlette on steroids):
* Seriously impressive performance. It is <a href="https://github.com/encode/starlette#performance" target="_blank">one of the fastest Python frameworks available, on par with **NodeJS** and **Go**</a>.
* Seriously impressive performance. It is <a href="https://github.com/encode/starlette#performance" class="external-link" target="_blank">one of the fastest Python frameworks available, on par with **NodeJS** and **Go**</a>.
* **WebSocket** support.
* **GraphQL** support.
* In-process background tasks.
@@ -178,7 +176,7 @@ With **FastAPI** you get all of **Starlette**'s features (as FastAPI is just Sta
## Pydantic features
**FastAPI** is fully compatible with (and based on) <a href="https://pydantic-docs.helpmanual.io" target="_blank"><strong>Pydantic</strong></a>. So, any additional Pydantic code you have, will also work.
**FastAPI** is fully compatible with (and based on) <a href="https://pydantic-docs.helpmanual.io" class="external-link" target="_blank"><strong>Pydantic</strong></a>. So, any additional Pydantic code you have, will also work.
Including external libraries also based on Pydantic, as <abbr title="Object-Relational Mapper">ORM</abbr>s, <abbr title="Object-Document Mapper">ODM</abbr>s for databases.
@@ -188,17 +186,17 @@ The same applies the other way around, in many cases you can just pass the objec
With **FastAPI** you get all of **Pydantic**'s features (as FastAPI is based on Pydantic for all the data handling):
* **No brainfuck**:
* **No brainfuck**:
* No new schema definition micro-language to learn.
* If you know Python types you know how to use Pydantic.
* Plays nicely with your **<abbr title="Integrated Development Environment, similar to a code editor">IDE</abbr>/<abbr title="A program that checks for code errors">linter</abbr>/brain**:
* Because pydantic data structures are just instances of classes you define; auto-completion, linting, mypy and your intuition should all work properly with your validated data.
* **Fast**:
* in <a href="https://pydantic-docs.helpmanual.io/#benchmarks-tag" target="_blank">benchmarks</a> Pydantic is faster than all other tested libraries.
* in <a href="https://pydantic-docs.helpmanual.io/#benchmarks-tag" class="external-link" target="_blank">benchmarks</a> Pydantic is faster than all other tested libraries.
* Validate **complex structures**:
* Use of hierarchical Pydantic models, Python `typing`s `List` and `Dict`, etc.
* And validators allow complex data schemas to be clearly and easily defined, checked and documented as JSON Schema.
* You can have deeply **nested JSON** objects and have them all validated and annotated.
* **Extendible**:
* Pydantic allows custom data types to be defined or you can extend validation with methods on a model decorated with the validator decorator.
* 100% test coverage.
* 100% test coverage.

View File

@@ -0,0 +1,142 @@
# Help FastAPI - Get Help
Do you like **FastAPI**?
Would you like to help FastAPI, other users, and the author?
Or would you like to get help with **FastAPI**?
There are very simple ways to help (several involve just one or two clicks).
And there are several ways to get help too.
## Subscribe to the newsletter
You can subscribe to the (infrequent) [**FastAPI and friends** newsletter](/newsletter/){.internal-link target=_blank} to stay updated about:
* News about FastAPI and friends 🚀
* Guides 📝
* Features ✨
* Breaking changes 🚨
* Tips and tricks ✅
## Star **FastAPI** in GitHub
You can "star" FastAPI in GitHub (clicking the star button at the top right): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. ⭐️
By adding a star, other users will be able to find it more easily and see that it has been already useful for others.
## Watch the GitHub repository for releases
You can "watch" FastAPI in GitHub (clicking the "watch" button at the top right): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. 👀
There you can select "Releases only".
Doing it, you will receive notifications (in your email) whenever there's a new release (a new version) of **FastAPI** with bug fixes and new features.
## Connect with the author
You can connect with <a href="https://tiangolo.com" class="external-link" target="_blank">me (Sebastián Ramírez / `tiangolo`)</a>, the author.
You can:
* <a href="https://github.com/tiangolo" class="external-link" target="_blank">Follow me on **GitHub**</a>.
* See other Open Source projects I have created that could help you.
* Follow me to see when I create a new Open Source project.
* <a href="https://twitter.com/tiangolo" class="external-link" target="_blank">Follow me on **Twitter**</a>.
* Tell me how you use FastAPI (I love to hear that).
* Hear when I make announcements or release new tools.
* <a href="https://www.linkedin.com/in/tiangolo/" class="external-link" target="_blank">Connect with me on **Linkedin**</a>.
* Hear when I make announcements or release new tools (although I use Twitter more often 🤷‍♂).
* Read what I write (or follow me) on <a href="https://dev.to/tiangolo" class="external-link" target="_blank">**Dev.to**</a> or <a href="https://medium.com/@tiangolo" class="external-link" target="_blank">**Medium**</a>.
* Read other ideas, articles, and about tools I have created.
* Follow me to read when I publish something new.
## Tweet about **FastAPI**
<a href="https://twitter.com/compose/tweet?text=I'm loving FastAPI because... https://github.com/tiangolo/fastapi cc @tiangolo" class="external-link" target="_blank">Tweet about **FastAPI**</a> and let me and others know why you like it. 🎉
I love to hear about how **FastAPI** is being used, what have you liked in it, in which project/company are you using it, etc.
## Vote for FastAPI
* <a href="https://www.slant.co/options/34241/~fastapi-review" class="external-link" target="_blank">Vote for **FastAPI** in Slant</a>.
* <a href="https://alternativeto.net/software/fastapi/" class="external-link" target="_blank">Vote for **FastAPI** in AlternativeTo</a>.
## Help others with issues in GitHub
You can see <a href="https://github.com/tiangolo/fastapi/issues" class="external-link" target="_blank">existing issues</a> and try and help others, most of the times they are questions that you might already know the answer for. 🤓
If you are helping a lot of people on issues you might become an official [FastAPI Expert](fastapi-people.md#experts){.internal-link target=_blank}. 🎉
## Watch the GitHub repository
You can "watch" FastAPI in GitHub (clicking the "watch" button at the top right): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. 👀
If you select "Watching" instead of "Releases only", you will receive notifications when someone creates a new issue.
Then you can try and help them solving those issues.
## Create issues
You can <a href="https://github.com/tiangolo/fastapi/issues/new/choose" class="external-link" target="_blank">create a new issue</a> in the GitHub repository, for example to:
* Ask a **question** or ask about a **problem**.
* Suggest a new **feature**.
**Note**: if you create an issue then I'm going to ask you to also help others. 😉
## Create a Pull Request
You can [contribute](contributing.md){.internal-link target=_blank} to the source code with Pull Requests, for example:
* To fix a typo you found on the documentation.
* To share an article, video, or podcast you created or found about FastAPI by <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">editing this file</a>.
* Make sure you add your link to the end of the corresponding section.
* To help [translate the documentation](contributing.md#translations){.internal-link target=_blank} to your language.
* You can also help reviewing the translations created by others.
* To propose new documentation sections.
* To fix an existing issue/bug.
* To add a new feature.
## Join the chat
Join the 👥 <a href="https://discord.gg/VQjSZaeJmf" class="external-link" target="_blank">Discord chat server</a> 👥 and hang out with others in the FastAPI community.
!!! tip
For questions, ask them in <a href="https://github.com/tiangolo/fastapi/issues/new/choose" class="external-link" target="_blank">GitHub issues</a>, there's a much better chance you will receive help by the [FastAPI Experts](fastapi-people.md#experts){.internal-link target=_blank}.
Use the chat only for other general conversations.
There is also the previous <a href="https://gitter.im/tiangolo/fastapi" class="external-link" target="_blank">Gitter chat</a>, but as it doesn't have channels and advanced features, conversations are more difficult, so Discord is now the recommended system.
### Don't use the chat for questions
Have in mind that as chats allow more "free conversation", it's easy to ask questions that are too general and more difficult to answer, so, you might not receive answers.
In GitHub issues the template will guide you to write the right question so that you can more easily get a good answer, or even solve the problem yourself even before asking. And in GitHub I can make sure I always answer everything, even if it takes some time. I can't personally do that with the chat systems. 😅
Conversations in the chat systems are also not as easily searchable as in GitHub, so questions and answers might get lost in the conversation. And only the ones in GitHub issues count to become a [FastAPI Expert](fastapi-people.md#experts){.internal-link target=_blank}, so you will most probably receive more attention in GitHub isssues.
On the other side, there are thousands of users in the chat systems, so there's a high chance you'll find someone to talk to there, almost all the time. 😄
## Sponsor the author
You can also financially support the author (me) through <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub sponsors</a>.
There you could buy me a coffee ☕️ to say thanks. 😄
And you can also become a Silver or Gold sponsor for FastAPI. 🏅🎉
## Sponsor the tools that power FastAPI
As you have seen in the documentation, FastAPI stands on the shoulders of giants, Starlette and Pydantic.
You can also sponsor:
* <a href="https://github.com/sponsors/samuelcolvin" class="external-link" target="_blank">Samuel Colvin (Pydantic)</a>
* <a href="https://github.com/sponsors/encode" class="external-link" target="_blank">Encode (Starlette, Uvicorn)</a>
---
Thanks! 🚀

View File

@@ -0,0 +1,79 @@
# History, Design and Future
Some time ago, <a href="https://github.com/tiangolo/fastapi/issues/3#issuecomment-454956920" class="external-link" target="_blank">a **FastAPI** user asked</a>:
> Whats the history of this project? It seems to have come from nowhere to awesome in a few weeks [...]
Here's a little bit of that history.
## Alternatives
I have been creating APIs with complex requirements for several years (Machine Learning, distributed systems, asynchronous jobs, NoSQL databases, etc), leading several teams of developers.
As part of that, I needed to investigate, test and use many alternatives.
The history of **FastAPI** is in great part the history of its predecessors.
As said in the section [Alternatives](alternatives.md){.internal-link target=_blank}:
<blockquote markdown="1">
**FastAPI** wouldn't exist if not for the previous work of others.
There have been many tools created before that have helped inspire its creation.
I have been avoiding the creation of a new framework for several years. First I tried to solve all the features covered by **FastAPI** using many different frameworks, plug-ins, and tools.
But at some point, there was no other option than creating something that provided all these features, taking the best ideas from previous tools, and combining them in the best way possible, using language features that weren't even available before (Python 3.6+ type hints).
</blockquote>
## Investigation
By using all the previous alternatives I had the chance to learn from all of them, take ideas, and combine them in the best way I could find for myself and the teams of developers I have worked with.
For example, it was clear that ideally it should be based on standard Python type hints.
Also, the best approach was to use already existing standards.
So, before even starting to code **FastAPI**, I spent several months studying the specs for OpenAPI, JSON Schema, OAuth2, etc. Understanding their relationship, overlap, and differences.
## Design
Then I spent some time designing the developer "API" I wanted to have as a user (as a developer using FastAPI).
I tested several ideas in the most popular Python editors: PyCharm, VS Code, Jedi based editors.
By the last <a href="https://www.jetbrains.com/research/python-developers-survey-2018/#development-tools" class="external-link" target="_blank">Python Developer Survey</a>, that covers about 80% of the users.
It means that **FastAPI** was specifically tested with the editors used by 80% of the Python developers. And as most of the other editors tend to work similarly, all its benefits should work for virtually all editors.
That way I could find the best ways to reduce code duplication as much as possible, to have completion everywhere, type and error checks, etc.
All in a way that provided the best development experience for all the developers.
## Requirements
After testing several alternatives, I decided that I was going to use <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">**Pydantic**</a> for its advantages.
Then I contributed to it, to make it fully compliant with JSON Schema, to support different ways to define constraint declarations, and to improve editor support (type checks, autocompletion) based on the tests in several editors.
During the development, I also contributed to <a href="https://www.starlette.io/" class="external-link" target="_blank">**Starlette**</a>, the other key requirement.
## Development
By the time I started creating **FastAPI** itself, most of the pieces were already in place, the design was defined, the requirements and tools were ready, and the knowledge about the standards and specifications was clear and fresh.
## Future
By this point, it's already clear that **FastAPI** with its ideas is being useful for many people.
It is being chosen over previous alternatives for suiting many use cases better.
Many developers and teams already depend on **FastAPI** for their projects (including me and my team).
But still, there are many improvements and features to come.
**FastAPI** has a great future ahead.
And [your help](help-fastapi.md){.internal-link target=_blank} is greatly appreciated.

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 412 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg8"
version="1.1"
viewBox="0 0 338.66665 169.33332"
height="169.33333mm"
width="338.66666mm"
sodipodi:docname="github-social-preview.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/user/code/fastapi/docs/img/github-social-preview.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1025"
id="namedview9"
showgrid="false"
inkscape:zoom="0.52249777"
inkscape:cx="565.37328"
inkscape:cy="403.61034"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
style="opacity:0.98000004;fill:#ffffff;fill-opacity:1;stroke-width:0.26458332"
id="rect853"
width="338.66666"
height="169.33333"
x="-1.0833333e-05"
y="0.71613133"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
transform="matrix(0.73259569,0,0,0.73259569,64.842852,-4.5763945)"
id="layer1">
<path
style="opacity:0.98000004;fill:#009688;fill-opacity:1;stroke-width:3.20526505"
id="path817"
d="m 1.4365174,55.50154 c -17.6610514,0 -31.9886064,14.327532 -31.9886064,31.988554 0,17.661036 14.327555,31.988586 31.9886064,31.988586 17.6609756,0 31.9885196,-14.32755 31.9885196,-31.988586 0,-17.661022 -14.327544,-31.988554 -31.9885196,-31.988554 z m -1.66678692,57.63069 V 93.067264 H -11.384533 L 4.6417437,61.847974 V 81.912929 H 15.379405 Z"
inkscape:connector-curvature="0" />
<text
id="text979"
y="114.91215"
x="52.115433"
style="font-style:normal;font-weight:normal;font-size:79.71511078px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#009688;fill-opacity:1;stroke:none;stroke-width:1.99287772"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#009688;fill-opacity:1;stroke-width:1.99287772"
y="114.91215"
x="52.115433"
id="tspan977">FastAPI</tspan></text>
</g>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="169.60979"
y="119.20409"
id="text851"><tspan
sodipodi:role="line"
id="tspan849"
x="169.60979"
y="119.20409"
style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:'Roboto Italic';text-align:center;text-anchor:middle;stroke-width:0.26458332">High performance, easy to learn,</tspan><tspan
sodipodi:role="line"
x="169.60979"
y="132.53661"
style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:'Roboto Italic';text-align:center;text-anchor:middle;stroke-width:0.26458332"
id="tspan855">fast to code, ready for production</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Some files were not shown because too many files have changed in this diff Show More