From d5ae476f9aa0722864e6acc0f638dd13b51fb74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 20 Nov 2025 12:47:21 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Upgrade=20Material=20for=20MkDoc?= =?UTF-8?q?s=20and=20remove=20insiders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-docs.yml | 10 +--------- mkdocs.maybe-insiders.yml => mkdocs.env.yml | 1 - mkdocs.yml | 8 +++++++- requirements-docs-insiders.txt | 3 --- requirements-docs.txt | 7 +++---- scripts/docs.py | 16 +--------------- 6 files changed, 12 insertions(+), 33 deletions(-) rename mkdocs.maybe-insiders.yml => mkdocs.env.yml (79%) delete mode 100644 requirements-docs-insiders.txt diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index be3a6d21..d0125f21 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -32,12 +32,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/** @@ -67,11 +64,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.ASYNCER_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.yml b/mkdocs.yml index ec633389..2f6e59be 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -INHERIT: ./mkdocs.maybe-insiders.yml +INHERIT: ./mkdocs.env.yml site_name: Asyncer site_description: Asyncer, async and await, focused on developer experience. site_url: https://asyncer.tiangolo.com/ @@ -57,6 +57,7 @@ plugins: # Material for MkDocs search: social: + typeset: # Other plugins macros: include_yaml: @@ -85,6 +86,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 841d88c9..bad2196c 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -10,9 +10,8 @@ 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 -# Enable griffe-typingdoc once dropping Python 3.7 and upgrading typing-extensions -# griffe-typingdoc==0.2.5 -# For griffe, it formats with black +mkdocstrings[python]==0.30.1 +griffe-typingdoc==0.3.0 +griffe-warnings-deprecated==1.1.0 typer == 0.20.0 mkdocs-macros-plugin==1.5.0 diff --git a/scripts/docs.py b/scripts/docs.py index acd3b30f..c20c6553 100644 --- a/scripts/docs.py +++ b/scripts/docs.py @@ -2,9 +2,7 @@ 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 typer @@ -17,17 +15,9 @@ 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" @@ -100,10 +90,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)