mirror of https://github.com/tiangolo/fastapi.git
🔧 Upgrade Material for MkDocs and remove insiders (#14375)
This commit is contained in:
parent
325fd16d32
commit
be5a6311f5
|
|
@ -32,12 +32,9 @@ jobs:
|
||||||
- docs/**
|
- docs/**
|
||||||
- docs_src/**
|
- docs_src/**
|
||||||
- requirements-docs.txt
|
- requirements-docs.txt
|
||||||
- requirements-docs-insiders.txt
|
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- mkdocs.yml
|
- mkdocs.yml
|
||||||
- mkdocs.insiders.yml
|
- mkdocs.env.yml
|
||||||
- mkdocs.maybe-insiders.yml
|
|
||||||
- mkdocs.no-insiders.yml
|
|
||||||
- .github/workflows/build-docs.yml
|
- .github/workflows/build-docs.yml
|
||||||
- .github/workflows/deploy-docs.yml
|
- .github/workflows/deploy-docs.yml
|
||||||
- scripts/mkdocs_hooks.py
|
- scripts/mkdocs_hooks.py
|
||||||
|
|
@ -63,12 +60,6 @@ jobs:
|
||||||
pyproject.toml
|
pyproject.toml
|
||||||
- name: Install docs extras
|
- name: Install docs extras
|
||||||
run: uv pip install -r requirements-docs.txt
|
run: uv pip install -r requirements-docs.txt
|
||||||
# Install MkDocs Material Insiders here just to put it in the cache for the rest of the steps
|
|
||||||
- name: Install Material for MkDocs Insiders
|
|
||||||
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
|
|
||||||
run: uv pip install -r requirements-docs-insiders.txt
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
|
||||||
- name: Verify Docs
|
- name: Verify Docs
|
||||||
run: python ./scripts/docs.py verify-docs
|
run: python ./scripts/docs.py verify-docs
|
||||||
- name: Export Language Codes
|
- name: Export Language Codes
|
||||||
|
|
@ -105,11 +96,6 @@ jobs:
|
||||||
pyproject.toml
|
pyproject.toml
|
||||||
- name: Install docs extras
|
- name: Install docs extras
|
||||||
run: uv pip install -r requirements-docs.txt
|
run: uv pip install -r requirements-docs.txt
|
||||||
- name: Install Material for MkDocs Insiders
|
|
||||||
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
|
|
||||||
run: uv pip install -r requirements-docs-insiders.txt
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }}
|
|
||||||
- name: Update Languages
|
- name: Update Languages
|
||||||
run: python ./scripts/docs.py update-languages
|
run: python ./scripts/docs.py update-languages
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
# Define this here and not in the main mkdocs.yml file because that one is auto
|
# Define this here and not in the main mkdocs.yml file because that one is auto
|
||||||
# updated and written, and the script would remove the env var
|
# updated and written, and the script would remove the env var
|
||||||
INHERIT: !ENV [INSIDERS_FILE, '../en/mkdocs.no-insiders.yml']
|
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
pymdownx.highlight:
|
pymdownx.highlight:
|
||||||
linenums: !ENV [LINENUMS, false]
|
linenums: !ENV [LINENUMS, false]
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
plugins:
|
|
||||||
social:
|
|
||||||
cards_layout_options:
|
|
||||||
logo: ../en/docs/img/icon-white.svg
|
|
||||||
typeset:
|
|
||||||
markdown_extensions:
|
|
||||||
material.extensions.preview:
|
|
||||||
targets:
|
|
||||||
include:
|
|
||||||
- "*"
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
INHERIT: ../en/mkdocs.maybe-insiders.yml
|
INHERIT: ../en/mkdocs.env.yml
|
||||||
site_name: FastAPI
|
site_name: FastAPI
|
||||||
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
|
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
|
||||||
site_url: https://fastapi.tiangolo.com/
|
site_url: https://fastapi.tiangolo.com/
|
||||||
|
|
@ -52,6 +52,10 @@ theme:
|
||||||
repo_name: fastapi/fastapi
|
repo_name: fastapi/fastapi
|
||||||
repo_url: https://github.com/fastapi/fastapi
|
repo_url: https://github.com/fastapi/fastapi
|
||||||
plugins:
|
plugins:
|
||||||
|
social:
|
||||||
|
cards_layout_options:
|
||||||
|
logo: ../en/docs/img/icon-white.svg
|
||||||
|
typeset:
|
||||||
search: null
|
search: null
|
||||||
macros:
|
macros:
|
||||||
include_yaml:
|
include_yaml:
|
||||||
|
|
@ -253,6 +257,10 @@ nav:
|
||||||
- management.md
|
- management.md
|
||||||
- release-notes.md
|
- release-notes.md
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
|
material.extensions.preview:
|
||||||
|
targets:
|
||||||
|
include:
|
||||||
|
- "*"
|
||||||
abbr: null
|
abbr: null
|
||||||
attr_list: null
|
attr_list: null
|
||||||
footnotes: null
|
footnotes: null
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
git+https://${TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.30-insiders-4.53.11
|
|
||||||
git+https://${TOKEN}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
|
|
||||||
git+https://${TOKEN}@github.com/pawamoy-insiders/mkdocstrings-python.git
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
-e .
|
-e .
|
||||||
-r requirements-docs-tests.txt
|
-r requirements-docs-tests.txt
|
||||||
mkdocs-material==9.6.16
|
mkdocs-material==9.7.0
|
||||||
mdx-include >=1.4.1,<2.0.0
|
mdx-include >=1.4.1,<2.0.0
|
||||||
mkdocs-redirects>=1.2.1,<1.3.0
|
mkdocs-redirects>=1.2.1,<1.3.0
|
||||||
typer == 0.16.0
|
typer == 0.16.0
|
||||||
|
|
@ -13,6 +13,7 @@ pillow==11.3.0
|
||||||
cairosvg==2.8.2
|
cairosvg==2.8.2
|
||||||
mkdocstrings[python]==0.30.1
|
mkdocstrings[python]==0.30.1
|
||||||
griffe-typingdoc==0.3.0
|
griffe-typingdoc==0.3.0
|
||||||
|
griffe-warnings-deprecated==1.1.0
|
||||||
# For griffe, it formats with black
|
# For griffe, it formats with black
|
||||||
black==25.1.0
|
black==25.1.0
|
||||||
mkdocs-macros-plugin==1.4.1
|
mkdocs-macros-plugin==1.4.1
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from functools import lru_cache
|
|
||||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||||
from importlib import metadata
|
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
@ -47,12 +45,6 @@ build_site_path = Path("site_build").absolute()
|
||||||
header_with_permalink_pattern = re.compile(r"^(#{1,6}) (.+?)(\s*\{\s*#.*\s*\})\s*$")
|
header_with_permalink_pattern = re.compile(r"^(#{1,6}) (.+?)(\s*\{\s*#.*\s*\})\s*$")
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
|
||||||
def is_mkdocs_insiders() -> bool:
|
|
||||||
version = metadata.version("mkdocs-material")
|
|
||||||
return "insiders" in version
|
|
||||||
|
|
||||||
|
|
||||||
def get_en_config() -> Dict[str, Any]:
|
def get_en_config() -> Dict[str, Any]:
|
||||||
return mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8"))
|
return mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8"))
|
||||||
|
|
||||||
|
|
@ -77,9 +69,7 @@ def complete_existing_lang(incomplete: str):
|
||||||
|
|
||||||
@app.callback()
|
@app.callback()
|
||||||
def callback() -> None:
|
def callback() -> None:
|
||||||
if is_mkdocs_insiders():
|
# For MacOS with Cairo
|
||||||
os.environ["INSIDERS_FILE"] = "../en/mkdocs.insiders.yml"
|
|
||||||
# For MacOS with insiders and Cairo
|
|
||||||
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib"
|
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -115,10 +105,6 @@ def build_lang(
|
||||||
"""
|
"""
|
||||||
Build the docs for a language.
|
Build the docs for a language.
|
||||||
"""
|
"""
|
||||||
insiders_env_file = os.environ.get("INSIDERS_FILE")
|
|
||||||
print(f"Insiders file {insiders_env_file}")
|
|
||||||
if is_mkdocs_insiders():
|
|
||||||
print("Using insiders")
|
|
||||||
lang_path: Path = Path("docs") / lang
|
lang_path: Path = Path("docs") / lang
|
||||||
if not lang_path.is_dir():
|
if not lang_path.is_dir():
|
||||||
typer.echo(f"The language translation doesn't seem to exist yet: {lang}")
|
typer.echo(f"The language translation doesn't seem to exist yet: {lang}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue