From 058d63c3e845d666fc454c5717eef826cef1fc35 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 10 Sep 2024 14:06:44 -0400 Subject: [PATCH] docs: fix docs build (#670) * docs: fix docs build * remove unused --- .pre-commit-config.yaml | 4 ++-- docs/scripts/_hooks.py | 20 +++----------------- pyproject.toml | 9 +++++---- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94b2162b0..a9614433f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,12 @@ repos: - id: validate-pyproject - repo: https://github.com/crate-ci/typos - rev: typos-dict-v0.11.27 + rev: v1.24.5 hooks: - id: typos - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.3 + rev: v0.6.4 hooks: - id: ruff args: ["--fix"] diff --git a/docs/scripts/_hooks.py b/docs/scripts/_hooks.py index 9e94b3fcc..b3d0eaa09 100644 --- a/docs/scripts/_hooks.py +++ b/docs/scripts/_hooks.py @@ -8,15 +8,13 @@ import types import typing import warnings -from contextlib import contextmanager from importlib import import_module from importlib.machinery import ModuleSpec from itertools import count from textwrap import dedent from typing import TYPE_CHECKING, Any, Mapping -from griffe.dataclasses import Alias -from griffe.docstrings import numpy +from griffe import Alias from mkdocstrings_handlers.python.handler import PythonHandler from magicgui.type_map import get_widget_class @@ -27,17 +25,6 @@ from mkdocs.structure.pages import Page -# TODO: figure out how to do this with options -@contextmanager -def _hide_numpy_warn(): - if not hasattr(numpy, "_warn"): - yield - return - before, numpy._warn = numpy._warn, lambda *x, **k: None - yield - numpy._warn = before - - def inject_dynamic_docstring(item: Alias, identifier: str) -> None: for i in range(1, 3): module_name, *names = identifier.rsplit(".", 1) @@ -67,12 +54,11 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> Any: return item def render(self, data: Any, config: Mapping[str, Any]) -> str: - with _hide_numpy_warn(): - return super().render(data, config) + return super().render(data, config) class MyLoader(importlib.abc.Loader): - def create_module(self, spec): + def create_module(self, spec) -> types.ModuleType: return types.ModuleType(spec.name) def exec_module(self, module: types.ModuleType) -> None: diff --git a/pyproject.toml b/pyproject.toml index 81835c08c..444321b64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,15 +85,16 @@ dev = [ docs = [ "mkdocs", "mkdocs-material ~=9.5", - "mkdocstrings ==0.25.1", - "mkdocstrings-python ==1.10.5", + "mkdocstrings ==0.26.1", + "mkdocstrings-python ==1.11.1", + "griffe ==1.2.0", "mkdocs-gen-files ==0.5.0", "mkdocs-literate-nav ==0.6.1", "mkdocs-spellcheck[all]", - "mkdocs-gallery ==0.10.1", + "mkdocs-gallery ==0.10.3", "qtgallery ==0.0.2", # extras for all the widgets - "napari ==0.5.0", + "napari ==0.5.3", "pyqt6", "pint", "matplotlib",