Skip to content

Commit de3214e

Browse files
chore(deps)!: update dependency mkdocstrings to v1 (#138)
* chore(deps): update dependency mkdocstrings to v1 * docs(deps): update dependency mkdocstrings-python to v2 (#139) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix tests --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: watermarkhu <watermarkhu@gmail.com>
1 parent 95e8185 commit de3214e

18 files changed

Lines changed: 117 additions & 133 deletions

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@ repos:
1616
- id: uv
1717
name: uv-lock
1818
entry: uv lock
19-
language: python
19+
language: system
2020
files: ^(uv\.lock|pyproject\.toml|uv\.toml)$
2121
pass_filenames: false
2222
- id: ruff-check
2323
name: ruff check
2424
entry: uv run ruff check --fix --exit-non-zero-on-fix
25-
language: python
25+
language: system
2626
types_or: [python, pyi, jupyter]
2727
- id: ruff-format
2828
name: ruff format
2929
entry: uv run ruff format --force-exclude
30-
language: python
30+
language: system
3131
types_or: [python, pyi, jupyter]
3232
- id: ty
3333
name: ty check
34-
entry: uv run ty check . --ignore unresolved-import
35-
language: python
34+
entry: uv run ty check
35+
language: system
3636
types_or: [python, pyi, jupyter]
37+
pass_filenames: false

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classifiers = [
2929
dependencies = [
3030
"griffe~=1.15.0",
3131
"maxx~=0.6.0",
32-
"mkdocstrings~=0.29",
32+
"mkdocstrings~=1.0",
3333
"mkdocs-autorefs~=1.4",
3434
"charset-normalizer~=3.4",
3535
"typing-extensions>=4.0; python_version < '3.11'",
@@ -40,8 +40,8 @@ pygments = { git = "https://github.com/watermarkhu/pygments", branch = "matlab"
4040

4141
[dependency-groups]
4242
dev = [
43-
"ty~=0.0.1a24",
44-
"prek>=0.2.1",
43+
"ty~=0.0.1a29",
44+
"prek>=0.2.19",
4545
"ruff~=0.14.0",
4646
"pydantic~=2.10",
4747
"pytest~=9.0.0",
@@ -53,7 +53,7 @@ dev = [
5353
docs = [
5454
"pygments",
5555
"mkdocs-material~=9.5",
56-
"mkdocstrings-python~=1.16",
56+
"mkdocstrings-python~=2.0",
5757
"markdown-exec~=1.10",
5858
"mkdocs-callouts~=1.15",
5959
"mkdocs-git-revision-date-localized-plugin~=1.3",

src/mkdocstrings_handlers/matlab/handler.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
from mkdocstrings_handlers.matlab.config import MatlabConfig, MatlabOptions
2323

2424
if TYPE_CHECKING:
25-
from collections.abc import Mapping, MutableMapping
25+
from collections.abc import Mapping, MutableMapping, Sequence
2626

27+
from markdown.core import Extension
2728
from mkdocs.config.defaults import MkDocsConfig
2829

2930

@@ -49,20 +50,29 @@ def __init__(
4950
self,
5051
config: MatlabConfig,
5152
base_dir: Path,
52-
**kwargs: Any,
53+
*,
54+
theme: str,
55+
custom_templates: str | None,
56+
mdx: Sequence[str | Extension],
57+
mdx_config: Mapping[str, Any],
5358
) -> None:
5459
"""
5560
Initialize the handler with the given configuration.
5661
5762
Args:
5863
config: The handler configuration.
5964
base_dir: The base directory of the project.
60-
**kwargs: Arguments passed to the parent constructor.
65+
theme: The theme name.
66+
custom_templates: The path to custom templates.
67+
mdx: The markdown extensions.
68+
mdx_config: The markdown extensions configuration.
6169
6270
Returns:
6371
None
6472
"""
65-
super().__init__(**kwargs)
73+
super().__init__(
74+
theme=theme, custom_templates=custom_templates, mdx=mdx, mdx_config=mdx_config
75+
)
6676

6777
self.config = config
6878
self.base_dir = base_dir
@@ -118,12 +128,15 @@ def get_options(self, local_options: Mapping[str, Any]) -> HandlerOptions:
118128
except Exception as error:
119129
raise PluginError(f"Invalid options: {error}") from error
120130

121-
def render(self, data: CollectorItem, options: MatlabOptions) -> str:
131+
def render(
132+
self, data: CollectorItem, options: MatlabOptions, *, locale: str | None = None
133+
) -> str:
122134
"""Render a template using provided data and configuration options.
123135
124136
Arguments:
125137
data: The collected data to render.
126138
options: The handler's configuration options.
139+
locale: The locale to use for rendering.
127140
128141
Returns:
129142
The rendered template as HTML.
@@ -250,14 +263,22 @@ def collect(self, identifier: str, options: MatlabOptions) -> CollectorItem:
250263
def get_handler(
251264
handler_config: MutableMapping[str, Any],
252265
tool_config: MkDocsConfig,
253-
**kwargs: Any,
266+
*,
267+
theme: str,
268+
custom_templates: str | None,
269+
mdx: Sequence[str | Extension],
270+
mdx_config: Mapping[str, Any],
254271
) -> MatlabHandler:
255272
"""
256273
Create and return a MatlabHandler object with the specified configuration.
257274
258275
Parameters:
259276
handler_config: The handler configuration.
260277
tool_config: The tool (SSG) configuration.
278+
theme: The theme name.
279+
custom_templates: The path to custom templates.
280+
mdx: The markdown extensions.
281+
mdx_config: The markdown extensions configuration.
261282
262283
Returns:
263284
MatlabHandler: An instance of MatlabHandler configured with the provided parameters.
@@ -266,5 +287,8 @@ def get_handler(
266287
return MatlabHandler(
267288
config=MatlabConfig.from_data(**handler_config),
268289
base_dir=base_dir,
269-
**kwargs,
290+
theme=theme,
291+
custom_templates=custom_templates,
292+
mdx=mdx,
293+
mdx_config=mdx_config,
270294
)

test/snapshots/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"d3f96b8d107b*.html"
1414
),
1515
(("identifier", "moduleClass"), ("show_signature", True)): external(
16-
"hash:7589cda3f729*.html"
16+
"hash:68451e56ce74*.html"
1717
),
1818
(("identifier", "moduleClass"), ("show_signature", False)): external(
19-
"hash:0dc4897f65cf*.html"
19+
"hash:5acfc3eedd00*.html"
2020
),
2121
(("identifier", "classFolder"), ("show_signature", True)): external(
2222
"hash:9bdbcd111c2c*.html"
@@ -136,16 +136,16 @@
136136
toc = snapshot(
137137
{
138138
(("show_root_toc_entry", False), ("show_symbol_type_toc", True)): external(
139-
"hash:6bb20bf794a2*.html"
139+
"hash:9b5a15218c31*.html"
140140
),
141141
(("show_root_toc_entry", False), ("show_symbol_type_toc", False)): external(
142-
"hash:3367387c10a2*.html"
142+
"hash:71339ee76f9e*.html"
143143
),
144144
(("show_root_toc_entry", True), ("show_symbol_type_toc", False)): external(
145-
"hash:125feda15b39*.html"
145+
"hash:74eb21fdba3a*.html"
146146
),
147147
(("show_root_toc_entry", True), ("show_symbol_type_toc", True)): external(
148-
"hash:b3e1bbeb809f*.html"
148+
"hash:b618c3718ad2*.html"
149149
),
150150
}
151151
)
@@ -188,9 +188,9 @@
188188
("filters", ("!method1",)),
189189
("members", True),
190190
("members_order", "alphabetical"),
191-
): external("hash:1f4d5eacc78f*.html"),
191+
): external("hash:e68be806ffd1*.html"),
192192
(("filters", ("!method1",)), ("members", True), ("members_order", "source")): external(
193-
"hash:7f035d40c198*.html"
193+
"hash:3e0166bf4fd7*.html"
194194
),
195195
(
196196
("filters", ("method*",)),
@@ -203,10 +203,10 @@
203203
("members_order", "source"),
204204
): external("hash:2b014ab43c87*.html"),
205205
(("filters", ("method*",)), ("members", True), ("members_order", "alphabetical")): external(
206-
"hash:abe379fb91f0*.html"
206+
"hash:a45057cfa203*.html"
207207
),
208208
(("filters", ("method*",)), ("members", True), ("members_order", "source")): external(
209-
"hash:568c966787a0*.html"
209+
"hash:6e562da31069*.html"
210210
),
211211
(
212212
("filters", False),
@@ -217,10 +217,10 @@
217217
"hash:01ca7e807eab*.html"
218218
),
219219
(("filters", False), ("members", True), ("members_order", "alphabetical")): external(
220-
"hash:cd9476a4d9e9*.html"
220+
"hash:915eb842f027*.html"
221221
),
222222
(("filters", False), ("members", True), ("members_order", "source")): external(
223-
"hash:7130f7ac88be*.html"
223+
"hash:c3408e739dfb*.html"
224224
),
225225
}
226226
)

test/snapshots/external/7f035d40c198a273da851a00db129f9ddba503f1903f26b06c35cc1406b99091.html renamed to test/snapshots/external/3e0166bf4fd7b2cc56fb3acabbd3412589e84f85f3a8d7fd977efc36369f48ed.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ <h2 class="doc doc-heading" id="moduleClass.instance_property">
4848
</code>
4949
</h2>
5050
<div class="doc doc-contents">
51-
<p>
52-
Docstring for moduleClass.instance_property.
53-
</p>
51+
</div>
52+
</div>
53+
<div class="doc doc-object doc-property">
54+
<h2 class="doc doc-heading" id="moduleClass.">
55+
<code class="highlight language-python">
56+
</code>
57+
</h2>
58+
<div class="doc doc-contents">
5459
</div>
5560
</div>
5661
<div class="doc doc-object doc-function">

test/snapshots/external/0dc4897f65cf3ad9d09efdd62887e6216d6c644a1bc155ebc90b10ec8c9bf199.html renamed to test/snapshots/external/5acfc3eedd004913b7230922b4ee09d2040ce30ad1f8da2f4a53d47e00b8db82.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ <h2 class="doc doc-heading" id="moduleClass.class_property">
3636
</p>
3737
</div>
3838
</div>
39-
<div class="doc doc-object doc-property">
40-
<h2 class="doc doc-heading" id="moduleClass.instance_property">
41-
<code class="highlight language-python">
42-
<span class="n">
43-
instance_property
44-
</span>
45-
</code>
46-
</h2>
47-
<div class="doc doc-contents">
48-
<p>
49-
Docstring for moduleClass.instance_property.
50-
</p>
51-
</div>
52-
</div>
5339
<div class="doc doc-object doc-function">
5440
<h2 class="doc doc-heading" id="moduleClass.method1">
5541
<code class="highlight language-matlab">

test/snapshots/external/7589cda3f7292466252ef8f5a337d2d4e1903d49f78ecd5f0c9cf1025a97cbcb.html renamed to test/snapshots/external/68451e56ce74d8d07beb35faf582b2466ade51c922c744405812c234850f7791.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ <h2 class="doc doc-heading" id="moduleClass.class_property">
3636
</p>
3737
</div>
3838
</div>
39-
<div class="doc doc-object doc-property">
40-
<h2 class="doc doc-heading" id="moduleClass.instance_property">
41-
<code class="highlight language-python">
42-
<span class="n">
43-
instance_property
44-
</span>
45-
</code>
46-
</h2>
47-
<div class="doc doc-contents">
48-
<p>
49-
Docstring for moduleClass.instance_property.
50-
</p>
51-
</div>
52-
</div>
5339
<div class="doc doc-object doc-function">
5440
<h2 class="doc doc-heading" id="moduleClass.method1">
5541
<code class="highlight language-matlab">

test/snapshots/external/568c966787a03fb6c613c965b40b19765ec29b5278d4516151a77ac89129018e.html renamed to test/snapshots/external/6e562da310695140c81f1c7a8486e7f7863c8809c6efc3ce7390e5709fea64db.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ <h2 class="doc doc-heading" id="moduleClass.instance_property">
4848
</code>
4949
</h2>
5050
<div class="doc doc-contents">
51-
<p>
52-
Docstring for moduleClass.instance_property.
53-
</p>
51+
</div>
52+
</div>
53+
<div class="doc doc-object doc-property">
54+
<h2 class="doc doc-heading" id="moduleClass.">
55+
<code class="highlight language-python">
56+
</code>
57+
</h2>
58+
<div class="doc doc-contents">
5459
</div>
5560
</div>
5661
<div class="doc doc-object doc-function">

test/snapshots/external/3367387c10a2afe5eec4422034ecb5255d164f6d4f704f0c2c32349b3df8947b.html renamed to test/snapshots/external/71339ee76f9ec823cce50eadcf943e077622640fa59311cd9164b71b0f58da70.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ <h3 class="doc doc-heading" id="moduleClass.class_property">
7575
</p>
7676
</div>
7777
</div>
78-
<div class="doc doc-object doc-property">
79-
<h3 class="doc doc-heading" id="moduleClass.instance_property">
80-
<code class="highlight language-python">
81-
<span class="n">
82-
instance_property
83-
</span>
84-
</code>
85-
</h3>
86-
<div class="doc doc-contents">
87-
<p>
88-
Docstring for moduleClass.instance_property.
89-
</p>
90-
</div>
91-
</div>
9278
<div class="doc doc-object doc-function">
9379
<h3 class="doc doc-heading" id="moduleClass.method1">
9480
<code class="highlight language-matlab">

test/snapshots/external/125feda15b39325f9a0e8ad332d7e0989cb2fb05626be3137d54a76fe60b6be2.html renamed to test/snapshots/external/74eb21fdba3a5a15e2c9b54db7bde594f78a01b6c09deb9f76c17e736e3b243b.html

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ <h3 class="doc doc-heading" id="moduleClass.class_property">
7575
</p>
7676
</div>
7777
</div>
78-
<div class="doc doc-object doc-property">
79-
<h3 class="doc doc-heading" id="moduleClass.instance_property">
80-
<code class="highlight language-python">
81-
<span class="n">
82-
instance_property
83-
</span>
84-
</code>
85-
</h3>
86-
<div class="doc doc-contents">
87-
<p>
88-
Docstring for moduleClass.instance_property.
89-
</p>
90-
</div>
91-
</div>
9278
<div class="doc doc-object doc-function">
9379
<h3 class="doc doc-heading" id="moduleClass.method1">
9480
<code class="highlight language-matlab">

0 commit comments

Comments
 (0)