Remove code examples for Python 3.8 in `custom_docs_ui`

This commit is contained in:
Yurii Motov 2025-12-10 20:16:52 +01:00
parent e4a4b0e4fa
commit 2679c58cbd
5 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ The first step is to disable the automatic docs, as by default, those use the de
To disable them, set their URLs to `None` when creating your `FastAPI` app:
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[8] *}
{* ../../docs_src/custom_docs_ui/tutorial001_py39.py hl[8] *}
### Include the custom docs { #include-the-custom-docs }
@ -34,7 +34,7 @@ You can reuse FastAPI's internal functions to create the HTML pages for the docs
And similarly for ReDoc...
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[2:6,11:19,22:24,27:33] *}
{* ../../docs_src/custom_docs_ui/tutorial001_py39.py hl[2:6,11:19,22:24,27:33] *}
/// tip
@ -50,7 +50,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
Now, to be able to test that everything works, create a *path operation*:
{* ../../docs_src/custom_docs_ui/tutorial001.py hl[36:38] *}
{* ../../docs_src/custom_docs_ui/tutorial001_py39.py hl[36:38] *}
### Test it { #test-it }
@ -118,7 +118,7 @@ After that, your file structure could look like:
* Import `StaticFiles`.
* "Mount" a `StaticFiles()` instance in a specific path.
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[7,11] *}
{* ../../docs_src/custom_docs_ui/tutorial002_py39.py hl[7,11] *}
### Test the static files { #test-the-static-files }
@ -144,7 +144,7 @@ The same as when using a custom CDN, the first step is to disable the automatic
To disable them, set their URLs to `None` when creating your `FastAPI` app:
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[9] *}
{* ../../docs_src/custom_docs_ui/tutorial002_py39.py hl[9] *}
### Include the custom docs for static files { #include-the-custom-docs-for-static-files }
@ -160,7 +160,7 @@ Again, you can reuse FastAPI's internal functions to create the HTML pages for t
And similarly for ReDoc...
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[2:6,14:22,25:27,30:36] *}
{* ../../docs_src/custom_docs_ui/tutorial002_py39.py hl[2:6,14:22,25:27,30:36] *}
/// tip
@ -176,7 +176,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
Now, to be able to test that everything works, create a *path operation*:
{* ../../docs_src/custom_docs_ui/tutorial002.py hl[39:41] *}
{* ../../docs_src/custom_docs_ui/tutorial002_py39.py hl[39:41] *}
### Test Static Files UI { #test-static-files-ui }

View File

@ -10,7 +10,7 @@ def client():
static_dir: Path = Path(os.getcwd()) / "static"
print(static_dir)
static_dir.mkdir(exist_ok=True)
from docs_src.custom_docs_ui.tutorial001 import app
from docs_src.custom_docs_ui.tutorial001_py39 import app
with TestClient(app) as client:
yield client

View File

@ -10,7 +10,7 @@ def client():
static_dir: Path = Path(os.getcwd()) / "static"
print(static_dir)
static_dir.mkdir(exist_ok=True)
from docs_src.custom_docs_ui.tutorial002 import app
from docs_src.custom_docs_ui.tutorial002_py39 import app
with TestClient(app) as client:
yield client