Skip to content

Commit 62bdb6c

Browse files
authored
Merge branch 'master' into fix-security-exception-status-codes
2 parents 8234c43 + 10500db commit 62bdb6c

File tree

154 files changed

+5841
-944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+5841
-944
lines changed

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/actions/notify-translations/app/translations.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ nl: 4701
1717
uz: 4883
1818
sv: 5146
1919
he: 5157
20+
ta: 5434
21+
ar: 3349

.github/actions/people/app/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class Settings(BaseSettings):
260260
input_token: SecretStr
261261
input_standard_token: SecretStr
262262
github_repository: str
263+
httpx_timeout: int = 30
263264

264265

265266
def get_graphql_response(
@@ -270,9 +271,10 @@ def get_graphql_response(
270271
response = httpx.post(
271272
github_graphql_url,
272273
headers=headers,
274+
timeout=settings.httpx_timeout,
273275
json={"query": query, "variables": variables, "operationName": "Q"},
274276
)
275-
if not response.status_code == 200:
277+
if response.status_code != 200:
276278
logging.error(f"Response was not 200, after: {after}")
277279
logging.error(response.text)
278280
raise RuntimeError(response.text)
@@ -431,7 +433,7 @@ def get_top_users(
431433
)
432434
authors = {**issue_authors, **pr_authors}
433435
maintainers_logins = {"tiangolo"}
434-
bot_names = {"codecov", "github-actions"}
436+
bot_names = {"codecov", "github-actions", "pre-commit-ci", "dependabot"}
435437
maintainers = []
436438
for login in maintainers_logins:
437439
user = authors[login]

.github/workflows/build-docs.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,22 @@ jobs:
2323
with:
2424
path: ${{ env.pythonLocation }}
2525
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v03
26-
- name: Install Flit
27-
if: steps.cache.outputs.cache-hit != 'true'
28-
run: python3.7 -m pip install flit
2926
- name: Install docs extras
3027
if: steps.cache.outputs.cache-hit != 'true'
31-
run: python3.7 -m flit install --deps production --extras doc
28+
run: pip install .[doc]
3229
- name: Install Material for MkDocs Insiders
3330
if: ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false ) && steps.cache.outputs.cache-hit != 'true'
3431
run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
3532
- name: Build Docs
36-
run: python3.7 ./scripts/docs.py build-all
33+
run: python ./scripts/docs.py build-all
3734
- name: Zip docs
3835
run: bash ./scripts/zip-docs.sh
3936
- uses: actions/upload-artifact@v3
4037
with:
4138
name: docs-zip
42-
path: ./docs.zip
39+
path: ./site/docs.zip
4340
- name: Deploy to Netlify
44-
uses: nwtgck/actions-netlify@v1.2.3
41+
uses: nwtgck/actions-netlify@v2.0.0
4542
with:
4643
publish-dir: './site'
4744
production-branch: master

.github/workflows/preview-docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,26 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14+
- name: Clean site
15+
run: |
16+
rm -rf ./site
17+
mkdir ./site
1418
- name: Download Artifact Docs
15-
uses: dawidd6/action-download-artifact@v2.22.0
19+
uses: dawidd6/action-download-artifact@v2.24.2
1620
with:
1721
github_token: ${{ secrets.GITHUB_TOKEN }}
1822
workflow: build-docs.yml
1923
run_id: ${{ github.event.workflow_run.id }}
2024
name: docs-zip
25+
path: ./site/
2126
- name: Unzip docs
2227
run: |
23-
rm -rf ./site
28+
cd ./site
2429
unzip docs.zip
2530
rm -f docs.zip
2631
- name: Deploy to Netlify
2732
id: netlify
28-
uses: nwtgck/actions-netlify@v1.2.3
33+
uses: nwtgck/actions-netlify@v2.0.0
2934
with:
3035
publish-dir: './site'
3136
production-deploy: false

.github/workflows/publish.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v4
1919
with:
20-
python-version: "3.6"
20+
python-version: "3.7"
21+
cache: "pip"
22+
cache-dependency-path: pyproject.toml
2123
- uses: actions/cache@v3
2224
id: cache
2325
with:
2426
path: ${{ env.pythonLocation }}
2527
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
26-
- name: Install Flit
28+
- name: Install build dependencies
2729
if: steps.cache.outputs.cache-hit != 'true'
28-
run: pip install flit
29-
- name: Install Dependencies
30-
if: steps.cache.outputs.cache-hit != 'true'
31-
run: flit install --symlink
30+
run: pip install build
31+
- name: Build distribution
32+
run: python -m build
3233
- name: Publish
33-
env:
34-
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
35-
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
36-
run: bash scripts/publish.sh
34+
uses: pypa/[email protected]
35+
with:
36+
password: ${{ secrets.PYPI_API_TOKEN }}
3737
- name: Dump GitHub context
3838
env:
3939
GITHUB_CONTEXT: ${{ toJson(github) }}

.github/workflows/smokeshow.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Smokeshow
2+
3+
on:
4+
workflow_run:
5+
workflows: [Test]
6+
types: [completed]
7+
8+
permissions:
9+
statuses: write
10+
11+
jobs:
12+
smokeshow:
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- run: pip install smokeshow
22+
23+
- uses: dawidd6/[email protected]
24+
with:
25+
workflow: test.yml
26+
commit: ${{ github.event.workflow_run.head_sha }}
27+
28+
- run: smokeshow upload coverage-html
29+
env:
30+
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
31+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100
32+
SMOKESHOW_GITHUB_CONTEXT: coverage
33+
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
35+
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

.github/workflows/test.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
15+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1616
fail-fast: false
1717

1818
steps:
@@ -21,21 +21,57 @@ jobs:
2121
uses: actions/setup-python@v4
2222
with:
2323
python-version: ${{ matrix.python-version }}
24+
cache: "pip"
25+
cache-dependency-path: pyproject.toml
2426
- uses: actions/cache@v3
2527
id: cache
2628
with:
2729
path: ${{ env.pythonLocation }}
28-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v02
29-
- name: Install Flit
30-
if: steps.cache.outputs.cache-hit != 'true'
31-
run: pip install flit
30+
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
3231
- name: Install Dependencies
3332
if: steps.cache.outputs.cache-hit != 'true'
34-
run: flit install --symlink
33+
run: pip install -e .[all,dev,doc,test]
3534
- name: Lint
36-
if: ${{ matrix.python-version != '3.6' }}
3735
run: bash scripts/lint.sh
36+
- run: mkdir coverage
3837
- name: Test
3938
run: bash scripts/test.sh
40-
- name: Upload coverage
41-
uses: codecov/codecov-action@v3
39+
env:
40+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
41+
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
42+
- name: Store coverage files
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: coverage
46+
path: coverage
47+
coverage-combine:
48+
needs: [test]
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- uses: actions/checkout@v3
53+
54+
- uses: actions/setup-python@v4
55+
with:
56+
python-version: '3.8'
57+
cache: "pip"
58+
cache-dependency-path: pyproject.toml
59+
60+
- name: Get coverage files
61+
uses: actions/download-artifact@v3
62+
with:
63+
name: coverage
64+
path: coverage
65+
66+
- run: pip install coverage[toml]
67+
68+
- run: ls -la coverage
69+
- run: coverage combine coverage
70+
- run: coverage report
71+
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
72+
73+
- name: Store coverage HTML
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: coverage-html
77+
path: htmlcov

.pre-commit-config.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,18 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.37.3
15+
rev: v3.2.2
1616
hooks:
1717
- id: pyupgrade
1818
args:
1919
- --py3-plus
2020
- --keep-runtime-typing
21-
- repo: https://github.com/myint/autoflake
22-
rev: v1.4
21+
- repo: https://github.com/charliermarsh/ruff-pre-commit
22+
rev: v0.0.138
2323
hooks:
24-
- id: autoflake
24+
- id: ruff
2525
args:
26-
- --recursive
27-
- --in-place
28-
- --remove-all-unused-imports
29-
- --remove-unused-variables
30-
- --expand-star-imports
31-
- --exclude
32-
- __init__.py
33-
- --remove-duplicate-keys
26+
- --fix
3427
- repo: https://github.com/pycqa/isort
3528
rev: 5.10.1
3629
hooks:
@@ -43,7 +36,7 @@ repos:
4336
name: isort (pyi)
4437
types: [pyi]
4538
- repo: https://github.com/psf/black
46-
rev: 22.6.0
39+
rev: 22.10.0
4740
hooks:
4841
- id: black
4942
ci:

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<a href="https://github.com/tiangolo/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
99
<img src="https://github.com/tiangolo/fastapi/workflows/Test/badge.svg?event=push&branch=master" alt="Test">
1010
</a>
11-
<a href="https://codecov.io/gh/tiangolo/fastapi" target="_blank">
12-
<img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
11+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/fastapi" target="_blank">
12+
<img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/fastapi.svg" alt="Coverage">
1313
</a>
1414
<a href="https://pypi.org/project/fastapi" target="_blank">
1515
<img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
@@ -27,7 +27,7 @@
2727

2828
---
2929

30-
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
30+
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
3131

3232
The key features are:
3333

@@ -112,7 +112,7 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be
112112

113113
## Requirements
114114

115-
Python 3.6+
115+
Python 3.7+
116116

117117
FastAPI stands on the shoulders of giants:
118118

@@ -131,7 +131,7 @@ $ pip install fastapi
131131

132132
</div>
133133

134-
You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
134+
You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://github.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
135135

136136
<div class="termy">
137137

@@ -328,7 +328,7 @@ You do that with standard modern Python types.
328328

329329
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
330330

331-
Just standard **Python 3.6+**.
331+
Just standard **Python 3.7+**.
332332

333333
For example, for an `int`:
334334

@@ -427,7 +427,7 @@ For a more complete example including more features, see the <a href="https://fa
427427
* **GraphQL** integration with <a href="https://strawberry.rocks" class="external-link" target="_blank">Strawberry</a> and other libraries.
428428
* Many extra features (thanks to Starlette) as:
429429
* **WebSockets**
430-
* extremely easy tests based on `requests` and `pytest`
430+
* extremely easy tests based on HTTPX and `pytest`
431431
* **CORS**
432432
* **Cookie Sessions**
433433
* ...and more.
@@ -447,7 +447,7 @@ Used by Pydantic:
447447

448448
Used by Starlette:
449449

450-
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
450+
* <a href="https://www.python-httpx.org" target="_blank"><code>httpx</code></a> - Required if you want to use the `TestClient`.
451451
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
452452
* <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
453453
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.

0 commit comments

Comments
 (0)