Skip to content

Commit

Permalink
Merge branch 'master' into add-noscript-to-redoc-html
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Aug 26, 2022
2 parents 38bcdc3 + 26c68c6 commit c54a593
Show file tree
Hide file tree
Showing 142 changed files with 4,791 additions and 645 deletions.
6 changes: 3 additions & 3 deletions .github/actions/comment-docs-preview-in-pr/app/main.py
@@ -1,7 +1,7 @@
import logging
import sys
from pathlib import Path
from typing import Optional
from typing import Union

import httpx
from github import Github
Expand All @@ -14,7 +14,7 @@
class Settings(BaseSettings):
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
github_event_name: Union[str, None] = None
input_token: SecretStr
input_deploy_url: str

Expand Down Expand Up @@ -42,7 +42,7 @@ class PartialGithubEvent(BaseModel):
except ValidationError as e:
logging.error(f"Error parsing event file: {e.errors()}")
sys.exit(0)
use_pr: Optional[PullRequest] = None
use_pr: Union[PullRequest, None] = None
for pr in repo.get_pulls():
if pr.head.sha == event.workflow_run.head_commit.id:
use_pr = pr
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/notify-translations/app/main.py
Expand Up @@ -2,7 +2,7 @@
import random
import time
from pathlib import Path
from typing import Dict, Optional
from typing import Dict, Union

import yaml
from github import Github
Expand All @@ -18,8 +18,8 @@ class Settings(BaseSettings):
github_repository: str
input_token: SecretStr
github_event_path: Path
github_event_name: Optional[str] = None
input_debug: Optional[bool] = False
github_event_name: Union[str, None] = None
input_debug: Union[bool, None] = False


class PartialGitHubEventIssue(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/notify-translations/app/translations.yml
Expand Up @@ -8,10 +8,12 @@ uk: 1748
tr: 1892
fr: 1972
ko: 2017
sq: 2041
fa: 2041
pl: 3169
de: 3716
id: 3717
az: 3994
nl: 4701
uz: 4883
sv: 5146
he: 5157
18 changes: 9 additions & 9 deletions .github/actions/people/app/main.py
Expand Up @@ -4,7 +4,7 @@
from collections import Counter, defaultdict
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Container, DefaultDict, Dict, List, Optional, Set
from typing import Container, DefaultDict, Dict, List, Set, Union

import httpx
import yaml
Expand Down Expand Up @@ -133,7 +133,7 @@ class Author(BaseModel):

class CommentsNode(BaseModel):
createdAt: datetime
author: Optional[Author] = None
author: Union[Author, None] = None


class Comments(BaseModel):
Expand All @@ -142,7 +142,7 @@ class Comments(BaseModel):

class IssuesNode(BaseModel):
number: int
author: Optional[Author] = None
author: Union[Author, None] = None
title: str
createdAt: datetime
state: str
Expand Down Expand Up @@ -179,7 +179,7 @@ class Labels(BaseModel):


class ReviewNode(BaseModel):
author: Optional[Author] = None
author: Union[Author, None] = None
state: str


Expand All @@ -190,7 +190,7 @@ class Reviews(BaseModel):
class PullRequestNode(BaseModel):
number: int
labels: Labels
author: Optional[Author] = None
author: Union[Author, None] = None
title: str
createdAt: datetime
state: str
Expand Down Expand Up @@ -263,7 +263,7 @@ class Settings(BaseSettings):


def get_graphql_response(
*, settings: Settings, query: str, after: Optional[str] = None
*, settings: Settings, query: str, after: Union[str, None] = None
):
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
variables = {"after": after}
Expand All @@ -280,19 +280,19 @@ def get_graphql_response(
return data


def get_graphql_issue_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_issue_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=issues_query, after=after)
graphql_response = IssuesResponse.parse_obj(data)
return graphql_response.data.repository.issues.edges


def get_graphql_pr_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=prs_query, after=after)
graphql_response = PRsResponse.parse_obj(data)
return graphql_response.data.repository.pullRequests.edges


def get_graphql_sponsor_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_sponsor_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=sponsors_query, after=after)
graphql_response = SponsorsResponse.parse_obj(data)
return graphql_response.data.user.sponsorshipsAsMaintainer.edges
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/watch-previews/app/main.py
@@ -1,7 +1,7 @@
import logging
from datetime import datetime
from pathlib import Path
from typing import List, Optional
from typing import List, Union

import httpx
from github import Github
Expand All @@ -16,7 +16,7 @@ class Settings(BaseSettings):
input_token: SecretStr
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
github_event_name: Union[str, None] = None


