From: Sebastián Ramírez Date: Thu, 20 Nov 2025 12:12:37 +0000 (+0100) Subject: 🔧 Upgrade Material for MkDocs and remove insiders (#1650) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4006f7b864d4c1ef302a84d8591015766eea968e;p=thirdparty%2Ffastapi%2Fsqlmodel.git 🔧 Upgrade Material for MkDocs and remove insiders (#1650) --- diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index d4d4737e..1b702741 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -33,12 +33,9 @@ jobs: - docs/** - docs_src/** - requirements-docs.txt - - requirements-docs-insiders.txt - pyproject.toml - mkdocs.yml - - mkdocs.insiders.yml - - mkdocs.maybe-insiders.yml - - mkdocs.no-insiders.yml + - mkdocs.env.yml - .github/workflows/build-docs.yml - .github/workflows/deploy-docs.yml - data/** @@ -68,11 +65,6 @@ jobs: pyproject.toml - name: Install docs extras 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.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }} - uses: actions/cache@v4 with: key: mkdocs-cards-${{ github.ref }} diff --git a/mkdocs.maybe-insiders.yml b/mkdocs.env.yml similarity index 79% rename from mkdocs.maybe-insiders.yml rename to mkdocs.env.yml index 07aefaaa..545d30a1 100644 --- a/mkdocs.maybe-insiders.yml +++ b/mkdocs.env.yml @@ -1,6 +1,5 @@ # Define this here and not in the main mkdocs.yml file because that one could be auto # updated and written, and the script would remove the env var -INHERIT: !ENV [INSIDERS_FILE, './mkdocs.no-insiders.yml'] markdown_extensions: pymdownx.highlight: linenums: !ENV [LINENUMS, false] diff --git a/mkdocs.insiders.yml b/mkdocs.insiders.yml deleted file mode 100644 index 80d2d4b6..00000000 --- a/mkdocs.insiders.yml +++ /dev/null @@ -1,7 +0,0 @@ -plugins: - typeset: -markdown_extensions: - material.extensions.preview: - targets: - include: - - "*" diff --git a/mkdocs.no-insiders.yml b/mkdocs.no-insiders.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/mkdocs.yml b/mkdocs.yml index c59ccd24..b89516e0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -INHERIT: ./mkdocs.maybe-insiders.yml +INHERIT: ./mkdocs.env.yml site_name: SQLModel site_description: SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. site_url: https://sqlmodel.tiangolo.com/ @@ -58,6 +58,7 @@ plugins: # Material for MkDocs search: social: + typeset: # Other plugins macros: include_yaml: @@ -140,6 +141,11 @@ nav: - release-notes.md markdown_extensions: + # Material for MkDocs + material.extensions.preview: + targets: + include: + - "*" # Python Markdown abbr: attr_list: diff --git a/requirements-docs-insiders.txt b/requirements-docs-insiders.txt deleted file mode 100644 index d8d3c37a..00000000 --- a/requirements-docs-insiders.txt +++ /dev/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 diff --git a/requirements-docs.txt b/requirements-docs.txt index a76936c7..1bee2c6c 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -10,8 +10,9 @@ pyyaml >=5.3.1,<7.0.0 pillow==11.3.0 # For image processing by Material for MkDocs cairosvg==2.8.2 -# mkdocstrings[python]==0.25.1 +mkdocstrings[python]==0.30.1 griffe-typingdoc==0.3.0 +griffe-warnings-deprecated==1.1.0 # For griffe, it formats with black typer == 0.20.0 mkdocs-macros-plugin==1.5.0 diff --git a/scripts/docs.py b/scripts/docs.py index d018ace8..a424f177 100644 --- a/scripts/docs.py +++ b/scripts/docs.py @@ -2,9 +2,7 @@ import logging import os import re import subprocess -from functools import lru_cache from http.server import HTTPServer, SimpleHTTPRequestHandler -from importlib import metadata from pathlib import Path import mkdocs.utils @@ -19,17 +17,9 @@ en_docs_path = Path("") app = typer.Typer() -@lru_cache -def is_mkdocs_insiders() -> bool: - version = metadata.version("mkdocs-material") - return "insiders" in version - - @app.callback() def callback() -> None: - if is_mkdocs_insiders(): - os.environ["INSIDERS_FILE"] = "./mkdocs.insiders.yml" - # For MacOS with insiders and Cairo + # For MacOS with Cairo os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib" @@ -126,10 +116,6 @@ def build() -> None: """ Build the docs. """ - insiders_env_file = os.environ.get("INSIDERS_FILE") - print(f"Insiders file {insiders_env_file}") - if is_mkdocs_insiders(): - print("Using insiders") print("Building docs") subprocess.run(["mkdocs", "build"], check=True) typer.secho("Successfully built docs", color=typer.colors.GREEN)