Skip to content

Commit

Permalink
docs: fix docs build (#670)
Browse files Browse the repository at this point in the history
* docs: fix docs build

* remove unused
  • Loading branch information
tlambert03 authored Sep 10, 2024
1 parent 6a39adf commit 058d63c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
20 changes: 3 additions & 17 deletions docs/scripts/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 058d63c

Please sign in to comment.