class Artifact(BaseModel):
Expand Down Expand Up @@ -74,7 +74,7 @@ def get_message(commit: str) -> str:
logging.info(f"Docs preview was notified: {notified}")
if not notified:
artifact_name = f"docs-zip-{commit}"
use_artifact: Optional[Artifact] = None
use_artifact: Union[Artifact, None] = None
for artifact in artifacts_response.artifacts:
if artifact.name == artifact_name:
use_artifact = artifact
Expand Down
16 changes: 16 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,16 @@
version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix:
# Python
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix:
10 changes: 5 additions & 5 deletions .github/workflows/build-docs.yml
Expand Up @@ -13,12 +13,12 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.7"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
Expand All @@ -36,12 +36,12 @@ jobs:
run: python3.7 ./scripts/docs.py build-all
- name: Zip docs
run: bash ./scripts/zip-docs.sh
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: docs-zip
path: ./docs.zip
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1.5
uses: nwtgck/actions-netlify@v1.2.3
with:
publish-dir: './site'
production-branch: master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/latest-changes.yml
Expand Up @@ -20,7 +20,7 @@ jobs:
latest-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# To allow latest-changes to commit to master
token: ${{ secrets.ACTIONS_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notify-translations.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
notify-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/people.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
fastapi-people:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview-docs.yml
Expand Up @@ -10,9 +10,9 @@ jobs:
preview-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Download Artifact Docs
uses: dawidd6/action-download-artifact@v2.9.0
uses: dawidd6/action-download-artifact@v2.21.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-docs.yml
Expand All @@ -25,7 +25,7 @@ jobs:
rm -f docs.zip
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@v1.1.5
uses: nwtgck/actions-netlify@v1.2.3
with:
publish-dir: './site'
production-deploy: false
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Expand Up @@ -13,12 +13,12 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.6"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -16,12 +16,12 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
Expand All @@ -38,4 +38,4 @@ jobs:
- name: Test
run: bash scripts/test.sh
- name: Upload coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-toml
Expand All @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
rev: v2.37.1
hooks:
- id: pyupgrade
args:
Expand Down Expand Up @@ -43,7 +43,7 @@ repos:
name: isort (pyi)
types: [pyi]
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black
ci:
Expand Down
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -47,10 +47,11 @@ The key features are:

<!-- sponsors -->

<a href="https://bit.ly/2QSouzH" target="_blank" title="Jina: build neural search-as-a-service for any kind of data in just minutes."><img src="https://fastapi.tiangolo.com/img/sponsors/jina.svg"></a>
<a href="https://bit.ly/3dmXC5S" target="_blank" title="The data structure for unstructured multimodal data"><img src="https://fastapi.tiangolo.com/img/sponsors/docarray.svg"></a>
<a href="https://bit.ly/3JJ7y5C" target="_blank" title="Build cross-modal and multimodal applications on the cloud"><img src="https://fastapi.tiangolo.com/img/sponsors/jina2.svg"></a>
<a href="https://cryptapi.io/" target="_blank" title="CryptAPI: Your easy to use, secure and privacy oriented payment gateway."><img src="https://fastapi.tiangolo.com/img/sponsors/cryptapi.svg"></a>
<a href="https://classiq.link/n4s" target="_blank" title="Join the team building a new SaaS platform that will change the computing world"><img src="https://fastapi.tiangolo.com/img/sponsors/classiq.png"></a>
<a href="https://www.dropbase.io/careers" target="_blank" title="Dropbase - seamlessly collect, clean, and centralize data."><img src="https://fastapi.tiangolo.com/img/sponsors/dropbase.svg"></a>
<a href="https://app.imgwhale.xyz/" target="_blank" title="The ultimate solution to unlimited and forever cloud storage."><img src="https://fastapi.tiangolo.com/img/sponsors/imgwhale.svg"></a>
<a href="https://doist.com/careers/9B437B1615-wa-senior-backend-engineer-python" target="_blank" title="Help us migrate doist to FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/doist.svg"></a>
<a href="https://www.deta.sh/?ref=fastapi" target="_blank" title="The launchpad for all your (team's) ideas"><img src="https://fastapi.tiangolo.com/img/sponsors/deta.svg"></a>
<a href="https://www.investsuite.com/jobs" target="_blank" title="Wealthtech jobs with FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/investsuite.svg"></a>
<a href="https://training.talkpython.fm/fastapi-courses" target="_blank" title="FastAPI video courses on demand from people you trust"><img src="https://fastapi.tiangolo.com/img/sponsors/talkpython.png"></a>
Expand Down

0 comments on commit c54a593

Please sign in to comment.