committed by
GitHub
111 changed files with 3304 additions and 3247 deletions
@ -1,185 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI İnsanlar |
|||
|
|||
FastAPI-ın bütün mənşəli insanları qəbul edən heyrətamiz icması var. |
|||
|
|||
|
|||
|
|||
## Yaradıcı - İcraçı |
|||
|
|||
Salam! 👋 |
|||
|
|||
Bu mənəm: |
|||
|
|||
{% 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">Cavablar: {{ user.answers }}</div><div class="count">Pull Request-lər: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Mən **FastAPI**-ın yaradıcısı və icraçısıyam. Əlavə məlumat almaq üçün [Yardım FastAPI - Yardım alın - Müəlliflə əlaqə qurun](help-fastapi.md#connect-with-the-author){.internal-link target=_blank} səhifəsinə baxa bilərsiniz. |
|||
|
|||
...Burada isə sizə icmanı göstərmək istəyirəm. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** icmadan çoxlu dəstək alır və mən onların əməyini vurğulamaq istəyirəm. |
|||
|
|||
Bu insanlar: |
|||
|
|||
* [GitHub-da başqalarının suallarına kömək edirlər](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}. |
|||
* [Pull Request-lər yaradırlar](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
* Pull Request-ləri ([xüsusilə tərcümələr üçün vacib olan](contributing.md#translations){.internal-link target=_blank}.) nəzərdən keçirirlər. |
|||
|
|||
Bu insanlara təşəkkür edirəm. 👏 🙇 |
|||
|
|||
## Keçən ayın ən fəal istifadəçiləri |
|||
|
|||
Bu istifadəçilər keçən ay [GitHub-da başqalarının suallarına](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} ən çox kömək edənlərdir. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">Cavablandırılmış suallar: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Mütəxəssislər |
|||
|
|||
Burada **FastAPI Mütəxəssisləri** var. 🤓 |
|||
|
|||
Bu istifadəçilər indiyə qədər [GitHub-da başqalarının suallarına](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} ən çox kömək edənlərdir. |
|||
|
|||
Onlar bir çox insanlara kömək edərək mütəxəssis olduqlarını sübut ediblər. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Cavablandırılmış suallar: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Ən yaxşı əməkdaşlar |
|||
|
|||
Burada **Ən yaxşı əməkdaşlar** var. 👷 |
|||
|
|||
Bu istifadəçilərin ən çox *birləşdirilmiş* [Pull Request-ləri var](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
|
|||
Onlar mənbə kodu, sənədləmə, tərcümələr və s. barədə əmək göstərmişlər. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Request-lər: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Bundan başqa bir neçə (yüzdən çox) əməkdaş var ki, onları <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Əməkdaşlar səhifəsində</a> görə bilərsiniz. 👷 |
|||
|
|||
## Ən çox rəy verənlər |
|||
|
|||
Bu istifadəçilər **ən çox rəy verənlər**dir. |
|||
|
|||
### Tərcümələr üçün rəylər |
|||
|
|||
Mən yalnız bir neçə dildə danışıram (və çox da yaxşı deyil 😅). Bu səbəbdən, rəy verənlər sənədlərin [**tərcümələrini təsdiqləmək üçün gücə malik olanlar**](contributing.md#translations){.internal-link target=_blank}dır. Onlar olmadan, bir çox dilə tərcümə olunmuş sənədlər olmazdı. |
|||
|
|||
--- |
|||
|
|||
Başqalarının Pull Request-lərinə **Ən çox rəy verənlər** 🕵️ kodun, sənədlərin və xüsusilə də **tərcümələrin** keyfiyyətini təmin edirlər. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Rəylər: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsorlar |
|||
|
|||
Bunlar **Sponsorlar**dır. 😎 |
|||
|
|||
Onlar mənim **FastAPI** (və digər) işlərimi əsasən <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsorlar</a> vasitəsilə dəstəkləyirlər. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Qızıl Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Gümüş Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Bürünc Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Fərdi Sponsorlar |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## Məlumatlar haqqında - texniki detallar |
|||
|
|||
Bu səhifənin əsas məqsədi, icmanın başqalarına kömək etmək üçün göstərdiyi əməyi vurğulamaqdır. |
|||
|
|||
Xüsusilə də normalda daha az görünən və bir çox hallarda daha çətin olan, başqalarının suallarına kömək etmək və tərcümələrlə bağlı Pull Request-lərə rəy vermək kimi səy göstərmək. |
|||
|
|||
Bu səhifənin məlumatları hər ay hesablanır və siz <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">buradan mənbə kodunu</a> oxuya bilərsiniz. |
|||
|
|||
Burada sponsorların əməyini də vurğulamaq istəyirəm. |
|||
|
|||
Mən həmçinin alqoritmi, bölmələri, eşikləri və s. yeniləmək hüququnu da qoruyuram (hər ehtimala qarşı 🤷). |
@ -1,176 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI Leute |
|||
|
|||
FastAPI hat eine großartige Gemeinschaft, die Menschen mit unterschiedlichstem Hintergrund willkommen heißt. |
|||
|
|||
## Erfinder - Betreuer |
|||
|
|||
Hey! 👋 |
|||
|
|||
Das bin ich: |
|||
|
|||
{% 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 %} |
|||
|
|||
Ich bin der Erfinder und Betreuer von **FastAPI**. Sie können mehr darüber in [FastAPI helfen – Hilfe erhalten – Mit dem Autor vernetzen](help-fastapi.md#mit-dem-autor-vernetzen){.internal-link target=_blank} erfahren. |
|||
|
|||
... Aber hier möchte ich Ihnen die Gemeinschaft vorstellen. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** erhält eine Menge Unterstützung aus der Gemeinschaft. Und ich möchte ihre Beiträge hervorheben. |
|||
|
|||
Das sind die Menschen, die: |
|||
|
|||
* [Anderen bei Fragen auf GitHub helfen](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank}. |
|||
* [<abbr title='Pull Request – „Zieh-Anfrage“: Geänderten Quellcode senden, mit dem Vorschlag, ihn mit dem aktuellen Quellcode zu verschmelzen'>Pull Requests</abbr> erstellen](help-fastapi.md#einen-pull-request-erstellen){.internal-link target=_blank}. |
|||
* Pull Requests überprüfen (Review), [besonders wichtig für Übersetzungen](contributing.md#ubersetzungen){.internal-link target=_blank}. |
|||
|
|||
Eine Runde Applaus für sie. 👏 🙇 |
|||
|
|||
## Aktivste Benutzer im letzten Monat |
|||
|
|||
Hier die Benutzer, die im letzten Monat am meisten [anderen mit Fragen auf Github](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank} geholfen haben. ☕ |
|||
|
|||
{% 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">Fragen beantwortet: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Experten |
|||
|
|||
Hier die **FastAPI-Experten**. 🤓 |
|||
|
|||
Das sind die Benutzer, die *insgesamt* [anderen am meisten mit Fragen auf GitHub geholfen haben](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank}. |
|||
|
|||
Sie haben bewiesen, dass sie Experten sind, weil sie vielen anderen geholfen haben. ✨ |
|||
|
|||
{% 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">Fragen beantwortet: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Top-Mitwirkende |
|||
|
|||
Hier sind die **Top-Mitwirkenden**. 👷 |
|||
|
|||
Diese Benutzer haben [die meisten Pull Requests erstellt](help-fastapi.md#einen-pull-request-erstellen){.internal-link target=_blank} welche *<abbr title="Mergen – Zusammenführen: Unterschiedliche Versionen eines Quellcodes zusammenführen">gemerged</abbr>* wurden. |
|||
|
|||
Sie haben Quellcode, Dokumentation, Übersetzungen, usw. beigesteuert. 📦 |
|||
|
|||
{% 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 %} |
|||
|
|||
Es gibt viele andere Mitwirkende (mehr als hundert), Sie können sie alle auf der <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors-Seite</a> sehen. 👷 |
|||
|
|||
## Top-Rezensenten |
|||
|
|||
Diese Benutzer sind die **Top-Rezensenten**. 🕵️ |
|||
|
|||
### Rezensionen für Übersetzungen |
|||
|
|||
Ich spreche nur ein paar Sprachen (und nicht sehr gut 😅). Daher bestätigen Reviewer [**Übersetzungen der Dokumentation**](contributing.md#ubersetzungen){.internal-link target=_blank}. Ohne sie gäbe es keine Dokumentation in mehreren anderen Sprachen. |
|||
|
|||
--- |
|||
|
|||
Die **Top-Reviewer** 🕵️ haben die meisten Pull Requests von anderen überprüft und stellen die Qualität des Codes, der Dokumentation und insbesondere der **Übersetzungen** sicher. |
|||
|
|||
{% 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 %} |
|||
|
|||
## Sponsoren |
|||
|
|||
Dies sind die **Sponsoren**. 😎 |
|||
|
|||
Sie unterstützen meine Arbeit an **FastAPI** (und andere), hauptsächlich durch <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub-Sponsoren</a>. |
|||
|
|||
### Gold Sponsoren |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
### Silber Sponsoren |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if people %} |
|||
{% if people.sponsors_50 %} |
|||
|
|||
### Bronze Sponsoren |
|||
|
|||
<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 %} |
|||
|
|||
### Individuelle Sponsoren |
|||
|
|||
{% 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 %} |
|||
|
|||
## Über diese Daten - technische Details |
|||
|
|||
Der Hauptzweck dieser Seite ist es zu zeigen, wie die Gemeinschaft anderen hilft. |
|||
|
|||
Das beinhaltet auch Hilfe, die normalerweise weniger sichtbar und in vielen Fällen mühsamer ist, wie, anderen bei Problemen zu helfen und Pull Requests mit Übersetzungen zu überprüfen. |
|||
|
|||
Diese Daten werden jeden Monat berechnet, Sie können den <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">Quellcode hier lesen</a>. |
|||
|
|||
Hier weise ich auch auf Beiträge von Sponsoren hin. |
|||
|
|||
Ich behalte mir auch das Recht vor, den Algorithmus, die Abschnitte, die Schwellenwerte usw. zu aktualisieren (nur für den Fall 🤷). |
@ -1,183 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI 👫👫 |
|||
|
|||
FastAPI ✔️ 🎆 👪 👈 🙋 👫👫 ⚪️➡️ 🌐 🖥. |
|||
|
|||
## 👼 - 🐛 |
|||
|
|||
🙋 ❗ 👶 |
|||
|
|||
👉 👤: |
|||
|
|||
{% 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">❔: {{ user.answers }}</div><div class="count">🚲 📨: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
👤 👼 & 🐛 **FastAPI**. 👆 💪 ✍ 🌅 🔃 👈 [ℹ FastAPI - 🤚 ℹ - 🔗 ⏮️ 📕](help-fastapi.md#_3){.internal-link target=_blank}. |
|||
|
|||
...✋️ 📥 👤 💚 🎦 👆 👪. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** 📨 📚 🐕🦺 ⚪️➡️ 👪. & 👤 💚 🎦 👫 💰. |
|||
|
|||
👫 👫👫 👈: |
|||
|
|||
* [ℹ 🎏 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank}. |
|||
* [✍ 🚲 📨](help-fastapi.md#_15){.internal-link target=_blank}. |
|||
* 📄 🚲 📨, [✴️ ⚠ ✍](contributing.md#_9){.internal-link target=_blank}. |
|||
|
|||
👏 👫. 👶 👶 |
|||
|
|||
## 🌅 🦁 👩💻 🏁 🗓️ |
|||
|
|||
👫 👩💻 👈 ✔️ [🤝 🎏 🏆 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank} ⏮️ 🏁 🗓️. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">❔ 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 🕴 |
|||
|
|||
📥 **FastAPI 🕴**. 👶 |
|||
|
|||
👫 👩💻 👈 ✔️ [ℹ 🎏 🏆 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank} 🔘 *🌐 🕰*. |
|||
|
|||
👫 ✔️ 🎦 🕴 🤝 📚 🎏. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">❔ 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 🔝 👨🔬 |
|||
|
|||
📥 **🔝 👨🔬**. 👶 |
|||
|
|||
👉 👩💻 ✔️ [✍ 🏆 🚲 📨](help-fastapi.md#_15){.internal-link target=_blank} 👈 ✔️ *🔗*. |
|||
|
|||
👫 ✔️ 📉 ℹ 📟, 🧾, ✍, ♒️. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">🚲 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
📤 📚 🎏 👨🔬 (🌅 🌘 💯), 👆 💪 👀 👫 🌐 <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI 📂 👨🔬 📃</a>. 👶 |
|||
|
|||
## 🔝 👨🔬 |
|||
|
|||
👫 👩💻 **🔝 👨🔬**. 👶 👶 |
|||
|
|||
### 📄 ✍ |
|||
|
|||
👤 🕴 💬 👩❤👨 🇪🇸 (& 🚫 📶 👍 👶). , 👨🔬 🕐 👈 ✔️ [**🏋️ ✔ ✍**](contributing.md#_9){.internal-link target=_blank} 🧾. 🍵 👫, 📤 🚫🔜 🧾 📚 🎏 🇪🇸. |
|||
|
|||
--- |
|||
|
|||
**🔝 👨🔬** 👶 👶 ✔️ 📄 🏆 🚲 📨 ⚪️➡️ 🎏, 🚚 🔆 📟, 🧾, & ✴️, **✍**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">📄: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 💰 |
|||
|
|||
👫 **💰**. 👶 |
|||
|
|||
👫 🔗 👇 👷 ⏮️ **FastAPI** (& 🎏), ✴️ 🔘 <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">📂 💰</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### 🌟 💰 |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### 🥇1st 💰 |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### 🥈2nd 💰 |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### 🎯 💰 |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## 🔃 📊 - 📡 ℹ |
|||
|
|||
👑 🎯 👉 📃 🎦 🎯 👪 ℹ 🎏. |
|||
|
|||
✴️ ✅ 🎯 👈 🛎 🌘 ⭐, & 📚 💼 🌅 😩, 💖 🤝 🎏 ⏮️ ❔ & ⚖ 🚲 📨 ⏮️ ✍. |
|||
|
|||
💽 ⚖ 🔠 🗓️, 👆 💪 ✍ <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">ℹ 📟 📥</a>. |
|||
|
|||
📥 👤 🎦 💰 ⚪️➡️ 💰. |
|||
|
|||
👤 🏦 ▶️️ ℹ 📊, 📄, ⚡, ♒️ (💼 🤷). |
@ -1,19 +1,19 @@ |
|||
members: |
|||
- login: tiangolo |
|||
avatar_url: https://github.com/tiangolo.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/1326112 |
|||
url: https://github.com/tiangolo |
|||
- login: Kludex |
|||
avatar_url: https://github.com/Kludex.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/7353520 |
|||
url: https://github.com/Kludex |
|||
- login: alejsdev |
|||
avatar_url: https://github.com/alejsdev.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/90076947 |
|||
url: https://github.com/alejsdev |
|||
- login: svlandeg |
|||
avatar_url: https://github.com/svlandeg.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/8796347 |
|||
url: https://github.com/svlandeg |
|||
- login: estebanx64 |
|||
avatar_url: https://github.com/estebanx64.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/10840422 |
|||
url: https://github.com/estebanx64 |
|||
- login: patrick91 |
|||
avatar_url: https://github.com/patrick91.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/667029 |
|||
url: https://github.com/patrick91 |
|||
|
@ -0,0 +1,300 @@ |
|||
# Environment Variables |
|||
|
|||
/// tip |
|||
|
|||
If you already know what "environment variables" are and how to use them, feel free to skip this. |
|||
|
|||
/// |
|||
|
|||
An environment variable (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). |
|||
|
|||
Environment variables could be useful for handling application **settings**, as part of the **installation** of Python, etc. |
|||
|
|||
## Create and Use Env Vars |
|||
|
|||
You can **create** and use environment variables in the **shell (terminal)**, without needing Python: |
|||
|
|||
//// tab | 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> |
|||
|
|||
//// |
|||
|
|||
//// tab | 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: |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<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> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<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 |
|||
$ $Env: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 any validation has to be done in code. |
|||
|
|||
You will learn more about using environment variables for handling **application settings** in the [Advanced User Guide - Settings and Environment Variables](./advanced/settings.md){.internal-link target=_blank}. |
|||
|
|||
## `PATH` Environment Variable |
|||
|
|||
There is a **special** environment variable called **`PATH`** that is used by the operating systems (Linux, macOS, Windows) to find programs to run. |
|||
|
|||
The value of the variable `PATH` is a long string that is made of directories separated by a colon `:` on Linux and macOS, and by a semicolon `;` on Windows. |
|||
|
|||
For example, the `PATH` environment variable could look like this: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
This means that the system should look for programs in the directories: |
|||
|
|||
* `/usr/local/bin` |
|||
* `/usr/bin` |
|||
* `/bin` |
|||
* `/usr/sbin` |
|||
* `/sbin` |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32 |
|||
``` |
|||
|
|||
This means that the system should look for programs in the directories: |
|||
|
|||
* `C:\Program Files\Python312\Scripts` |
|||
* `C:\Program Files\Python312` |
|||
* `C:\Windows\System32` |
|||
|
|||
//// |
|||
|
|||
When you type a **command** in the terminal, the operating system **looks for** the program in **each of those directories** listed in the `PATH` environment variable. |
|||
|
|||
For example, when you type `python` in the terminal, the operating system looks for a program called `python` in the **first directory** in that list. |
|||
|
|||
If it finds it, then it will **use it**. Otherwise it keeps looking in the **other directories**. |
|||
|
|||
### Installing Python and Updating the `PATH` |
|||
|
|||
When you install Python, you might be asked if you want to update the `PATH` environment variable. |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
Let's say you install Python and it ends up in a directory `/opt/custompython/bin`. |
|||
|
|||
If you say yes to update the `PATH` environment variable, then the installer will add `/opt/custompython/bin` to the `PATH` environment variable. |
|||
|
|||
It could look like this: |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/custompython/bin |
|||
``` |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one. |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
Let's say you install Python and it ends up in a directory `C:\opt\custompython\bin`. |
|||
|
|||
If you say yes to update the `PATH` environment variable, then the installer will add `C:\opt\custompython\bin` to the `PATH` environment variable. |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32;C:\opt\custompython\bin |
|||
``` |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `C:\opt\custompython\bin` (the last directory) and use that one. |
|||
|
|||
//// |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one. |
|||
|
|||
So, if you type: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
The system will **find** the `python` program in `/opt/custompython/bin` and run it. |
|||
|
|||
It would be roughly equivalent to typing: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ /opt/custompython/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
The system will **find** the `python` program in `C:\opt\custompython\bin\python` and run it. |
|||
|
|||
It would be roughly equivalent to typing: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ C:\opt\custompython\bin\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
This information will be useful when learning about [Virtual Environments](virtual-environments.md){.internal-link target=_blank}. |
|||
|
|||
## Conclusion |
|||
|
|||
With this you should have a basic understanding of what **environment variables** are and how to use them in Python. |
|||
|
|||
You can also read more about them in the <a href="https://en.wikipedia.org/wiki/Environment_variable" class="external-link" target="_blank">Wikipedia for Environment Variable</a>. |
|||
|
|||
In many cases it's not very obvious how environment variables would be useful and applicable right away. But they keep showing up in many different scenarios when you are developing, so it's good to know about them. |
|||
|
|||
For example, you will need this information in the next section, about [Virtual Environments](virtual-environments.md). |
@ -0,0 +1,844 @@ |
|||
# Virtual Environments |
|||
|
|||
When you work in Python projects you probably should use a **virtual environment** (or a similar mechanism) to isolate the packages you install for each project. |
|||
|
|||
/// info |
|||
|
|||
If you already know about virtual environments, how to create them and use them, you might want to skip this section. 🤓 |
|||
|
|||
/// |
|||
|
|||
/// tip |
|||
|
|||
A **virtual environment** is different than an **environment variable**. |
|||
|
|||
An **environment variable** is a variable in the system that can be used by programs. |
|||
|
|||
A **virtual environment** is a directory with some files in it. |
|||
|
|||
/// |
|||
|
|||
/// info |
|||
|
|||
This page will teach you how to use **virtual environments** and how they work. |
|||
|
|||
If you are ready to adopt a **tool that manages everything** for you (including installing Python), try <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">uv</a>. |
|||
|
|||
/// |
|||
|
|||
## Create a Project |
|||
|
|||
First, create a directory for your project. |
|||
|
|||
What I normally do is that I create a directory named `code` inside my home/user directory. |
|||
|
|||
And inside of that I create one directory per project. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Go to the home directory |
|||
$ cd |
|||
// Create a directory for all your code projects |
|||
$ mkdir code |
|||
// Enter into that code directory |
|||
$ cd code |
|||
// Create a directory for this project |
|||
$ mkdir awesome-project |
|||
// Enter into that project directory |
|||
$ cd awesome-project |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## Create a Virtual Environment |
|||
|
|||
When you start working on a Python project **for the first time**, create a virtual environment **<abbr title="there are other options, this is a simple guideline">inside your project</abbr>**. |
|||
|
|||
/// tip |
|||
|
|||
You only need to do this **once per project**, not every time you work. |
|||
|
|||
/// |
|||
|
|||
//// tab | `venv` |
|||
|
|||
To create a virtual environment, you can use the `venv` module that comes with Python. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python -m venv .venv |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// details | What that command means |
|||
|
|||
* `python`: use the program called `python` |
|||
* `-m`: call a module as a script, we'll tell it which module next |
|||
* `venv`: use the module called `venv` that normally comes installed with Python |
|||
* `.venv`: create the virtual environment in the new directory `.venv` |
|||
|
|||
/// |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
If you have <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a> installed, you can use it to create a virtual environment. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv venv |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// tip |
|||
|
|||
By default, `uv` will create a virtual environment in a directory called `.venv`. |
|||
|
|||
But you could customize it passing an additional argument with the directory name. |
|||
|
|||
/// |
|||
|
|||
//// |
|||
|
|||
That command creates a new virtual environment in a directory called `.venv`. |
|||
|
|||
/// details | `.venv` or other name |
|||
|
|||
You could create the virtual environment in a different directory, but there's a convention of calling it `.venv`. |
|||
|
|||
/// |
|||
|
|||
## Activate the Virtual Environment |
|||
|
|||
Activate the new virtual environment so that any Python command you run or package you install uses it. |
|||
|
|||
/// tip |
|||
|
|||
Do this **every time** you start a **new terminal session** to work on the project. |
|||
|
|||
/// |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/bin/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ .venv\Scripts\Activate.ps1 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | 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 .venv/Scripts/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
/// tip |
|||
|
|||
Every time you install a **new package** in that environment, **activate** the environment again. |
|||
|
|||
This makes sure that if you use a **terminal (<abbr title="command line interface">CLI</abbr>) program** installed by that package, you use the one from your virtual environment and not any other that could be installed globally, probably with a different version than what you need. |
|||
|
|||
/// |
|||
|
|||
## Check the Virtual Environment is Active |
|||
|
|||
Check that the virtual environment is active (the previous command worked). |
|||
|
|||
/// tip |
|||
|
|||
This is **optional**, but it's a good way to **check** that everything is working as expected and you are using the virtual environment you intended. |
|||
|
|||
/// |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ which python |
|||
|
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
If it shows the `python` binary at `.venv/bin/python`, inside of your project (in this case `awesome-project`), then it worked. 🎉 |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ Get-Command python |
|||
|
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
If it shows the `python` binary at `.venv\Scripts\python`, inside of your project (in this case `awesome-project`), then it worked. 🎉 |
|||
|
|||
//// |
|||
|
|||
## Upgrade `pip` |
|||
|
|||
/// tip |
|||
|
|||
If you use <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a> you would use it to install things instead of `pip`, so you don't need to upgrade `pip`. 😎 |
|||
|
|||
/// |
|||
|
|||
If you are using `pip` to install packages (it comes by default with Python), you should **upgrade** it to the latest version. |
|||
|
|||
Many exotic errors while installing a package are solved by just upgrading `pip` first. |
|||
|
|||
/// tip |
|||
|
|||
You would normally do this **once**, right after you create the virtual environment. |
|||
|
|||
/// |
|||
|
|||
Make sure the virtual environment is active (with the command above) and then run: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python -m pip install --upgrade pip |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## Add `.gitignore` |
|||
|
|||
If you are using **Git** (you should), add a `.gitignore` file to exclude everything in your `.venv` from Git. |
|||
|
|||
/// tip |
|||
|
|||
If you used <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a> to create the virtual environment, it already did this for you, you can skip this step. 😎 |
|||
|
|||
/// |
|||
|
|||
/// tip |
|||
|
|||
Do this **once**, right after you create the virtual environment. |
|||
|
|||
/// |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ echo "*" > .venv/.gitignore |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// details | What that command means |
|||
|
|||
* `echo "*"`: will "print" the text `*` in the terminal (the next part changes that a bit) |
|||
* `>`: anything printed to the terminal by the command to the left of `>` should not be printed but instead written to the file that goes to the right of `>` |
|||
* `.gitignore`: the name of the file where the text should be written |
|||
|
|||
And `*` for Git means "everything". So, it will ignore everything in the `.venv` directory. |
|||
|
|||
That command will create a file `.gitignore` with the content: |
|||
|
|||
```gitignore |
|||
* |
|||
``` |
|||
|
|||
/// |
|||
|
|||
## Install Packages |
|||
|
|||
After activating the environment, you can install packages in it. |
|||
|
|||
/// tip |
|||
|
|||
Do this **once** when installing or upgrading the packages your project needs. |
|||
|
|||
If you need to upgrade a version or add a new package you would **do this again**. |
|||
|
|||
/// |
|||
|
|||
### Install Packages Directly |
|||
|
|||
If you're in a hurry and don't want to use a file to declare your project's package requirements, you can install them directly. |
|||
|
|||
/// tip |
|||
|
|||
It's a (very) good idea to put the packages and versions your program needs in a file (for example `requirements.txt` or `pyproject.toml`). |
|||
|
|||
/// |
|||
|
|||
//// tab | `pip` |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "fastapi[standard]" |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
If you have <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv pip install "fastapi[standard]" |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
### Install from `requirements.txt` |
|||
|
|||
If you have a `requirements.txt`, you can now use it to install its packages. |
|||
|
|||
//// tab | `pip` |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install -r requirements.txt |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | `uv` |
|||
|
|||
If you have <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">`uv`</a>: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uv pip install -r requirements.txt |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
/// details | `requirements.txt` |
|||
|
|||
A `requirements.txt` with some packages could look like: |
|||
|
|||
```requirements.txt |
|||
fastapi[standard]==0.113.0 |
|||
pydantic==2.8.0 |
|||
``` |
|||
|
|||
/// |
|||
|
|||
## Run Your Program |
|||
|
|||
After you activated the virtual environment, you can run your program, and it will use the Python inside of your virtual environment with the packages you installed there. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python main.py |
|||
|
|||
Hello World |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## Configure Your Editor |
|||
|
|||
You would probably use an editor, make sure you configure it to use the same virtual environment you created (it will probably autodetect it) so that you can get autocompletion and inline errors. |
|||
|
|||
For example: |
|||
|
|||
* <a href="https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment" class="external-link" target="_blank">VS Code</a> |
|||
* <a href="https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html" class="external-link" target="_blank">PyCharm</a> |
|||
|
|||
/// tip |
|||
|
|||
You normally have to do this only **once**, when you create the virtual environment. |
|||
|
|||
/// |
|||
|
|||
## Deactivate the Virtual Environment |
|||
|
|||
Once you are done working on your project you can **deactivate** the virtual environment. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ deactivate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
This way, when you run `python` it won't try to run it from that virtual environment with the packages installed there. |
|||
|
|||
## Ready to Work |
|||
|
|||
Now you're ready to start working on your project. |
|||
|
|||
|
|||
|
|||
/// tip |
|||
|
|||
Do you want to understand what's all that above? |
|||
|
|||
Continue reading. 👇🤓 |
|||
|
|||
/// |
|||
|
|||
## Why Virtual Environments |
|||
|
|||
To work with FastAPI you need to install <a href="https://www.python.org/" class="external-link" target="_blank">Python</a>. |
|||
|
|||
After that, you would need to **install** FastAPI and any other **packages** you want to use. |
|||
|
|||
To install packages you would normally use the `pip` command that comes with Python (or similar alternatives). |
|||
|
|||
Nevertheless, if you just use `pip` directly, the packages would be installed in your **global Python environment** (the global installation of Python). |
|||
|
|||
### The Problem |
|||
|
|||
So, what's the problem with installing packages in the global Python environment? |
|||
|
|||
At some point, you will probably end up writing many different programs that depend on **different packages**. And some of these projects you work on will depend on **different versions** of the same package. 😱 |
|||
|
|||
For example, you could create a project called `philosophers-stone`, this program depends on another package called **`harry`, using the version `1`**. So, you need to install `harry`. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
stone(philosophers-stone) -->|requires| harry-1[harry v1] |
|||
``` |
|||
|
|||
Then, at some point later, you create another project called `prisoner-of-azkaban`, and this project also depends on `harry`, but this project needs **`harry` version `3`**. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
azkaban(prisoner-of-azkaban) --> |requires| harry-3[harry v3] |
|||
``` |
|||
|
|||
But now the problem is, if you install the packages globally (in the global environment) instead of in a local **virtual environment**, you will have to choose which version of `harry` to install. |
|||
|
|||
If you want to run `philosophers-stone` you will need to first install `harry` version `1`, for example with: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "harry==1" |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
And then you would end up with `harry` version `1` installed in your global Python environment. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
subgraph global[global env] |
|||
harry-1[harry v1] |
|||
end |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) -->|requires| harry-1 |
|||
end |
|||
``` |
|||
|
|||
But then if you want to run `prisoner-of-azkaban`, you will need to uninstall `harry` version `1` and install `harry` version `3` (or just installing version `3` would automatically uninstall version `1`). |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "harry==3" |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
And then you would end up with `harry` version `3` installed in your global Python environment. |
|||
|
|||
And if you try to run `philosophers-stone` again, there's a chance it would **not work** because it needs `harry` version `1`. |
|||
|
|||
```mermaid |
|||
flowchart LR |
|||
subgraph global[global env] |
|||
harry-1[<strike>harry v1</strike>] |
|||
style harry-1 fill:#ccc,stroke-dasharray: 5 5 |
|||
harry-3[harry v3] |
|||
end |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) -.-x|⛔️| harry-1 |
|||
end |
|||
subgraph azkaban-project[prisoner-of-azkaban project] |
|||
azkaban(prisoner-of-azkaban) --> |requires| harry-3 |
|||
end |
|||
``` |
|||
|
|||
/// tip |
|||
|
|||
It's very common in Python packages to try the best to **avoid breaking changes** in **new versions**, but it's better to be safe, and install newer versions intentionally and when you can run the tests to check everything is working correctly. |
|||
|
|||
/// |
|||
|
|||
Now, imagine that with **many** other **packages** that all your **projects depend on**. That's very difficult to manage. And you would probably end up running some projects with some **incompatible versions** of the packages, and not knowing why something isn't working. |
|||
|
|||
Also, depending on your operating system (e.g. Linux, Windows, macOS), it could have come with Python already installed. And in that case it probably had some packages pre-installed with some specific versions **needed by your system**. If you install packages in the global Python environment, you could end up **breaking** some of the programs that came with your operating system. |
|||
|
|||
## Where are Packages Installed |
|||
|
|||
When you install Python, it creates some directories with some files in your computer. |
|||
|
|||
Some of these directories are the ones in charge of having all the packages you install. |
|||
|
|||
When you run: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Don't run this now, it's just an example 🤓 |
|||
$ pip install "fastapi[standard]" |
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
That will download a compressed file with the FastAPI code, normally from <a href="https://pypi.org/project/fastapi/" class="external-link" target="_blank">PyPI</a>. |
|||
|
|||
It will also **download** files for other packages that FastAPI depends on. |
|||
|
|||
Then it will **extract** all those files and put them in a directory in your computer. |
|||
|
|||
By default, it will put those files downloaded and extracted in the directory that comes with your Python installation, that's the **global environment**. |
|||
|
|||
## What are Virtual Environments |
|||
|
|||
The solution to the problems of having all the packages in the global environment is to use a **virtual environment for each project** you work on. |
|||
|
|||
A virtual environment is a **directory**, very similar to the global one, where you can install the packages for a project. |
|||
|
|||
This way, each project will have its own virtual environment (`.venv` directory) with its own packages. |
|||
|
|||
```mermaid |
|||
flowchart TB |
|||
subgraph stone-project[philosophers-stone project] |
|||
stone(philosophers-stone) --->|requires| harry-1 |
|||
subgraph venv1[.venv] |
|||
harry-1[harry v1] |
|||
end |
|||
end |
|||
subgraph azkaban-project[prisoner-of-azkaban project] |
|||
azkaban(prisoner-of-azkaban) --->|requires| harry-3 |
|||
subgraph venv2[.venv] |
|||
harry-3[harry v3] |
|||
end |
|||
end |
|||
stone-project ~~~ azkaban-project |
|||
``` |
|||
|
|||
## What Does Activating a Virtual Environment Mean |
|||
|
|||
When you activate a virtual environment, for example with: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ source .venv/bin/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ .venv\Scripts\Activate.ps1 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | 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 .venv/Scripts/activate |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
That command will create or modify some [environment variables](environment-variables.md){.internal-link target=_blank} that will be available for the next commands. |
|||
|
|||
One of those variables is the `PATH` variable. |
|||
|
|||
/// tip |
|||
|
|||
You can learn more about the `PATH` environment variable in the [Environment Variables](environment-variables.md#path-environment-variable){.internal-link target=_blank} section. |
|||
|
|||
/// |
|||
|
|||
Activating a virtual environment adds its path `.venv/bin` (on Linux and macOS) or `.venv\Scripts` (on Windows) to the `PATH` environment variable. |
|||
|
|||
Let's say that before activating the environment, the `PATH` variable looked like this: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
That means that the system would look for programs in: |
|||
|
|||
* `/usr/bin` |
|||
* `/bin` |
|||
* `/usr/sbin` |
|||
* `/sbin` |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Windows\System32 |
|||
``` |
|||
|
|||
That means that the system would look for programs in: |
|||
|
|||
* `C:\Windows\System32` |
|||
|
|||
//// |
|||
|
|||
After activating the virtual environment, the `PATH` variable would look something like this: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin:/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
That means that the system will now start looking first look for programs in: |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin |
|||
``` |
|||
|
|||
before looking in the other directories. |
|||
|
|||
So, when you type `python` in the terminal, the system will find the Python program in |
|||
|
|||
```plaintext |
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
and use that one. |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts;C:\Windows\System32 |
|||
``` |
|||
|
|||
That means that the system will now start looking first look for programs in: |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts |
|||
``` |
|||
|
|||
before looking in the other directories. |
|||
|
|||
So, when you type `python` in the terminal, the system will find the Python program in |
|||
|
|||
```plaintext |
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
and use that one. |
|||
|
|||
//// |
|||
|
|||
An important detail is that it will put the virtual environment path at the **beginning** of the `PATH` variable. The system will find it **before** finding any other Python available. This way, when you run `python`, it will use the Python **from the virtual environment** instead of any other `python` (for example, a `python` from a global environment). |
|||
|
|||
Activating a virtual environment also changes a couple of other things, but this is one of the most important things it does. |
|||
|
|||
## Checking a Virtual Environment |
|||
|
|||
When you check if a virtual environment is active, for example with: |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ which python |
|||
|
|||
/home/user/code/awesome-project/.venv/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ Get-Command python |
|||
|
|||
C:\Users\user\code\awesome-project\.venv\Scripts\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
That means that the `python` program that will be used is the one **in the virtual environment**. |
|||
|
|||
you use `which` in Linux and macOS and `Get-Command` in Windows PowerShell. |
|||
|
|||
The way that command works is that it will go and check in the `PATH` environment variable, going through **each path in order**, looking for the program called `python`. Once it finds it, it will **show you the path** to that program. |
|||
|
|||
The most important part is that when you call `python`, that is the exact "`python`" that will be executed. |
|||
|
|||
So, you can confirm if you are in the correct virtual environment. |
|||
|
|||
/// tip |
|||
|
|||
It's easy to activate one virtual environment, get one Python, and then **go to another project**. |
|||
|
|||
And the second project **wouldn't work** because you are using the **incorrect Python**, from a virtual environment for another project. |
|||
|
|||
It's useful being able to check what `python` is being used. 🤓 |
|||
|
|||
/// |
|||
|
|||
## Why Deactivate a Virtual Environment |
|||
|
|||
For example, you could be working on a project `philosophers-stone`, **activate that virtual environment**, install packages and work with that environment. |
|||
|
|||
And then you want to work on **another project** `prisoner-of-azkaban`. |
|||
|
|||
You go to that project: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
If you don't deactivate the virtual environment for `philosophers-stone`, when you run `python` in the terminal, it will try to use the Python from `philosophers-stone`. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
|
|||
$ python main.py |
|||
|
|||
// Error importing sirius, it's not installed 😱 |
|||
Traceback (most recent call last): |
|||
File "main.py", line 1, in <module> |
|||
import sirius |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
But if you deactivate the virtual environment and activate the new one for `prisoner-of-askaban` then when you run `python` it will use the Python from the virtual environment in `prisoner-of-azkaban`. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ cd ~/code/prisoner-of-azkaban |
|||
|
|||
// You don't need to be in the old directory to deactivate, you can do it wherever you are, even after going to the other project 😎 |
|||
$ deactivate |
|||
|
|||
// Activate the virtual environment in prisoner-of-azkaban/.venv 🚀 |
|||
$ source .venv/bin/activate |
|||
|
|||
// Now when you run python, it will find the package sirius installed in this virtual environment ✨ |
|||
$ python main.py |
|||
|
|||
I solemnly swear 🐺 |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## Alternatives |
|||
|
|||
This is a simple guide to get you started and teach you how everything works **underneath**. |
|||
|
|||
There are many **alternatives** to managing virtual environments, package dependencies (requirements), projects. |
|||
|
|||
Once you are ready and want to use a tool to **manage the entire project**, packages dependencies, virtual environments, etc. I would suggest you try <a href="https://github.com/astral-sh/uv" class="external-link" target="_blank">uv</a>. |
|||
|
|||
`uv` can do a lot of things, it can: |
|||
|
|||
* **Install Python** for you, including different versions |
|||
* Manage the **virtual environment** for your projects |
|||
* Install **packages** |
|||
* Manage package **dependencies and versions** for your project |
|||
* Make sure you have an **exact** set of packages and versions to install, including their dependencies, so that you can be sure that you can run your project in production exactly the same as in your computer while developing, this is called **locking** |
|||
* And many other things |
|||
|
|||
## Conclusion |
|||
|
|||
If you read and understood all this, now **you know much more** about virtual environments than many developers out there. 🤓 |
|||
|
|||
Knowing these details will most probably be useful in a future time when you are debugging something that seems complex, but you will know **how it all works underneath**. 😎 |
@ -1,180 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# La communauté FastAPI |
|||
|
|||
FastAPI a une communauté extraordinaire qui accueille des personnes de tous horizons. |
|||
|
|||
## Créateur - Mainteneur |
|||
|
|||
Salut! 👋 |
|||
|
|||
C'est moi : |
|||
|
|||
{% 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">Réponses: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Je suis le créateur et le responsable de **FastAPI**. Vous pouvez en lire plus à ce sujet dans [Aide FastAPI - Obtenir de l'aide - Se rapprocher de l'auteur](help-fastapi.md#se-rapprocher-de-lauteur){.internal-link target=_blank}. |
|||
|
|||
...Mais ici, je veux vous montrer la communauté. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** reçoit beaucoup de soutien de la part de la communauté. Et je tiens à souligner leurs contributions. |
|||
|
|||
Ce sont ces personnes qui : |
|||
|
|||
* [Aident les autres à résoudre des problèmes (questions) dans GitHub](help-fastapi.md#aider-les-autres-a-resoudre-les-problemes-dans-github){.internal-link target=_blank}. |
|||
* [Créent des Pull Requests](help-fastapi.md#creer-une-pull-request){.internal-link target=_blank}. |
|||
* Review les Pull Requests, [particulièrement important pour les traductions](contributing.md#traductions){.internal-link target=_blank}. |
|||
|
|||
Une salve d'applaudissements pour eux. 👏 🙇 |
|||
|
|||
## Utilisateurs les plus actifs le mois dernier |
|||
|
|||
Ce sont les utilisateurs qui ont [aidé le plus les autres avec des problèmes (questions) dans GitHub](help-fastapi.md#aider-les-autres-a-resoudre-les-problemes-dans-github){.internal-link target=_blank} au cours du dernier mois. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">Questions répondues: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Experts |
|||
|
|||
Voici les **Experts FastAPI**. 🤓 |
|||
|
|||
Ce sont les utilisateurs qui ont [aidé le plus les autres avec des problèmes (questions) dans GitHub](help-fastapi.md#aider-les-autres-a-resoudre-les-problemes-dans-github){.internal-link target=_blank} depuis *toujours*. |
|||
|
|||
Ils ont prouvé qu'ils étaient des experts en aidant beaucoup d'autres personnes. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Questions répondues: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Principaux contributeurs |
|||
|
|||
Ces utilisateurs sont les **Principaux contributeurs**. 👷 |
|||
|
|||
Ces utilisateurs ont [créé le plus grand nombre de demandes Pull Request](help-fastapi.md#creer-une-pull-request){.internal-link target=_blank} qui ont été *merged*. |
|||
|
|||
Ils ont contribué au code source, à la documentation, aux traductions, etc. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Il existe de nombreux autres contributeurs (plus d'une centaine), vous pouvez les voir tous dans la <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">Page des contributeurs de FastAPI GitHub</a>. 👷 |
|||
|
|||
## Principaux Reviewers |
|||
|
|||
Ces utilisateurs sont les **Principaux Reviewers**. 🕵️ |
|||
|
|||
### Reviewers des traductions |
|||
|
|||
Je ne parle que quelques langues (et pas très bien 😅). Ainsi, les reviewers sont ceux qui ont le [**pouvoir d'approuver les traductions**](contributing.md#traductions){.internal-link target=_blank} de la documentation. Sans eux, il n'y aurait pas de documentation dans plusieurs autres langues. |
|||
|
|||
--- |
|||
|
|||
Les **Principaux Reviewers** 🕵️ ont examiné le plus grand nombre de demandes Pull Request des autres, assurant la qualité du code, de la documentation, et surtout, des **traductions**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Reviews: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsors |
|||
|
|||
Ce sont les **Sponsors**. 😎 |
|||
|
|||
Ils soutiennent mon travail avec **FastAPI** (et d'autres) avec <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Gold Sponsors |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Silver Sponsors |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Bronze Sponsors |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
### Individual Sponsors |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## À propos des données - détails techniques |
|||
|
|||
L'intention de cette page est de souligner l'effort de la communauté pour aider les autres. |
|||
|
|||
Notamment en incluant des efforts qui sont normalement moins visibles, et, dans de nombreux cas, plus difficile, comme aider d'autres personnes à résoudre des problèmes et examiner les Pull Requests de traduction. |
|||
|
|||
Les données sont calculées chaque mois, vous pouvez lire le <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">code source ici</a>. |
|||
|
|||
Je me réserve également le droit de mettre à jour l'algorithme, les sections, les seuils, etc. (juste au cas où 🤷). |
@ -1,184 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI People |
|||
|
|||
FastAPIには、様々なバックグラウンドの人々を歓迎する素晴らしいコミュニティがあります。 |
|||
|
|||
## Creator - Maintainer |
|||
|
|||
こんにちは! 👋 |
|||
|
|||
これが私です: |
|||
|
|||
{% 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 %} |
|||
|
|||
私は **FastAPI** の作成者および Maintainer です。詳しくは [FastAPIを応援 - ヘルプの入手 - 開発者とつながる](help-fastapi.md#_1){.internal-link target=_blank} に記載しています。 |
|||
|
|||
...ところで、ここではコミュニティを紹介したいと思います。 |
|||
|
|||
--- |
|||
|
|||
**FastAPI** は、コミュニティから多くのサポートを受けています。そこで、彼らの貢献にスポットライトを当てたいと思います。 |
|||
|
|||
紹介するのは次のような人々です: |
|||
|
|||
* [GitHub issuesで他の人を助ける](help-fastapi.md#github-issues){.internal-link target=_blank}。 |
|||
* [プルリクエストをする](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}。 |
|||
* プルリクエストのレビューをする ([特に翻訳に重要](contributing.md#_8){.internal-link target=_blank})。 |
|||
|
|||
彼らに大きな拍手を。👏 🙇 |
|||
|
|||
## 先月最もアクティブだったユーザー |
|||
|
|||
彼らは、先月の[GitHub issuesで最も多くの人を助けた](help-fastapi.md#github-issues){.internal-link target=_blank}ユーザーです。☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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 |
|||
|
|||
**FastAPI experts** を紹介します。🤓 |
|||
|
|||
彼らは、*これまでに* [GitHub issuesで最も多くの人を助けた](help-fastapi.md#github-issues){.internal-link target=_blank}ユーザーです。 |
|||
|
|||
多くの人を助けることでexpertsであると示されています。✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Issues replied: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Top Contributors |
|||
|
|||
**Top Contributors** を紹介します。👷 |
|||
|
|||
彼らは、*マージされた* [最も多くのプルリクエストを作成した](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}ユーザーです。 |
|||
|
|||
ソースコード、ドキュメント、翻訳などに貢献してくれました。📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
他にもたくさん (100人以上) の contributors がいます。<a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors ページ</a>ですべての contributors を確認できます。👷 |
|||
|
|||
## Top Reviewers |
|||
|
|||
以下のユーザーは **Top Reviewers** です。🕵️ |
|||
|
|||
### 翻訳のレビュー |
|||
|
|||
私は少しの言語しか話せません (もしくはあまり上手ではありません😅)。したがって、reviewers は、ドキュメントの[**翻訳を承認する権限**](contributing.md#_8){.internal-link target=_blank}を持っています。それらがなければ、いくつかの言語のドキュメントはなかったでしょう。 |
|||
|
|||
--- |
|||
|
|||
**Top Reviewers** 🕵️は、他の人からのプルリクエストのほとんどをレビューし、コード、ドキュメント、特に**翻訳**の品質を保証しています。 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Reviews: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsors |
|||
|
|||
**Sponsors** を紹介します。😎 |
|||
|
|||
彼らは、<a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a> を介して私の **FastAPI** などに関する活動を支援してくれています。 |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Gold Sponsors |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Silver Sponsors |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Bronze Sponsors |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Individual Sponsors |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## データについて - 技術詳細 |
|||
|
|||
このページの目的は、他の人を助けるためのコミュニティの努力にスポットライトを当てるためです。 |
|||
|
|||
特に、他の人の issues を支援したり、翻訳のプルリクエストを確認したりするなど、通常は目立たず、多くの場合、より困難な作業を含みます。 |
|||
|
|||
データは毎月集計されます。<a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">ソースコードはこちら</a>で確認できます。 |
|||
|
|||
ここでは、スポンサーの貢献も強調しています。 |
|||
|
|||
アルゴリズム、セクション、閾値などは更新されるかもしれません (念のために 🤷)。 |
@ -0,0 +1,5 @@ |
|||
# 学習 |
|||
|
|||
ここでは、**FastAPI** を学習するための入門セクションとチュートリアルを紹介します。 |
|||
|
|||
これは、FastAPIを学習するにあたっての**書籍**や**コース**であり、**公式**かつ推奨される方法とみなすことができます 😎 |
@ -0,0 +1,201 @@ |
|||
# Functionaliteit |
|||
|
|||
## FastAPI functionaliteit |
|||
|
|||
**FastAPI** biedt je het volgende: |
|||
|
|||
### Gebaseerd op open standaarden |
|||
|
|||
* <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank"><strong>OpenAPI</strong></a> voor het maken van API's, inclusief declaraties van <abbr title="ook bekend als: endpoints, routess">pad</abbr><abbr title="ook bekend als HTTP-methoden, zoals POST, GET, PUT, DELETE">bewerkingen</abbr>, parameters, request bodies, beveiliging, enz. |
|||
* Automatische datamodel documentatie met <a href="https://json-schema.org/" class="external-link" target="_blank"><strong>JSON Schema</strong></a> (aangezien OpenAPI zelf is gebaseerd op JSON Schema). |
|||
* Ontworpen op basis van deze standaarden, na zorgvuldig onderzoek. In plaats van achteraf deze laag er bovenop te bouwen. |
|||
* Dit maakt het ook mogelijk om automatisch **clientcode te genereren** in verschillende programmeertalen. |
|||
|
|||
### Automatische documentatie |
|||
|
|||
Interactieve API-documentatie en verkenning van webgebruikersinterfaces. Aangezien dit framework is gebaseerd op OpenAPI, zijn er meerdere documentatie opties mogelijk, waarvan er standaard 2 zijn inbegrepen. |
|||
|
|||
* <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank"><strong>Swagger UI</strong></a>, met interactieve interface, maakt het mogelijk je API rechtstreeks vanuit de browser aan te roepen en te testen. |
|||
|
|||
 |
|||
|
|||
* Alternatieve API-documentatie met <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank"><strong>ReDoc</strong></a>. |
|||
|
|||
 |
|||
|
|||
### Gewoon Moderne Python |
|||
|
|||
Het is allemaal gebaseerd op standaard **Python type** declaraties (dankzij Pydantic). Je hoeft dus geen nieuwe syntax te leren. Het is gewoon standaard moderne Python. |
|||
|
|||
Als je een opfriscursus van 2 minuten nodig hebt over het gebruik van Python types (zelfs als je FastAPI niet gebruikt), bekijk dan deze korte tutorial: [Python Types](python-types.md){.internal-link target=_blank}. |
|||
|
|||
Je schrijft gewoon standaard Python met types: |
|||
|
|||
```Python |
|||
from datetime import date |
|||
|
|||
from pydantic import BaseModel |
|||
|
|||
# Declareer een variabele als een str |
|||
# en krijg editorondersteuning in de functie |
|||
def main(user_id: str): |
|||
return user_id |
|||
|
|||
|
|||
# Een Pydantic model |
|||
class User(BaseModel): |
|||
id: int |
|||
name: str |
|||
joined: date |
|||
``` |
|||
|
|||
Vervolgens kan je het op deze manier gebruiken: |
|||
|
|||
```Python |
|||
my_user: User = User(id=3, name="John Doe", joined="2018-07-19") |
|||
|
|||
second_user_data = { |
|||
"id": 4, |
|||
"name": "Mary", |
|||
"joined": "2018-11-30", |
|||
} |
|||
|
|||
my_second_user: User = User(**second_user_data) |
|||
``` |
|||
|
|||
/// info |
|||
|
|||
`**second_user_data` betekent: |
|||
|
|||
Geef de sleutels (keys) en waarden (values) van de `second_user_data` dict direct door als sleutel-waarden argumenten, gelijk aan: `User(id=4, name=“Mary”, joined=“2018-11-30”)` |
|||
|
|||
/// |
|||
|
|||
### Editor-ondersteuning |
|||
|
|||
Het gehele framework is ontworpen om eenvoudig en intuïtief te zijn in gebruik. Alle beslissingen zijn getest op meerdere code-editors nog voordat het daadwerkelijke ontwikkelen begon, om zo de beste ontwikkelervaring te garanderen. |
|||
|
|||
Uit enquêtes onder Python ontwikkelaars blijkt maar al te duidelijk dat "(automatische) code aanvulling" <a href="https://www.jetbrains.com/research/python-developers-survey-2017/#tools-and-features" class="external-link" target="_blank">een van de meest gebruikte functionaliteiten is</a>. |
|||
|
|||
Het hele **FastAPI** framework is daarop gebaseerd. Automatische code aanvulling werkt overal. |
|||
|
|||
Je hoeft zelden terug te vallen op de documentatie. |
|||
|
|||
Zo kan je editor je helpen: |
|||
|
|||
* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>: |
|||
|
|||
 |
|||
|
|||
* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>: |
|||
|
|||
 |
|||
|
|||
Je krijgt autocomletion die je voorheen misschien zelfs voor onmogelijk had gehouden. Zoals bijvoorbeeld de `price` key in een JSON body (die genest had kunnen zijn) die afkomstig is van een request. |
|||
|
|||
Je hoeft niet langer de verkeerde keys in te typen, op en neer te gaan tussen de documentatie, of heen en weer te scrollen om te checken of je `username` of toch `user_name` had gebruikt. |
|||
|
|||
### Kort |
|||
|
|||
Dit framework heeft voor alles verstandige **standaardinstellingen**, met overal optionele configuraties. Alle parameters kunnen worden verfijnd zodat het past bij wat je nodig hebt, om zo de API te kunnen definiëren die jij nodig hebt. |
|||
|
|||
Maar standaard werkt alles **“gewoon”**. |
|||
|
|||
### Validatie |
|||
|
|||
* Validatie voor de meeste (of misschien wel alle?) Python **datatypes**, inclusief: |
|||
* JSON objecten (`dict`). |
|||
* JSON array (`list`) die itemtypes definiëren. |
|||
* String (`str`) velden, die min en max lengtes hebben. |
|||
* Getallen (`int`, `float`) met min en max waarden, enz. |
|||
|
|||
* Validatie voor meer exotische typen, zoals: |
|||
* URL. |
|||
* E-mail. |
|||
* UUID. |
|||
* ...en anderen. |
|||
|
|||
Alle validatie wordt uitgevoerd door het beproefde en robuuste **Pydantic**. |
|||
|
|||
### Beveiliging en authenticatie |
|||
|
|||
Beveiliging en authenticatie is geïntegreerd. Zonder compromissen te doen naar databases of datamodellen. |
|||
|
|||
Alle beveiligingsschema's gedefinieerd in OpenAPI, inclusief: |
|||
|
|||
* HTTP Basic. |
|||
* **OAuth2** (ook met **JWT tokens**). Bekijk de tutorial over [OAuth2 with JWT](tutorial/security/oauth2-jwt.md){.internal-link target=_blank}. |
|||
* API keys in: |
|||
* Headers. |
|||
* Query parameters. |
|||
* Cookies, enz. |
|||
|
|||
Plus alle beveiligingsfuncties van Starlette (inclusief **sessiecookies**). |
|||
|
|||
Gebouwd als een herbruikbare tool met componenten die makkelijk te integreren zijn in en met je systemen, datastores, relationele en NoSQL databases, enz. |
|||
|
|||
### Dependency Injection |
|||
|
|||
FastAPI bevat een uiterst eenvoudig, maar uiterst krachtig <abbr title='ook bekend als "componenten", "bronnen", "diensten", "aanbieders"'><strong>Dependency Injection</strong></abbr> systeem. |
|||
|
|||
* Zelfs dependencies kunnen dependencies hebben, waardoor een hiërarchie of **“graph” van dependencies** ontstaat. |
|||
* Allemaal **automatisch afgehandeld** door het framework. |
|||
* Alle dependencies kunnen data nodig hebben van request, de vereiste **padoperaties veranderen** en automatische documentatie verstrekken. |
|||
* **Automatische validatie** zelfs voor *padoperatie* parameters gedefinieerd in dependencies. |
|||
* Ondersteuning voor complexe gebruikersauthenticatiesystemen, **databaseverbindingen**, enz. |
|||
* **Geen compromisen** met databases, gebruikersinterfaces, enz. Maar eenvoudige integratie met ze allemaal. |
|||
|
|||
### Ongelimiteerde "plug-ins" |
|||
|
|||
Of anders gezegd, je hebt ze niet nodig, importeer en gebruik de code die je nodig hebt. |
|||
|
|||
Elke integratie is ontworpen om eenvoudig te gebruiken (met afhankelijkheden), zodat je een “plug-in" kunt maken in 2 regels code, met dezelfde structuur en syntax die wordt gebruikt voor je *padbewerkingen*. |
|||
|
|||
### Getest |
|||
|
|||
* 100% <abbr title="De hoeveelheid code die automatisch wordt getest">van de code is getest</abbr>. |
|||
* 100% <abbr title="Python type annotaties, hiermee kunnen je editor en externe tools je beter ondersteunen">type geannoteerde</abbr> codebase. |
|||
* Wordt gebruikt in productietoepassingen. |
|||
|
|||
## Starlette functies |
|||
|
|||
**FastAPI** is volledig verenigbaar met (en gebaseerd op) <a href="https://www.starlette.io/" class="external-link" target="_blank"><strong>Starlette</strong></a>. |
|||
|
|||
`FastAPI` is eigenlijk een subklasse van `Starlette`. Dus als je Starlette al kent of gebruikt, zal de meeste functionaliteit op dezelfde manier werken. |
|||
|
|||
Met **FastAPI** krijg je alle functies van **Starlette** (FastAPI is gewoon Starlette op steroïden): |
|||
|
|||
* Zeer indrukwekkende prestaties. Het is <a href="https://github.com/encode/starlette#performance" class="external-link" target="_blank">een van de snelste Python frameworks, vergelijkbaar met **NodeJS** en **Go**</a>. |
|||
* **WebSocket** ondersteuning. |
|||
* Taken in de achtergrond tijdens het proces. |
|||
* Opstart- en afsluit events. |
|||
* Test client gebouwd op HTTPX. |
|||
* **CORS**, GZip, Statische bestanden, Streaming reacties. |
|||
* **Sessie en Cookie** ondersteuning. |
|||
* 100% van de code is getest. |
|||
* 100% type geannoteerde codebase. |
|||
|
|||
## Pydantic functionaliteit |
|||
|
|||
**FastAPI** is volledig verenigbaar met (en gebaseerd op) Pydantic. Dus alle extra <a href="https://docs.pydantic.dev/" class="external-link" target="_blank"><strong>Pydantic</strong></a> code die je nog hebt werkt ook. |
|||
|
|||
Inclusief externe pakketten die ook gebaseerd zijn op Pydantic, zoals <abbr title="Object-Relational Mapper">ORM</abbr>s, <abbr title="Object-Document Mapper">ODM</abbr>s voor databases. |
|||
|
|||
Dit betekent ook dat je in veel gevallen het object dat je van een request krijgt **direct naar je database** kunt sturen, omdat alles automatisch wordt gevalideerd. |
|||
|
|||
Hetzelfde geldt ook andersom, in veel gevallen kun je dus het object dat je krijgt van de database **direct doorgeven aan de client**. |
|||
|
|||
Met **FastAPI** krijg je alle functionaliteit van **Pydantic** (omdat FastAPI is gebaseerd op Pydantic voor alle dataverwerking): |
|||
|
|||
* **Geen brainfucks**: |
|||
* Je hoeft geen nieuwe microtaal voor schemadefinities te leren. |
|||
* Als je bekend bent Python types, weet je hoe je Pydantic moet gebruiken. |
|||
* Werkt goed samen met je **<abbr title=“Integrated Development Environment, vergelijkbaar met een code editor”>IDE</abbr>/<abbr title=“Een programma dat controleert op fouten in de code”>linter</abbr>/hersenen**: |
|||
* Doordat pydantic's datastructuren enkel instanties zijn van klassen, die je definieert, werkt automatische aanvulling, linting, mypy en je intuïtie allemaal goed met je gevalideerde data. |
|||
* Valideer **complexe structuren**: |
|||
* Gebruik van hiërarchische Pydantic modellen, Python `typing`'s `List` en `Dict`, enz. |
|||
* Met validators kunnen complexe dataschema's duidelijk en eenvoudig worden gedefinieerd, gecontroleerd en gedocumenteerd als JSON Schema. |
|||
* Je kunt diep **geneste JSON** objecten laten valideren en annoteren. |
|||
* **Uitbreidbaar**: |
|||
* Met Pydantic kunnen op maat gemaakte datatypen worden gedefinieerd of je kunt validatie uitbreiden met methoden op een model dat is ingericht met de decorator validator. |
|||
* 100% van de code is getest. |
@ -0,0 +1,494 @@ |
|||
# FastAPI |
|||
|
|||
<style> |
|||
.md-content .md-typeset h1 { display: none; } |
|||
</style> |
|||
|
|||
<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, zeer goede prestaties, eenvoudig te leren, snel te programmeren, klaar voor productie</em> |
|||
</p> |
|||
<p align="center"> |
|||
<a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank"> |
|||
<img src="https://github.com/fastapi/fastapi/workflows/Test/badge.svg?event=push&branch=master" alt="Test"> |
|||
</a> |
|||
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi" target="_blank"> |
|||
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg" 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> |
|||
<a href="https://pypi.org/project/fastapi" target="_blank"> |
|||
<img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions"> |
|||
</a> |
|||
</p> |
|||
|
|||
--- |
|||
|
|||
**Documentatie**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a> |
|||
|
|||
**Broncode**: <a href="https://github.com/fastapi/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a> |
|||
|
|||
--- |
|||
|
|||
FastAPI is een modern, snel (zeer goede prestaties), web framework voor het bouwen van API's in Python, gebruikmakend van standaard Python type-hints. |
|||
|
|||
De belangrijkste kenmerken zijn: |
|||
|
|||
* **Snel**: Zeer goede prestaties, vergelijkbaar met **NodeJS** en **Go** (dankzij Starlette en Pydantic). [Een van de snelste beschikbare Python frameworks](#prestaties). |
|||
* **Snel te programmeren**: Verhoog de snelheid om functionaliteit te ontwikkelen met ongeveer 200% tot 300%. * |
|||
* **Minder bugs**: Verminder ongeveer 40% van de door mensen (ontwikkelaars) veroorzaakte fouten. * |
|||
* **Intuïtief**: Buitengewoon goede ondersteuning voor editors. <abbr title="ook bekend als automatisch aanvullen, automatisch aanvullen, IntelliSense">Overal automische code aanvulling</abbr>. Minder tijd kwijt aan debuggen. |
|||
* **Eenvoudig**: Ontworpen om gemakkelijk te gebruiken en te leren. Minder tijd nodig om documentatie te lezen. |
|||
* **Kort**: Minimaliseer codeduplicatie. Elke parameterdeclaratie ondersteunt meerdere functionaliteiten. Minder bugs. |
|||
* **Robust**: Code gereed voor productie. Met automatische interactieve documentatie. |
|||
* **Standards-based**: Gebaseerd op (en volledig verenigbaar met) open standaarden voor API's: <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (voorheen bekend als Swagger) en <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>. |
|||
|
|||
<small>* schatting op basis van testen met een intern ontwikkelteam en bouwen van productieapplicaties.</small> |
|||
|
|||
## Sponsors |
|||
|
|||
<!-- sponsors --> |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor -%} |
|||
{%- for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
<!-- /sponsors --> |
|||
|
|||
<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Overige sponsoren</a> |
|||
|
|||
## Meningen |
|||
|
|||
"_[...] Ik gebruik **FastAPI** heel vaak tegenwoordig. [...] Ik ben van plan om het te gebruiken voor alle **ML-services van mijn team bij Microsoft**. Sommige van deze worden geïntegreerd in het kernproduct van **Windows** en sommige **Office**-producten._" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/fastapi/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_We hebben de **FastAPI** library gebruikt om een **REST** server te maken die bevraagd kan worden om **voorspellingen** te maken. [voor Ludwig]_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin en Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_**Netflix** is verheugd om een open-source release aan te kondigen van ons **crisismanagement**-orkestratieframework: **Dispatch**! [gebouwd met **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> |
|||
|
|||
--- |
|||
|
|||
"_Ik ben super enthousiast over **FastAPI**. Het is zo leuk!_" |
|||
|
|||
<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 presentator</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_Wat je hebt gebouwd ziet er echt super solide en gepolijst uit. In veel opzichten is het wat ik wilde dat **Hug** kon zijn - het is echt inspirerend om iemand dit te zien bouwen._" |
|||
|
|||
<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> |
|||
|
|||
--- |
|||
|
|||
"Wie geïnteresseerd is in een **modern framework** voor het bouwen van REST API's, bekijkt best eens **FastAPI** [...] Het is snel, gebruiksvriendelijk en gemakkelijk te leren [...]_" |
|||
|
|||
"_We zijn overgestapt naar **FastAPI** voor onze **API's** [...] Het gaat jou vast ook bevallen [...]_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">Ines Montani - Matthew Honnibal - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> oprichters - <a href="https://spacy.io" target="_blank">spaCy</a> ontwikkelaars</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> |
|||
|
|||
--- |
|||
|
|||
"_Wie een Python API wil bouwen voor productie, kan ik ten stelligste **FastAPI** aanraden. Het is **prachtig ontworpen**, **eenvoudig te gebruiken** en **gemakkelijk schaalbaar**, het is een **cruciale component** geworden in onze strategie om API's centraal te zetten, en het vereenvoudigt automatisering en diensten zoals onze Virtual TAC Engineer._" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">Deon Pillsbury - <strong>Cisco</strong> <a href="https://www.linkedin.com/posts/deonpillsbury_cisco-cx-python-activity-6963242628536487936-trAp/" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
## **Typer**, de FastAPI van 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> |
|||
|
|||
Als je een <abbr title="Command Line Interface">CLI</abbr>-app bouwt die in de terminal moet worden gebruikt in plaats van een web-API, gebruik dan <a href="https://typer.tiangolo.com/ " class="external-link" target="_blank">**Typer**</a>. |
|||
|
|||
**Typer** is het kleine broertje van FastAPI. En het is bedoeld als de **FastAPI van CLI's**. ️ |
|||
|
|||
## Vereisten |
|||
|
|||
FastAPI staat op de schouders van reuzen: |
|||
|
|||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> voor de webonderdelen. |
|||
* <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> voor de datadelen. |
|||
|
|||
## Installatie |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "fastapi[standard]" |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
**Opmerking**: Zet `"fastapi[standard]"` tussen aanhalingstekens om ervoor te zorgen dat het werkt in alle terminals. |
|||
|
|||
## Voorbeeld |
|||
|
|||
### Creëer het |
|||
|
|||
* Maak het bestand `main.py` aan met daarin: |
|||
|
|||
```Python |
|||
from typing import Union |
|||
|
|||
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: Union[str, None] = None): |
|||
return {"item_id": item_id, "q": q} |
|||
``` |
|||
|
|||
<details markdown="1"> |
|||
<summary>Of maak gebruik van <code>async def</code>...</summary> |
|||
|
|||
Als je code gebruik maakt van `async` / `await`, gebruik dan `async def`: |
|||
|
|||
```Python hl_lines="9 14" |
|||
from typing import Union |
|||
|
|||
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: Union[str, None] = None): |
|||
return {"item_id": item_id, "q": q} |
|||
``` |
|||
|
|||
**Opmerking**: |
|||
|
|||
Als je het niet weet, kijk dan in het gedeelte _"Heb je haast?"_ over <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` en `await` in de documentatie</a>. |
|||
|
|||
</details> |
|||
|
|||
### Voer het uit |
|||
|
|||
Run de server met: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ fastapi dev main.py |
|||
|
|||
╭────────── FastAPI CLI - Development mode ───────────╮ |
|||
│ │ |
|||
│ Serving at: http://127.0.0.1:8000 │ |
|||
│ │ |
|||
│ API docs: http://127.0.0.1:8000/docs │ |
|||
│ │ |
|||
│ Running in development mode, for production use: │ |
|||
│ │ |
|||
│ fastapi run │ |
|||
│ │ |
|||
╰─────────────────────────────────────────────────────╯ |
|||
|
|||
INFO: Will watch for changes in these directories: ['/home/user/code/awesomeapp'] |
|||
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) |
|||
INFO: Started reloader process [2248755] using WatchFiles |
|||
INFO: Started server process [2248757] |
|||
INFO: Waiting for application startup. |
|||
INFO: Application startup complete. |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
<details markdown="1"> |
|||
<summary>Over het commando <code>fastapi dev main.py</code>...</summary> |
|||
|
|||
Het commando `fastapi dev` leest het `main.py` bestand, detecteert de **FastAPI** app, en start een server met <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a>. |
|||
|
|||
Standaard zal dit commando `fastapi dev` starten met "auto-reload" geactiveerd voor ontwikkeling op het lokale systeem. |
|||
|
|||
Je kan hier meer over lezen in de <a href="https://fastapi.tiangolo.com/fastapi-cli/" target="_blank">FastAPI CLI documentatie</a>. |
|||
|
|||
</details> |
|||
|
|||
### Controleer het |
|||
|
|||
Open je browser op <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>. |
|||
|
|||
Je zult een JSON response zien: |
|||
|
|||
```JSON |
|||
{"item_id": 5, "q": "somequery"} |
|||
``` |
|||
|
|||
Je hebt een API gemaakt die: |
|||
|
|||
* HTTP verzoeken kan ontvangen op de _paden_ `/` en `/items/{item_id}`. |
|||
* Beide _paden_ hebben `GET` <em>operaties</em> (ook bekend als HTTP _methoden_). |
|||
* Het _pad_ `/items/{item_id}` heeft een _pad parameter_ `item_id` dat een `int` moet zijn. |
|||
* Het _pad_ `/items/{item_id}` heeft een optionele `str` _query parameter_ `q`. |
|||
|
|||
### Interactieve API documentatie |
|||
|
|||
Ga naar <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>. |
|||
|
|||
Je ziet de automatische interactieve API documentatie (verstrekt door <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>): |
|||
|
|||
 |
|||
|
|||
### Alternatieve API documentatie |
|||
|
|||
Ga vervolgens naar <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>. |
|||
|
|||
Je ziet de automatische interactieve API documentatie (verstrekt door <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>): |
|||
|
|||
 |
|||
|
|||
## Voorbeeld upgrade |
|||
|
|||
Pas nu het bestand `main.py` aan om de body van een `PUT` request te ontvangen. |
|||
|
|||
Dankzij Pydantic kunnen we de body declareren met standaard Python types. |
|||
|
|||
```Python hl_lines="4 9-12 25-27" |
|||
from typing import Union |
|||
|
|||
from fastapi import FastAPI |
|||
from pydantic import BaseModel |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
class Item(BaseModel): |
|||
name: str |
|||
price: float |
|||
is_offer: Union[bool, None] = None |
|||
|
|||
|
|||
@app.get("/") |
|||
def read_root(): |
|||
return {"Hello": "World"} |
|||
|
|||
|
|||
@app.get("/items/{item_id}") |
|||
def read_item(item_id: int, q: Union[str, None] = 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} |
|||
``` |
|||
|
|||
De `fastapi dev` server zou automatisch moeten herladen. |
|||
|
|||
### Interactieve API documentatie upgrade |
|||
|
|||
Ga nu naar <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>. |
|||
|
|||
* De interactieve API-documentatie wordt automatisch bijgewerkt, inclusief de nieuwe body: |
|||
|
|||
 |
|||
|
|||
* Klik op de knop "Try it out", hiermee kan je de parameters invullen en direct met de API interacteren: |
|||
|
|||
 |
|||
|
|||
* Klik vervolgens op de knop "Execute", de gebruikersinterface zal communiceren met jouw API, de parameters verzenden, de resultaten ophalen en deze op het scherm tonen: |
|||
|
|||
 |
|||
|
|||
### Alternatieve API documentatie upgrade |
|||
|
|||
Ga vervolgens naar <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>. |
|||
|
|||
* De alternatieve documentatie zal ook de nieuwe queryparameter en body weergeven: |
|||
|
|||
 |
|||
|
|||
### Samenvatting |
|||
|
|||
Samengevat declareer je **eenmalig** de types van parameters, body, etc. als functieparameters. |
|||
|
|||
Dat doe je met standaard moderne Python types. |
|||
|
|||
Je hoeft geen nieuwe syntax te leren, de methods of klassen van een specifieke bibliotheek, etc. |
|||
|
|||
Gewoon standaard **Python**. |
|||
|
|||
Bijvoorbeeld, voor een `int`: |
|||
|
|||
```Python |
|||
item_id: int |
|||
``` |
|||
|
|||
of voor een complexer `Item` model: |
|||
|
|||
```Python |
|||
item: Item |
|||
``` |
|||
|
|||
...en met die ene verklaring krijg je: |
|||
|
|||
* Editor ondersteuning, inclusief: |
|||
* Code aanvulling. |
|||
* Type validatie. |
|||
* Validatie van data: |
|||
* Automatische en duidelijke foutboodschappen wanneer de data ongeldig is. |
|||
* Validatie zelfs voor diep geneste JSON objecten. |
|||
* <abbr title="ook bekend als: serialisatie, parsing, marshalling">Conversie</abbr> van invoergegevens: afkomstig van het netwerk naar Python-data en -types. Zoals: |
|||
* JSON. |
|||
* Pad parameters. |
|||
* Query parameters. |
|||
* Cookies. |
|||
* Headers. |
|||
* Formulieren. |
|||
* Bestanden. |
|||
* <abbr title="ook bekend als: serialisatie, parsing, marshalling">Conversie</abbr> van uitvoergegevens: converstie van Python-data en -types naar netwerkgegevens (zoals JSON): |
|||
* Converteer Python types (`str`, `int`, `float`, `bool`, `list`, etc). |
|||
* `datetime` objecten. |
|||
* `UUID` objecten. |
|||
* Database modellen. |
|||
* ...en nog veel meer. |
|||
* Automatische interactieve API-documentatie, inclusief 2 alternatieve gebruikersinterfaces: |
|||
* Swagger UI. |
|||
* ReDoc. |
|||
|
|||
--- |
|||
|
|||
Terugkomend op het vorige code voorbeeld, **FastAPI** zal: |
|||
|
|||
* Valideren dat er een `item_id` bestaat in het pad voor `GET` en `PUT` verzoeken. |
|||
* Valideren dat het `item_id` van het type `int` is voor `GET` en `PUT` verzoeken. |
|||
* Wanneer dat niet het geval is, krijgt de cliënt een nuttige, duidelijke foutmelding. |
|||
* Controleren of er een optionele query parameter is met de naam `q` (zoals in `http://127.0.0.1:8000/items/foo?q=somequery`) voor `GET` verzoeken. |
|||
* Aangezien de `q` parameter werd gedeclareerd met `= None`, is deze optioneel. |
|||
* Zonder de `None` declaratie zou deze verplicht zijn (net als bij de body in het geval met `PUT`). |
|||
* Voor `PUT` verzoeken naar `/items/{item_id}`, lees de body als JSON: |
|||
* Controleer of het een verplicht attribuut `naam` heeft en dat dat een `str` is. |
|||
* Controleer of het een verplicht attribuut `price` heeft en dat dat een`float` is. |
|||
* Controleer of het een optioneel attribuut `is_offer` heeft, dat een `bool` is wanneer het aanwezig is. |
|||
* Dit alles werkt ook voor diep geneste JSON objecten. |
|||
* Converteer automatisch van en naar JSON. |
|||
* Documenteer alles met OpenAPI, dat gebruikt kan worden door: |
|||
* Interactieve documentatiesystemen. |
|||
* Automatische client code generatie systemen, voor vele talen. |
|||
* Biedt 2 interactieve documentatie-webinterfaces aan. |
|||
|
|||
--- |
|||
|
|||
Dit was nog maar een snel overzicht, maar je zou nu toch al een idee moeten hebben over hoe het allemaal werkt. |
|||
|
|||
Probeer deze regel te veranderen: |
|||
|
|||
```Python |
|||
return {"item_name": item.name, "item_id": item_id} |
|||
``` |
|||
|
|||
...van: |
|||
|
|||
```Python |
|||
... "item_name": item.name ... |
|||
``` |
|||
|
|||
...naar: |
|||
|
|||
```Python |
|||
... "item_price": item.price ... |
|||
``` |
|||
|
|||
...en zie hoe je editor de attributen automatisch invult en hun types herkent: |
|||
|
|||
 |
|||
|
|||
Voor een vollediger voorbeeld met meer mogelijkheden, zie de <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - Gebruikershandleiding</a>. |
|||
|
|||
**Spoiler alert**: de tutorial - gebruikershandleiding bevat: |
|||
|
|||
* Declaratie van **parameters** op andere plaatsen zoals: **headers**, **cookies**, **formuliervelden** en **bestanden**. |
|||
* Hoe stel je **validatie restricties** in zoals `maximum_length` of een `regex`. |
|||
* Een zeer krachtig en eenvoudig te gebruiken **<abbr title="ook bekend als componenten, middelen, verstrekkers, diensten, injectables">Dependency Injection</abbr>** systeem. |
|||
* Beveiliging en authenticatie, inclusief ondersteuning voor **OAuth2** met **JWT-tokens** en **HTTP Basic** auth. |
|||
* Meer geavanceerde (maar even eenvoudige) technieken voor het declareren van **diep geneste JSON modellen** (dankzij Pydantic). |
|||
* **GraphQL** integratie met <a href="https://strawberry.rocks" class="external-link" target="_blank">Strawberry</a> en andere packages. |
|||
* Veel extra functies (dankzij Starlette) zoals: |
|||
* **WebSockets** |
|||
* uiterst gemakkelijke tests gebaseerd op HTTPX en `pytest` |
|||
* **CORS** |
|||
* **Cookie Sessions** |
|||
* ...en meer. |
|||
|
|||
## Prestaties |
|||
|
|||
Onafhankelijke TechEmpower benchmarks tonen **FastAPI** applicaties draaiend onder Uvicorn aan als <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">een van de snelste Python frameworks beschikbaar</a>, alleen onder Starlette en Uvicorn zelf (intern gebruikt door FastAPI). (*) |
|||
|
|||
Zie de sectie <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a> om hier meer over te lezen. |
|||
|
|||
## Afhankelijkheden |
|||
|
|||
FastAPI maakt gebruik van Pydantic en Starlette. |
|||
|
|||
### `standard` Afhankelijkheden |
|||
|
|||
Wanneer je FastAPI installeert met `pip install "fastapi[standard]"`, worden de volgende `standard` optionele afhankelijkheden geïnstalleerd: |
|||
|
|||
Gebruikt door Pydantic: |
|||
|
|||
* <a href="https://github.com/JoshData/python-email-validator" target="_blank"><code>email_validator</code></a> - voor email validatie. |
|||
|
|||
Gebruikt door Starlette: |
|||
|
|||
* <a href="https://www.python-httpx.org" target="_blank"><code>httpx</code></a> - Vereist indien je de `TestClient` wil gebruiken. |
|||
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Vereist als je de standaard templateconfiguratie wil gebruiken. |
|||
* <a href="https://github.com/Kludex/python-multipart" target="_blank"><code>python-multipart</code></a> - Vereist indien je <abbr title="het omzetten van de string die uit een HTTP verzoek komt in Python data">"parsen"</abbr> van formulieren wil ondersteunen met `requests.form()`. |
|||
|
|||
Gebruikt door FastAPI / Starlette: |
|||
|
|||
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - voor de server die jouw applicatie laadt en bedient. |
|||
* `fastapi-cli` - om het `fastapi` commando te voorzien. |
|||
|
|||
### Zonder `standard` Afhankelijkheden |
|||
|
|||
Indien je de optionele `standard` afhankelijkheden niet wenst te installeren, kan je installeren met `pip install fastapi` in plaats van `pip install "fastapi[standard]"`. |
|||
|
|||
### Bijkomende Optionele Afhankelijkheden |
|||
|
|||
Er zijn nog een aantal bijkomende afhankelijkheden die je eventueel kan installeren. |
|||
|
|||
Bijkomende optionele afhankelijkheden voor Pydantic: |
|||
|
|||
* <a href="https://docs.pydantic.dev/latest/usage/pydantic_settings/" target="_blank"><code>pydantic-settings</code></a> - voor het beheren van settings. |
|||
* <a href="https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/" target="_blank"><code>pydantic-extra-types</code></a> - voor extra data types die gebruikt kunnen worden met Pydantic. |
|||
|
|||
Bijkomende optionele afhankelijkheden voor FastAPI: |
|||
|
|||
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Vereist indien je `ORJSONResponse` wil gebruiken. |
|||
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Vereist indien je `UJSONResponse` wil gebruiken. |
|||
|
|||
## Licentie |
|||
|
|||
Dit project is gelicenseerd onder de voorwaarden van de MIT licentie. |
@ -0,0 +1 @@ |
|||
INHERIT: ../en/mkdocs.yml |
@ -1,178 +0,0 @@ |
|||
# Ludzie FastAPI |
|||
|
|||
FastAPI posiada wspaniałą społeczność, która jest otwarta dla ludzi z każdego środowiska. |
|||
|
|||
## Twórca - Opienik |
|||
|
|||
Cześć! 👋 |
|||
|
|||
To ja: |
|||
|
|||
{% 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">Liczba odpowiedzi: {{ user.answers }}</div><div class="count">Pull Requesty: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Jestem twórcą i opiekunem **FastAPI**. Możesz przeczytać więcej na ten temat w [Pomoc FastAPI - Uzyskaj pomoc - Skontaktuj się z autorem](help-fastapi.md#connect-with-the-author){.internal-link target=_blank}. |
|||
|
|||
...Ale tutaj chcę pokazać Ci społeczność. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** otrzymuje wiele wsparcia od społeczności. Chciałbym podkreślić ich wkład. |
|||
|
|||
To są ludzie, którzy: |
|||
|
|||
* [Pomagają innym z pytaniami na GitHub](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}. |
|||
* [Tworzą Pull Requesty](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
* Oceniają Pull Requesty, [to szczególnie ważne dla tłumaczeń](contributing.md#translations){.internal-link target=_blank}. |
|||
|
|||
Proszę o brawa dla nich. 👏 🙇 |
|||
|
|||
## Najaktywniejsi użytkownicy w zeszłym miesiącu |
|||
|
|||
Oto niektórzy użytkownicy, którzy [pomagali innym w największej liczbie pytań na GitHubie](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} podczas ostatniego miesiąca. ☕ |
|||
|
|||
{% 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">Udzielonych odpowiedzi: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Eksperci |
|||
|
|||
Oto **eksperci FastAPI**. 🤓 |
|||
|
|||
To użytkownicy, którzy [pomogli innym z największa liczbą pytań na GitHubie](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} od *samego początku*. |
|||
|
|||
Poprzez pomoc wielu innym, udowodnili, że są ekspertami. ✨ |
|||
|
|||
{% 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">Udzielonych odpowiedzi: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Najlepsi Kontrybutorzy |
|||
|
|||
Oto **Najlepsi Kontrybutorzy**. 👷 |
|||
|
|||
Ci użytkownicy [stworzyli najwięcej Pull Requestów](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}, które zostały *wcalone*. |
|||
|
|||
Współtworzyli kod źródłowy, dokumentację, tłumaczenia itp. 📦 |
|||
|
|||
{% 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 Requesty: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Jest wielu więcej kontrybutorów (ponad setka), możesz zobaczyć ich wszystkich na stronie <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">Kontrybutorzy FastAPI na GitHub</a>. 👷 |
|||
|
|||
## Najlepsi Oceniajacy |
|||
|
|||
Ci uzytkownicy są **Najlepszymi oceniającymi**. 🕵️ |
|||
|
|||
### Oceny Tłumaczeń |
|||
|
|||
Ja mówię tylko kilkoma językami (i to niezbyt dobrze 😅). Zatem oceniający są tymi, którzy mają [**moc zatwierdzania tłumaczeń**](contributing.md#translations){.internal-link target=_blank} dokumentacji. Bez nich nie byłoby dokumentacji w kilku innych językach. |
|||
|
|||
--- |
|||
|
|||
**Najlepsi Oceniający** 🕵️ przejrzeli więcej Pull Requestów, niż inni, zapewniając jakość kodu, dokumentacji, a zwłaszcza **tłumaczeń**. |
|||
|
|||
{% 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">Liczba ocen: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsorzy |
|||
|
|||
Oto **Sponsorzy**. 😎 |
|||
|
|||
Wspierają moją pracę nad **FastAPI** (i innymi), głównie poprzez <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Złoci Sponsorzy |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Srebrni Sponsorzy |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Brązowi Sponsorzy |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Indywidualni Sponsorzy |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## Techniczne szczegóły danych |
|||
|
|||
Głównym celem tej strony jest podkreślenie wysiłku społeczności w pomaganiu innym. |
|||
|
|||
Szczególnie włączając wysiłki, które są zwykle mniej widoczne, a w wielu przypadkach bardziej żmudne, tak jak pomaganie innym z pytaniami i ocenianie Pull Requestów z tłumaczeniami. |
|||
|
|||
Dane są obliczane każdego miesiąca, możesz przeczytać <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">kod źródłowy tutaj</a>. |
|||
|
|||
Tutaj również podkreślam wkład od sponsorów. |
|||
|
|||
Zastrzegam sobie prawo do aktualizacji algorytmu, sekcji, progów itp. (na wszelki wypadek 🤷). |
@ -0,0 +1,19 @@ |
|||
# Segurança Avançada |
|||
|
|||
## Funcionalidades Adicionais |
|||
|
|||
Existem algumas funcionalidades adicionais para lidar com segurança além das cobertas em [Tutorial - Guia de Usuário: Segurança](../../tutorial/security/index.md){.internal-link target=_blank}. |
|||
|
|||
/// tip | "Dica" |
|||
|
|||
As próximas seções **não são necessariamente "avançadas"**. |
|||
|
|||
E é possível que para o seu caso de uso, a solução está em uma delas. |
|||
|
|||
/// |
|||
|
|||
## Leia o Tutorial primeiro |
|||
|
|||
As próximas seções pressupõem que você já leu o principal [Tutorial - Guia de Usuário: Segurança](../../tutorial/security/index.md){.internal-link target=_blank}. |
|||
|
|||
Todas elas são baseadas nos mesmos conceitos, mas permitem algumas funcionalidades extras. |
@ -0,0 +1,7 @@ |
|||
# Testando Eventos: inicialização - encerramento |
|||
|
|||
Quando você precisa que os seus manipuladores de eventos (`startup` e `shutdown`) sejam executados em seus testes, você pode utilizar o `TestClient` usando a instrução `with`: |
|||
|
|||
```Python hl_lines="9-12 20-24" |
|||
{!../../../docs_src/app_testing/tutorial003.py!} |
|||
``` |
@ -1,183 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# Pessoas do FastAPI |
|||
|
|||
FastAPI possue uma comunidade incrível que recebe pessoas de todos os níveis. |
|||
|
|||
## Criador - Mantenedor |
|||
|
|||
Ei! 👋 |
|||
|
|||
Este sou eu: |
|||
|
|||
{% 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">Respostas: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Eu sou o criador e mantenedor do **FastAPI**. Você pode ler mais sobre isso em [Help FastAPI - Get Help - Connect with the author](help-fastapi.md#conect-se-com-o-autor){.internal-link target=_blank}. |
|||
|
|||
...Mas aqui eu quero mostrar a você a comunidade. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** recebe muito suporte da comunidade. E quero destacar suas contribuições. |
|||
|
|||
Estas são as pessoas que: |
|||
|
|||
* [Help others with issues (questions) in GitHub](help-fastapi.md#responda-perguntas-no-github){.internal-link target=_blank}. |
|||
* [Create Pull Requests](help-fastapi.md#crie-um-pull-request){.internal-link target=_blank}. |
|||
* Revisar Pull Requests, [especially important for translations](contributing.md#traducoes){.internal-link target=_blank}. |
|||
|
|||
Uma salva de palmas para eles. 👏 🙇 |
|||
|
|||
## Usuários mais ativos do ultimo mês |
|||
|
|||
Estes são os usuários que estão [helping others the most with issues (questions) in GitHub](help-fastapi.md#responda-perguntas-no-github){.internal-link target=_blank} durante o ultimo mês. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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 respondidas: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Especialistas |
|||
|
|||
Aqui está os **Especialistas do FastAPI**. 🤓 |
|||
|
|||
|
|||
Estes são os usuários que [helped others the most with issues (questions) in GitHub](help-fastapi.md#responda-perguntas-no-github){.internal-link target=_blank} em *todo o tempo*. |
|||
|
|||
Eles provaram ser especialistas ajudando muitos outros. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Issues respondidas: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Top Contribuidores |
|||
|
|||
Aqui está os **Top Contribuidores**. 👷 |
|||
|
|||
Esses usuários têm [created the most Pull Requests](help-fastapi.md#crie-um-pull-request){.internal-link target=_blank} que tem sido *mergeado*. |
|||
|
|||
Eles contribuíram com o código-fonte, documentação, traduções, etc. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Existem muitos outros contribuidores (mais de uma centena), você pode ver todos eles em <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">Página de Contribuidores do FastAPI no GitHub</a>. 👷 |
|||
|
|||
## Top Revisores |
|||
|
|||
Esses usuários são os **Top Revisores**. 🕵️ |
|||
|
|||
### Revisões para Traduções |
|||
|
|||
Eu só falo algumas línguas (e não muito bem 😅). Então, os revisores são aqueles que têm o [**poder de aprovar traduções**](contributing.md#traducoes){.internal-link target=_blank} da documentação. Sem eles, não haveria documentação em vários outros idiomas. |
|||
|
|||
--- |
|||
|
|||
Os **Top Revisores** 🕵️ revisaram a maior parte de Pull Requests de outros, garantindo a qualidade do código, documentação, e especialmente, as **traduções**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Revisões: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Patrocinadores |
|||
|
|||
Esses são os **Patrocinadores**. 😎 |
|||
|
|||
Eles estão apoiando meu trabalho **FastAPI** (e outros), principalmente através de <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>. |
|||
|
|||
{% if sponsors %} |
|||
{% if sponsors.gold %} |
|||
|
|||
### Patrocinadores Ouro |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Patrocinadores Prata |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Patrocinadores Bronze |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
### Patrocinadores Individuais |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
## Sobre os dados - detalhes técnicos |
|||
|
|||
A principal intenção desta página é destacar o esforço da comunidade para ajudar os outros. |
|||
|
|||
Especialmente incluindo esforços que normalmente são menos visíveis, e em muitos casos mais árduo, como ajudar os outros com issues e revisando Pull Requests com traduções. |
|||
|
|||
Os dados são calculados todo mês, você pode ler o <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">código fonte aqui</a>. |
|||
|
|||
Aqui também estou destacando contribuições de patrocinadores. |
|||
|
|||
Eu também me reservo o direito de atualizar o algoritmo, seções, limites, etc (só para prevenir 🤷). |
@ -0,0 +1,418 @@ |
|||
# Arquivos de Requisição |
|||
|
|||
Você pode definir arquivos para serem enviados para o cliente utilizando `File`. |
|||
|
|||
/// info |
|||
|
|||
Para receber arquivos compartilhados, primeiro instale <a href="https://github.com/Kludex/python-multipart" class="external-link" target="_blank">`python-multipart`</a>. |
|||
|
|||
E.g. `pip install python-multipart`. |
|||
|
|||
Isso se deve por que arquivos enviados são enviados como "dados de formulário". |
|||
|
|||
/// |
|||
|
|||
## Importe `File` |
|||
|
|||
Importe `File` e `UploadFile` do `fastapi`: |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="3" |
|||
{!> ../../../docs_src/request_files/tutorial001_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="1" |
|||
{!> ../../../docs_src/request_files/tutorial001_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível. |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="1" |
|||
{!> ../../../docs_src/request_files/tutorial001.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
## Defina os parâmetros de `File` |
|||
|
|||
Cria os parâmetros do arquivo da mesma forma que você faria para `Body` ou `Form`: |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="9" |
|||
{!> ../../../docs_src/request_files/tutorial001_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="8" |
|||
{!> ../../../docs_src/request_files/tutorial001_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível. |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="7" |
|||
{!> ../../../docs_src/request_files/tutorial001.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
/// info | Informação |
|||
|
|||
`File` é uma classe que herda diretamente de `Form`. |
|||
|
|||
Mas lembre-se que quando você importa `Query`,`Path`, `File`, entre outros, do `fastapi`, essas são na verdade funções que retornam classes especiais. |
|||
|
|||
/// |
|||
|
|||
/// tip | Dica |
|||
|
|||
Para declarar o corpo de arquivos, você precisa utilizar `File`, do contrário os parâmetros seriam interpretados como parâmetros de consulta ou corpo (JSON) da requisição. |
|||
|
|||
/// |
|||
|
|||
Os arquivos serão enviados como "form data". |
|||
|
|||
Se você declarar o tipo do seu parâmetro na sua *função de operação de rota* como `bytes`, o **FastAPI** irá ler o arquivo para você e você receberá o conteúdo como `bytes`. |
|||
|
|||
Lembre-se que isso significa que o conteúdo inteiro será armazenado em memória. Isso funciona bem para arquivos pequenos. |
|||
|
|||
Mas existem vários casos em que você pode se beneficiar ao usar `UploadFile`. |
|||
|
|||
## Parâmetros de arquivo com `UploadFile` |
|||
|
|||
Defina um parâmetro de arquivo com o tipo `UploadFile` |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="14" |
|||
{!> ../../../docs_src/request_files/tutorial001_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="13" |
|||
{!> ../../../docs_src/request_files/tutorial001_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível. |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="12" |
|||
{!> ../../../docs_src/request_files/tutorial001.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
Utilizando `UploadFile` tem várias vantagens sobre `bytes`: |
|||
|
|||
* Você não precisa utilizar `File()` como o valor padrão do parâmetro. |
|||
* A classe utiliza um arquivo em "spool": |
|||
* Um arquivo guardado em memória até um tamanho máximo, depois desse limite ele é guardado em disco. |
|||
* Isso significa que a classe funciona bem com arquivos grandes como imagens, vídeos, binários extensos, etc. Sem consumir toda a memória. |
|||
* Você pode obter metadados do arquivo enviado. |
|||
* Ela possui uma interface <a href="https://docs.python.org/3/glossary.html#term-file-like-object" class="external-link" target="_blank">semelhante a arquivos</a> `async`. |
|||
* Ela expõe um objeto python <a href="https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile" class="external-link" target="_blank">`SpooledTemporaryFile`</a> que você pode repassar para bibliotecas que esperam um objeto com comportamento de arquivo. |
|||
|
|||
### `UploadFile` |
|||
|
|||
`UploadFile` tem os seguintes atributos: |
|||
|
|||
* `filename`: Uma string (`str`) com o nome original do arquivo enviado (e.g. `myimage.jpg`). |
|||
* `content-type`: Uma `str` com o tipo do conteúdo (tipo MIME / media) (e.g. `image/jpeg`). |
|||
* `file`: Um objeto do tipo <a href="https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile" class="external-link" target="_blank">`SpooledTemporaryFile`</a> (um objeto <a href="https://docs.python.org/3/glossary.html#term-file-like-object" class="external-link" target="_blank">file-like</a>). O arquivo propriamente dito que você pode passar diretamente para outras funções ou bibliotecas que esperam um objeto "file-like". |
|||
|
|||
`UploadFile` tem os seguintes métodos `async`. Todos eles chamam os métodos de arquivos por baixo dos panos (usando o objeto `SpooledTemporaryFile` interno). |
|||
|
|||
* `write(data)`: escreve dados (`data`) em `str` ou `bytes` no arquivo. |
|||
* `read(size)`: Lê um número de bytes/caracteres de acordo com a quantidade `size` (`int`). |
|||
* `seek(offset)`: Navega para o byte na posição `offset` (`int`) do arquivo. |
|||
* E.g., `await myfile.seek(0)` navegaria para o ínicio do arquivo. |
|||
* Isso é especialmente útil se você executar `await myfile.read()` uma vez e depois precisar ler os conteúdos do arquivo de novo. |
|||
* `close()`: Fecha o arquivo. |
|||
|
|||
Como todos esses métodos são assíncronos (`async`) você precisa esperar ("await") por eles. |
|||
|
|||
Por exemplo, dentro de uma *função de operação de rota* assíncrona você pode obter os conteúdos com: |
|||
|
|||
```Python |
|||
contents = await myfile.read() |
|||
``` |
|||
|
|||
Se você estiver dentro de uma *função de operação de rota* definida normalmente com `def`, você pode acessar `UploadFile.file` diretamente, por exemplo: |
|||
|
|||
```Python |
|||
contents = myfile.file.read() |
|||
``` |
|||
|
|||
/// note | Detalhes técnicos do `async` |
|||
|
|||
Quando você utiliza métodos assíncronos, o **FastAPI** executa os métodos do arquivo em uma threadpool e espera por eles. |
|||
|
|||
/// |
|||
|
|||
/// note | Detalhes técnicos do Starlette |
|||
|
|||
O `UploadFile` do **FastAPI** herda diretamente do `UploadFile` do **Starlette**, mas adiciona algumas funcionalidades necessárias para ser compatível com o **Pydantic** |
|||
|
|||
/// |
|||
|
|||
## O que é "Form Data" |
|||
|
|||
A forma como formulários HTML(`<form></form>`) enviam dados para o servidor normalmente utilizam uma codificação "especial" para esses dados, que é diferente do JSON. |
|||
|
|||
O **FastAPI** garante que os dados serão lidos da forma correta, em vez do JSON. |
|||
|
|||
/// note | Detalhes Técnicos |
|||
|
|||
Dados vindos de formulários geralmente tem a codificação com o "media type" `application/x-www-form-urlencoded` quando estes não incluem arquivos. |
|||
|
|||
Mas quando os dados incluem arquivos, eles são codificados como `multipart/form-data`. Se você utilizar `File`, **FastAPI** saberá que deve receber os arquivos da parte correta do corpo da requisição. |
|||
|
|||
Se você quer ler mais sobre essas codificações e campos de formulário, veja a documentação online da <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST" class="external-link" target="_blank"><abbr title="Mozilla Developer Network">MDN</abbr> sobre <code> POST</code> </a>. |
|||
|
|||
/// |
|||
|
|||
/// warning | Aviso |
|||
|
|||
Você pode declarar múltiplos parâmetros `File` e `Form` em uma *operação de rota*, mas você não pode declarar campos `Body`que seriam recebidos como JSON junto desses parâmetros, por que a codificação do corpo da requisição será `multipart/form-data` em vez de `application/json`. |
|||
|
|||
Isso não é uma limitação do **FastAPI**, é uma parte do protocolo HTTP. |
|||
|
|||
/// |
|||
|
|||
## Arquivo de upload opcional |
|||
|
|||
Você pode definir um arquivo como opcional utilizando as anotações de tipo padrão e definindo o valor padrão como `None`: |
|||
|
|||
//// tab | Python 3.10+ |
|||
|
|||
```Python hl_lines="9 17" |
|||
{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="9 17" |
|||
{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="10 18" |
|||
{!> ../../../docs_src/request_files/tutorial001_02_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.10+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated`, se possível |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="7 15" |
|||
{!> ../../../docs_src/request_files/tutorial001_02_py310.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated`, se possível |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="9 17" |
|||
{!> ../../../docs_src/request_files/tutorial001_02.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
## `UploadFile` com Metadados Adicionais |
|||
|
|||
Você também pode utilizar `File()` com `UploadFile`, por exemplo, para definir metadados adicionais: |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="9 15" |
|||
{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="8 14" |
|||
{!> ../../../docs_src/request_files/tutorial001_03_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="7 13" |
|||
{!> ../../../docs_src/request_files/tutorial001_03.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
## Envio de Múltiplos Arquivos |
|||
|
|||
É possível enviar múltiplos arquivos ao mesmo tmepo. |
|||
|
|||
Ele ficam associados ao mesmo "campo do formulário" enviado com "form data". |
|||
|
|||
Para usar isso, declare uma lista de `bytes` ou `UploadFile`: |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="10 15" |
|||
{!> ../../../docs_src/request_files/tutorial002_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="11 16" |
|||
{!> ../../../docs_src/request_files/tutorial002_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.9+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="8 13" |
|||
{!> ../../../docs_src/request_files/tutorial002_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="10 15" |
|||
{!> ../../../docs_src/request_files/tutorial002.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
Você irá receber, como delcarado uma lista (`list`) de `bytes` ou `UploadFile`s, |
|||
|
|||
/// note | Detalhes Técnicos |
|||
|
|||
Você também poderia utilizar `from starlette.responses import HTMLResponse`. |
|||
|
|||
O **FastAPI** fornece as mesmas `starlette.responses` como `fastapi.responses` apenas como um facilitador para você, desenvolvedor. Mas a maior parte das respostas vem diretamente do Starlette. |
|||
|
|||
/// |
|||
|
|||
### Enviando Múltiplos Arquivos com Metadados Adicionais |
|||
|
|||
E da mesma forma que antes, você pode utilizar `File()` para definir parâmetros adicionais, até mesmo para `UploadFile`: |
|||
|
|||
//// tab | Python 3.9+ |
|||
|
|||
```Python hl_lines="11 18-20" |
|||
{!> ../../../docs_src/request_files/tutorial003_an_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ |
|||
|
|||
```Python hl_lines="12 19-21" |
|||
{!> ../../../docs_src/request_files/tutorial003_an.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.9+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível. |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="9 16" |
|||
{!> ../../../docs_src/request_files/tutorial003_py39.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
//// tab | Python 3.8+ non-Annotated |
|||
|
|||
/// tip | Dica |
|||
|
|||
Utilize a versão com `Annotated` se possível. |
|||
|
|||
/// |
|||
|
|||
```Python hl_lines="11 18" |
|||
{!> ../../../docs_src/request_files/tutorial003.py!} |
|||
``` |
|||
|
|||
//// |
|||
|
|||
## Recapitulando |
|||
|
|||
Use `File`, `bytes` e `UploadFile` para declarar arquivos que serão enviados na requisição, enviados como dados do formulário. |
@ -1,184 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# Люди, поддерживающие FastAPI |
|||
|
|||
У FastAPI замечательное сообщество, которое доброжелательно к людям с любым уровнем знаний. |
|||
|
|||
## Создатель и хранитель |
|||
|
|||
Хай! 👋 |
|||
|
|||
Это я: |
|||
|
|||
{% 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 %} |
|||
|
|||
Я создал и продолжаю поддерживать **FastAPI**. Узнать обо мне больше можно тут [Помочь FastAPI - Получить помощь - Связаться с автором](help-fastapi.md#_2){.internal-link target=_blank}. |
|||
|
|||
... но на этой странице я хочу показать вам наше сообщество. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** получает огромную поддержку от своего сообщества. И я хочу отметить вклад его участников. |
|||
|
|||
Это люди, которые: |
|||
|
|||
* [Помогают другим с их проблемами (вопросами) на GitHub](help-fastapi.md#github_1){.internal-link target=_blank}. |
|||
* [Создают пул-реквесты](help-fastapi.md#-_1){.internal-link target=_blank}. |
|||
* Делают ревью пул-реквестов, [что особенно важно для переводов на другие языки](contributing.md#_8){.internal-link target=_blank}. |
|||
|
|||
Поаплодируем им! 👏 🙇 |
|||
|
|||
## Самые активные участники за прошедший месяц |
|||
|
|||
Эти участники [оказали наибольшую помощь другим с решением их проблем (вопросов) на GitHub](help-fastapi.md#github_1){.internal-link target=_blank} в течение последнего месяца. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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 %} |
|||
|
|||
## Эксперты |
|||
|
|||
Здесь представлены **Эксперты FastAPI**. 🤓 |
|||
|
|||
Эти участники [оказали наибольшую помощь другим с решением их проблем (вопросов) на GitHub](help-fastapi.md#github_1){.internal-link target=_blank} за *всё время*. |
|||
|
|||
Оказывая помощь многим другим, они подтвердили свой уровень знаний. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Issues replied: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Рейтинг участников, внёсших вклад в код |
|||
|
|||
Здесь представлен **Рейтинг участников, внёсших вклад в код**. 👷 |
|||
|
|||
Эти люди [сделали наибольшее количество пул-реквестов](help-fastapi.md#-_1){.internal-link target=_blank}, *включённых в основной код*. |
|||
|
|||
Они сделали наибольший вклад в исходный код, документацию, переводы и т.п. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
На самом деле таких людей довольно много (более сотни), вы можете увидеть всех на этой странице <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors page</a>. 👷 |
|||
|
|||
## Рейтинг ревьюеров |
|||
|
|||
Здесь представлен **Рейтинг ревьюеров**. 🕵️ |
|||
|
|||
### Проверки переводов на другие языки |
|||
|
|||
Я знаю не очень много языков (и не очень хорошо 😅). |
|||
Итак, ревьюеры - это люди, которые могут [**подтвердить предложенный вами перевод** документации](contributing.md#_8){.internal-link target=_blank}. Без них не было бы документации на многих языках. |
|||
|
|||
--- |
|||
|
|||
В **Рейтинге ревьюеров** 🕵️ представлены те, кто проверил наибольшее количество пул-реквестов других участников, обеспечивая качество кода, документации и, особенно, **переводов на другие языки**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Reviews: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Спонсоры |
|||
|
|||
Здесь представлены **Спонсоры**. 😎 |
|||
|
|||
Спонсоры поддерживают мою работу над **FastAPI** (и другими проектами) главным образом через <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Золотые спонсоры |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Серебрянные спонсоры |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Бронзовые спонсоры |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Индивидуальные спонсоры |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## О данных - технические детали |
|||
|
|||
Основная цель этой страницы - подчеркнуть усилия сообщества по оказанию помощи другим. |
|||
|
|||
Особенно это касается усилий, которые обычно менее заметны и во многих случаях более трудоемки, таких как помощь другим в решении проблем и проверка пул-реквестов с переводами. |
|||
|
|||
Данные рейтинги подсчитываются каждый месяц, ознакомиться с тем, как это работает можно <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">тут</a>. |
|||
|
|||
Кроме того, я также подчеркиваю вклад спонсоров. |
|||
|
|||
И я оставляю за собой право обновлять алгоритмы подсчёта, виды рейтингов, пороговые значения и т.д. (так, на всякий случай 🤷). |
@ -1,183 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI Topluluğu |
|||
|
|||
FastAPI, her kökenden insanı ağırlayan harika bir topluluğa sahip. |
|||
|
|||
## Yazan - Geliştiren |
|||
|
|||
Merhaba! 👋 |
|||
|
|||
İşte bu benim: |
|||
|
|||
{% 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">Cevaplar: {{ user.answers }}</div><div class="count">Pull Request'ler: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Ben **FastAPI**'ın geliştiricisiyim. Bununla ilgili daha fazla bilgiyi şurada okuyabilirsiniz: [FastAPI yardım - yardım al - benimle iletişime geç](help-fastapi.md#connect-with-the-author){.internal-link target=_blank}. |
|||
|
|||
...burada size harika FastAPI topluluğunu göstermek istiyorum. |
|||
|
|||
--- |
|||
|
|||
**FastAPI**, topluluğundan çok destek alıyor. Ben de onların katkılarını vurgulamak istiyorum. |
|||
|
|||
Bu insanlar: |
|||
|
|||
* [GitHubdaki soruları cevaplayarak diğerlerine yardım ediyor](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}. |
|||
* [Pull Request'ler oluşturuyor](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
* Pull Request'leri gözden geçiriyorlar, [özellikle çeviriler için bu çok önemli](contributing.md#translations){.internal-link target=_blank}. |
|||
|
|||
Onları bir alkışlayalım. 👏 🙇 |
|||
|
|||
## Geçen Ayın En Aktif Kullanıcıları |
|||
|
|||
Geçtiğimiz ay boyunca [GitHub'da diğerlerine en çok yardımcı olan](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} kullanıcılar. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">Cevaplanan soru sayısı: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Uzmanlar |
|||
|
|||
İşte **FastAPI Uzmanları**. 🤓 |
|||
|
|||
Uzmanlarımız ise *tüm zamanlar boyunca* [GitHub'da insanların sorularına en çok yardımcı olan](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} insanlar. |
|||
|
|||
Bir çok kullanıcıya yardım ederek uzman olduklarını kanıtladılar! ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Cevaplanan soru sayısı: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## En Fazla Katkıda Bulunanlar |
|||
|
|||
Şimdi ise sıra **en fazla katkıda bulunanlar**da. 👷 |
|||
|
|||
Bu kullanıcılar en fazla [kaynak koduyla birleştirilen Pull Request'lere](help-fastapi.md#create-a-pull-request){.internal-link target=_blank} sahip! |
|||
|
|||
Kaynak koduna, dökümantasyona, çevirilere ve bir sürü şeye katkıda bulundular. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Request sayısı: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Bunlar dışında katkıda bulunan, yüzden fazla, bir sürü insan var. Hepsini <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Katkıda Bulunanlar</a> sayfasında görebilirsin. 👷 |
|||
|
|||
## En Fazla Değerlendirme Yapanlar |
|||
|
|||
İşte **en çok değerlendirme yapanlar**. 🕵️ |
|||
|
|||
### Çeviri Değerlendirmeleri |
|||
|
|||
Yalnızca birkaç dil konuşabiliyorum (ve çok da iyi değilim 😅). Bu yüzden değerlendirme yapanların da döküman çevirilerini [**onaylama yetkisi**](contributing.md#translations){.internal-link target=_blank} var. Onlar olmasaydı çeşitli dillerde dökümantasyon da olmazdı. |
|||
|
|||
--- |
|||
|
|||
**En fazla değerlendirme yapanlar** 🕵️ kodun, dökümantasyonun ve özellikle **çevirilerin** Pull Request'lerini inceleyerek kalitesinden emin oldular. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Değerlendirme sayısı: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsorlar |
|||
|
|||
işte **Sponsorlarımız**. 😎 |
|||
|
|||
Çoğunlukla <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsorları</a> aracılığıyla olmak üzere, **FastAPI** ve diğer projelerdeki çalışmalarımı destekliyorlar. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Altın Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Gümüş Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Bronz Sponsorlar |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Bireysel Sponsorlar |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## Veriler - Teknik detaylar |
|||
|
|||
Bu sayfanın temel amacı, topluluğun başkalarına yardım etme çabasını vurgulamaktır. |
|||
|
|||
Özellikle normalde daha az görünür olan ve çoğu durumda daha zahmetli olan, diğerlerine sorularında yardımcı olmak, çevirileri ve Pull Request'leri gözden geçirmek gibi çabalar dahil. |
|||
|
|||
Veriler ayda bir hesaplanır, <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">kaynak kodu buradan</a> okuyabilirsin. |
|||
|
|||
Burada sponsorların katkılarını da vurguluyorum. |
|||
|
|||
Ayrıca algoritmayı, bölümleri, eşikleri vb. güncelleme hakkımı da saklı tutuyorum (her ihtimale karşı 🤷). |
@ -1,183 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# Люди FastAPI |
|||
|
|||
FastAPI має дивовижну спільноту, яка вітає людей різного походження. |
|||
|
|||
## Творець – Супроводжувач |
|||
|
|||
Привіт! 👋 |
|||
|
|||
Це я: |
|||
|
|||
{% 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 %} |
|||
|
|||
Я - творець і супроводжувач **FastAPI**. Детальніше про це можна прочитати в [Довідка FastAPI - Отримати довідку - Зв'язатися з автором](help-fastapi.md#connect-with-the-author){.internal-link target=_blank}. |
|||
|
|||
...Але тут я хочу показати вам спільноту. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** отримує велику підтримку від спільноти. І я хочу відзначити їхній внесок. |
|||
|
|||
Це люди, які: |
|||
|
|||
* [Допомагають іншим із проблемами (запитаннями) у GitHub](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}. |
|||
* [Створюють пул реквести](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
* Переглядають пул реквести, [особливо важливо для перекладів](contributing.md#translations){.internal-link target=_blank}. |
|||
|
|||
Оплески їм. 👏 🙇 |
|||
|
|||
## Найбільш активні користувачі минулого місяця |
|||
|
|||
Це користувачі, які [найбільше допомагали іншим із проблемами (запитаннями) у GitHub](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} протягом минулого місяця. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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 %} |
|||
|
|||
## Експерти |
|||
|
|||
Ось **експерти FastAPI**. 🤓 |
|||
|
|||
Це користувачі, які [найбільше допомагали іншим із проблемами (запитаннями) у GitHub](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} протягом *всього часу*. |
|||
|
|||
Вони зарекомендували себе як експерти, допомагаючи багатьом іншим. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Issues replied: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Найкращі контрибютори |
|||
|
|||
Ось **Найкращі контрибютори**. 👷 |
|||
|
|||
Ці користувачі [створили найбільшу кількість пул реквестів](help-fastapi.md#create-a-pull-request){.internal-link target=_blank} які були *змержені*. |
|||
|
|||
Вони надали програмний код, документацію, переклади тощо. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Є багато інших контрибюторів (більше сотні), їх усіх можна побачити на сторінці <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors</a>. 👷 |
|||
|
|||
## Найкращі рецензенти |
|||
|
|||
Ці користувачі є **Найкращими рецензентами**. 🕵️ |
|||
|
|||
### Рецензенти на переклади |
|||
|
|||
Я розмовляю лише кількома мовами (і не дуже добре 😅). Отже, рецензенти – це ті, хто має [**повноваження схвалювати переклади**](contributing.md#translations){.internal-link target=_blank} документації. Без них не було б документації кількома іншими мовами. |
|||
|
|||
--- |
|||
|
|||
**Найкращі рецензенти** 🕵️ переглянули більшість пул реквестів від інших, забезпечуючи якість коду, документації і особливо **перекладів**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Reviews: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Спонсори |
|||
|
|||
Це **Спонсори**. 😎 |
|||
|
|||
Вони підтримують мою роботу з **FastAPI** (та іншими), переважно через <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Золоті спонсори |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Срібні спонсори |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Бронзові спонсори |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Індивідуальні спонсори |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## Про дані - технічні деталі |
|||
|
|||
Основна мета цієї сторінки – висвітлити зусилля спільноти, щоб допомогти іншим. |
|||
|
|||
Особливо враховуючи зусилля, які зазвичай менш помітні, а в багатьох випадках більш важкі, як-от допомога іншим із проблемами та перегляд пул реквестів перекладів. |
|||
|
|||
Дані розраховуються щомісяця, ви можете ознайомитися з <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">вихідним кодом тут</a>. |
|||
|
|||
Тут я також підкреслюю внески спонсорів. |
|||
|
|||
Я також залишаю за собою право оновлювати алгоритми підрахунку, види рейтингів, порогові значення тощо (про всяк випадок 🤷). |
@ -1,239 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI 社群 |
|||
|
|||
FastAPI 有一個非常棒的社群,歡迎來自不同背景的朋友參與。 |
|||
|
|||
## 作者 |
|||
|
|||
嘿! 👋 |
|||
|
|||
關於我: |
|||
|
|||
{% 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">解答問題: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
我是 **FastAPI** 的作者。你可以在[幫助 FastAPI - 獲得幫助 - 與作者聯繫](help-fastapi.md#connect-with-the-author){.internal-link target=_blank} 中閱讀更多相關資訊。 |
|||
|
|||
...但在這裡,我想向你介紹這個社群。 |
|||
|
|||
--- |
|||
|
|||
**FastAPI** 獲得了許多社群的大力支持。我想特別表揚他們的貢獻。 |
|||
|
|||
這些人包括: |
|||
|
|||
* [在 GitHub 中幫助他人解答問題](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}。 |
|||
* [建立 Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}。 |
|||
* 審查 Pull Requests,[尤其是翻譯方面的貢獻](contributing.md#translations){.internal-link target=_blank}。 |
|||
|
|||
讓我們為他們熱烈鼓掌。 👏 🙇 |
|||
|
|||
## FastAPI 專家 |
|||
|
|||
這些是在 [GitHub 中幫助其他人解決問題最多的用戶](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}。 🙇 |
|||
|
|||
他們透過幫助其他人,證明了自己是 **FastAPI 專家**。 ✨ |
|||
|
|||
/// 提示 |
|||
|
|||
你也可以成為官方的 FastAPI 專家! |
|||
|
|||
只需要在 [GitHub 中幫助他人解答問題](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}。 🤓 |
|||
|
|||
/// |
|||
|
|||
你可以查看這些期間的 **FastAPI 專家**: |
|||
|
|||
* [上個月](#fastapi-experts-last-month) 🤓 |
|||
* [過去 3 個月](#fastapi-experts-3-months) 😎 |
|||
* [過去 6 個月](#fastapi-experts-6-months) 🧐 |
|||
* [過去 1 年](#fastapi-experts-1-year) 🧑🔬 |
|||
* [**所有時間**](#fastapi-experts-all-time) 🧙 |
|||
|
|||
### FastAPI 專家 - 上個月 |
|||
|
|||
上個月在 [GitHub 中幫助他人解決問題最多的](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}用戶。 🤓 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">回答問題數: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 專家 - 過去 3 個月 |
|||
|
|||
過去三個月在 [GitHub 中幫助他人解決問題最多的](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}用戶。 😎 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.three_months_experts[:10] %} |
|||
|
|||
<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">回答問題數: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 專家 - 過去 6 個月 |
|||
|
|||
過去六個月在 [GitHub 中幫助他人解決問題最多的](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}用戶。 🧐 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.six_months_experts[:10] %} |
|||
|
|||
<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">回答問題數: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 專家 - 過去一年 |
|||
|
|||
過去一年在 [GitHub 中幫助他人解決最多問題的](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}用戶。 🧑🔬 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.one_year_experts[:20] %} |
|||
|
|||
<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">回答問題數: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 專家 - 全部時間 |
|||
|
|||
以下是全部時間的 **FastAPI 專家**。 🤓🤯 |
|||
|
|||
過去在 [GitHub 中幫助他人解決問題最多的](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}用戶。 🧙 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">回答問題數: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 主要貢獻者 |
|||
|
|||
以下是**主要貢獻者**。 👷 |
|||
|
|||
這些用戶[建立了最多已被**合併**的 Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}。 |
|||
|
|||
他們貢獻了原始碼、文件和翻譯等。 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
還有許多其他的貢獻者(超過一百位),你可以在 <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub 貢獻者頁面</a>查看。 👷 |
|||
|
|||
## 主要翻譯審核者 |
|||
|
|||
以下是 **主要翻譯審核者**。 🕵️ |
|||
|
|||
我只會講幾種語言(而且不是很流利 😅),所以審核者[**擁有批准翻譯**](contributing.md#translations){.internal-link target=_blank}文件的權限。沒有他們,就不會有多語言版本的文件。 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Reviews: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 贊助者 |
|||
|
|||
以下是**贊助者**。 😎 |
|||
|
|||
他們主要透過 <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a> 支持我在 **FastAPI**(以及其他項目)上的工作。 |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### 金牌贊助商 |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### 銀牌贊助商 |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### 銅牌贊助商 |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### 個人贊助商 |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## 關於數據 - 技術細節 |
|||
|
|||
這個頁面的主要目的是突顯社群幫助他人所做的努力 |
|||
|
|||
特別是那些通常不太顯眼但往往更加艱辛的工作,例如幫助他人解答問題和審查包含翻譯的 Pull Requests。 |
|||
|
|||
這些數據每月計算一次,你可以在這查看<a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">原始碼</a>。 |
|||
|
|||
此外,我也特別表揚贊助者的貢獻。 |
|||
|
|||
我也保留更新演算法、章節、門檻值等的權利(以防萬一 🤷)。 |
@ -1,239 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI 社区 |
|||
|
|||
FastAPI 有一个非常棒的社区,它欢迎来自各个领域和背景的朋友。 |
|||
|
|||
## 创建者 & 维护者 |
|||
|
|||
嘿! 👋 |
|||
|
|||
这就是我: |
|||
|
|||
{% 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 %} |
|||
|
|||
我是 **FastAPI** 的创建者和维护者. 你能在 [帮助 FastAPI - 获取帮助 - 与作者联系](help-fastapi.md#_2){.internal-link target=_blank} 阅读有关此内容的更多信息。 |
|||
|
|||
...但是在这里我想向您展示社区。 |
|||
|
|||
--- |
|||
|
|||
**FastAPI** 得到了社区的大力支持。因此我想突出他们的贡献。 |
|||
|
|||
这些人: |
|||
|
|||
* [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 |
|||
* [创建 Pull Requests](help-fastapi.md#pr){.internal-link target=_blank}。 |
|||
* 审核 Pull Requests, 对于 [翻译](contributing.md#_8){.internal-link target=_blank} 尤为重要。 |
|||
|
|||
向他们致以掌声。 👏 🙇 |
|||
|
|||
## FastAPI 专家 |
|||
|
|||
这些用户一直以来致力于 [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🙇 |
|||
|
|||
他们通过帮助许多人而被证明是 **FastAPI 专家**。 ✨ |
|||
|
|||
/// 小提示 |
|||
|
|||
你也可以成为认可的 FastAPI 专家! |
|||
|
|||
只需要 [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🤓 |
|||
|
|||
/// |
|||
|
|||
你可以查看不同时期的 **FastAPI 专家**: |
|||
|
|||
* [上个月](#fastapi-experts-last-month) 🤓 |
|||
* [三个月](#fastapi-experts-3-months) 😎 |
|||
* [六个月](#fastapi-experts-6-months) 🧐 |
|||
* [一年](#fastapi-experts-1-year) 🧑🔬 |
|||
* [**全部时间**](#fastapi-experts-all-time) 🧙 |
|||
|
|||
## FastAPI 专家 - 上个月 |
|||
|
|||
这些是在过去一个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🤓 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">回答问题数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 专家 - 三个月 |
|||
|
|||
这些是在过去三个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 😎 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.three_months_experts[:10] %} |
|||
|
|||
<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">回答问题数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 专家 - 六个月 |
|||
|
|||
这些是在过去六个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🧐 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.six_months_experts[:10] %} |
|||
|
|||
<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">回答问题数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
### FastAPI 专家 - 一年 |
|||
|
|||
这些是在过去一年中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🧑🔬 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.one_year_experts[:20] %} |
|||
|
|||
<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">回答问题数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## FastAPI 专家 - 全部时间 |
|||
|
|||
以下是全部时间的 **FastAPI 专家**。 🤓🤯 |
|||
|
|||
这些用户一直以来致力于 [帮助他人解决 GitHub 的 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🧙 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">回答问题数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 杰出贡献者 |
|||
|
|||
以下是 **杰出的贡献者**。 👷 |
|||
|
|||
这些用户 [创建了最多已被合并的 Pull Requests](help-fastapi.md#pr){.internal-link target=_blank}。 |
|||
|
|||
他们贡献了源代码,文档,翻译等。 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Requests: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
还有很多别的贡献者(超过100个),你可以在 <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub 贡献者页面</a> 中看到他们。👷 |
|||
|
|||
## 杰出翻译审核者 |
|||
|
|||
以下用户是 **杰出的评审者**。 🕵️ |
|||
|
|||
我只会说少数几种语言(而且还不是很流利 😅)。所以这些评审者们具备[能力去批准文档翻译](contributing.md#_8){.internal-link target=_blank}。如果没有他们,就不会有多语言文档。 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">审核数: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 赞助商 |
|||
|
|||
以下是 **赞助商** 。😎 |
|||
|
|||
他们主要通过<a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>支持我在 **FastAPI** (和其他项目)的工作。 |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### 金牌赞助商 |
|||
|
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### 银牌赞助商 |
|||
|
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### 铜牌赞助商 |
|||
|
|||
{% for sponsor in sponsors.bronze -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% endif %} |
|||
|
|||
### 个人赞助 |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## 关于数据 - 技术细节 |
|||
|
|||
该页面的目的是突出社区为帮助他人而付出的努力。 |
|||
|
|||
尤其是那些不引人注目且涉及更困难的任务,例如帮助他人解决问题或者评审翻译 Pull Requests。 |
|||
|
|||
该数据每月计算一次,您可以阅读 <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">源代码</a>。 |
|||
|
|||
这里也强调了赞助商的贡献。 |
|||
|
|||
我也保留更新算法,栏目,统计阈值等的权利(以防万一🤷)。 |
@ -1,12 +1,14 @@ |
|||
import pytest |
|||
from httpx import AsyncClient |
|||
from httpx import ASGITransport, AsyncClient |
|||
|
|||
from .main import app |
|||
|
|||
|
|||
@pytest.mark.anyio |
|||
async def test_root(): |
|||
async with AsyncClient(app=app, base_url="http://test") as ac: |
|||
async with AsyncClient( |
|||
transport=ASGITransport(app=app), base_url="http://test" |
|||
) as ac: |
|||
response = await ac.get("/") |
|||
assert response.status_code == 200 |
|||
assert response.json() == {"message": "Tomato"} |
|||
|
@ -1,58 +1,37 @@ |
|||
from typing import Any, Callable, List, Optional, Sequence |
|||
from dataclasses import dataclass, field |
|||
from typing import Any, Callable, List, Optional, Sequence, Tuple |
|||
|
|||
from fastapi._compat import ModelField |
|||
from fastapi.security.base import SecurityBase |
|||
|
|||
|
|||
@dataclass |
|||
class SecurityRequirement: |
|||
def __init__( |
|||
self, security_scheme: SecurityBase, scopes: Optional[Sequence[str]] = None |
|||
): |
|||
self.security_scheme = security_scheme |
|||
self.scopes = scopes |
|||
security_scheme: SecurityBase |
|||
scopes: Optional[Sequence[str]] = None |
|||
|
|||
|
|||
@dataclass |
|||
class Dependant: |
|||
def __init__( |
|||
self, |
|||
*, |
|||
path_params: Optional[List[ModelField]] = None, |
|||
query_params: Optional[List[ModelField]] = None, |
|||
header_params: Optional[List[ModelField]] = None, |
|||
cookie_params: Optional[List[ModelField]] = None, |
|||
body_params: Optional[List[ModelField]] = None, |
|||
dependencies: Optional[List["Dependant"]] = None, |
|||
security_schemes: Optional[List[SecurityRequirement]] = None, |
|||
name: Optional[str] = None, |
|||
call: Optional[Callable[..., Any]] = None, |
|||
request_param_name: Optional[str] = None, |
|||
websocket_param_name: Optional[str] = None, |
|||
http_connection_param_name: Optional[str] = None, |
|||
response_param_name: Optional[str] = None, |
|||
background_tasks_param_name: Optional[str] = None, |
|||
security_scopes_param_name: Optional[str] = None, |
|||
security_scopes: Optional[List[str]] = None, |
|||
use_cache: bool = True, |
|||
path: Optional[str] = None, |
|||
) -> None: |
|||
self.path_params = path_params or [] |
|||
self.query_params = query_params or [] |
|||
self.header_params = header_params or [] |
|||
self.cookie_params = cookie_params or [] |
|||
self.body_params = body_params or [] |
|||
self.dependencies = dependencies or [] |
|||
self.security_requirements = security_schemes or [] |
|||
self.request_param_name = request_param_name |
|||
self.websocket_param_name = websocket_param_name |
|||
self.http_connection_param_name = http_connection_param_name |
|||
self.response_param_name = response_param_name |
|||
self.background_tasks_param_name = background_tasks_param_name |
|||
self.security_scopes = security_scopes |
|||
self.security_scopes_param_name = security_scopes_param_name |
|||
self.name = name |
|||
self.call = call |
|||
self.use_cache = use_cache |
|||
# Store the path to be able to re-generate a dependable from it in overrides |
|||
self.path = path |
|||
# Save the cache key at creation to optimize performance |
|||
path_params: List[ModelField] = field(default_factory=list) |
|||
query_params: List[ModelField] = field(default_factory=list) |
|||
header_params: List[ModelField] = field(default_factory=list) |
|||
cookie_params: List[ModelField] = field(default_factory=list) |
|||
body_params: List[ModelField] = field(default_factory=list) |
|||
dependencies: List["Dependant"] = field(default_factory=list) |
|||
security_requirements: List[SecurityRequirement] = field(default_factory=list) |
|||
name: Optional[str] = None |
|||
call: Optional[Callable[..., Any]] = None |
|||
request_param_name: Optional[str] = None |
|||
websocket_param_name: Optional[str] = None |
|||
http_connection_param_name: Optional[str] = None |
|||
response_param_name: Optional[str] = None |
|||
background_tasks_param_name: Optional[str] = None |
|||
security_scopes_param_name: Optional[str] = None |
|||
security_scopes: Optional[List[str]] = None |
|||
use_cache: bool = True |
|||
path: Optional[str] = None |
|||
cache_key: Tuple[Optional[Callable[..., Any]], Tuple[str, ...]] = field(init=False) |
|||
|
|||
def __post_init__(self) -> None: |
|||
self.cache_key = (self.call, tuple(sorted(set(self.security_scopes or [])))) |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue