From 4006f7b864d4c1ef302a84d8591015766eea968e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 20 Nov 2025 13:12:37 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=94=A7=20Upgrade=20Material=20for=20MkDocs?= =?utf8?q?=20and=20remove=20insiders=20(#1650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-docs.yml | 10 +--------- mkdocs.maybe-insiders.yml => mkdocs.env.yml | 1 - mkdocs.insiders.yml | 7 ------- mkdocs.no-insiders.yml | 0 mkdocs.yml | 8 +++++++- requirements-docs-insiders.txt | 3 --- requirements-docs.txt | 3 ++- scripts/docs.py | 16 +--------------- 8 files changed, 11 insertions(+), 37 deletions(-) rename mkdocs.maybe-insiders.yml => mkdocs.env.yml (79%) delete mode 100644 mkdocs.insiders.yml delete mode 100644 mkdocs.no-insiders.yml delete mode 100644 requirements-docs-insiders.txt 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) -- 2.47.3