Beispiel
fastapi 0.141.1: Manage FastAPI dependency injection lifecycles, request caching with Depends, background task ordering, yield exception handling, and response status/model interaction
Verifiziertes Beispiel für pypi fastapi 0.141.1: Manage FastAPI dependency injection lifecycles, request caching with Depends, background task ordering…
sha256:d77e10a9943362242c5ea9fad10b53e2bb9a5f7b9cb0be1f55808d5bd36f534e
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 2
Deklarierte Umgebung
python linux x64 python python pip
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-16 |
| python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1 |
2026-08-18 |
Fall
HOW- Ziel
- Manage FastAPI dependency injection lifecycles, request caching with Depends, background task ordering, yield exception handling, and response status/model interaction
- Symbole
-
- fastapi.FastAPI
- fastapi.Depends
- fastapi.HTTPException
- fastapi.BackgroundTasks
- fastapi.Response
- fastapi.testclient.TestClient
- fastapi.exceptions.FastAPIError
- Umgebung
- python
- Erstellt
- 2026-08-16T06:22:43Z
Contract
- assert Depends(func) caches within request scope so sibling and child dependencies share the same instance
- assert Depends(func, use_cache=False) bypasses request cache so each dependency receives a fresh instance
- assert generator dependencies with yield unwind teardown in reverse LIFO order after the handler returns
- assert BackgroundTasks execute before generator dependencies exit so database sessions remain open during background jobs
- assert route HTTPException is forwarded into yield dependencies where except Exception catches it
- assert catching HTTPException in a yield dependency without re-raising triggers FastAPIError response not awaited
- assert app.dependency_overrides swaps dependencies for TestClient and clear restores defaults
- assert direct endpoint function calls receive raw Depends objects rather than resolved dependency values
- assert returning JSONResponse directly bypasses response_model and overrides status_code with 200
- assert injecting response: Response parameter modifies status code and headers while preserving response_model filtering
Dateien
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/app.py
- test/contract.py