Skip to content

Commit 16d42a1

Browse files
Merge pull request #55 from analog-garage/mkdocstrings-python-2
Mkdocstrings python 2
2 parents 5275922 + b471179 commit 16d42a1

File tree

8 files changed

+1515
-1454
lines changed

8 files changed

+1515
-1454
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
*Note that versions roughly correspond to the version of mkdocstrings-python that they
44
are compatible with.*
55

6+
## 2.0.0
7+
8+
* Depends on mkdocstrings-python >=2.0 and mkdocstrings >=1.0
9+
610
## 1.16.5
711

812
* Drop python 3.9 support

docs/config.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ Additional options are added by this extension. Currently, there are three:
3434
default_handler: python_xref
3535
handlers:
3636
python_xref:
37-
import:
38-
- https://docs.python.org/3/objects.inv
39-
- https://pytorch.org/docs/stable/objects.inv
37+
inventories:
38+
- url: https://docs.python.org/3/objects.inv
39+
domains: [std, py]
40+
- url: https://pytorch.org/docs/stable/objects.inv
41+
domains: [py]
4042
options:
4143
relative_crossrefs: yes
4244
```
@@ -49,9 +51,11 @@ Additional options are added by this extension. Currently, there are three:
4951
default_handler: python_xref
5052
handlers:
5153
python_xref:
52-
import:
53-
- https://docs.python.org/3/objects.inv
54-
- https://pytorch.org/docs/stable/objects.inv
54+
inventories:
55+
- url: https://docs.python.org/3/objects.inv
56+
domains: [std, py]
57+
- url: https://pytorch.org/docs/stable/objects.inv
58+
domains: [py]
5559
options:
5660
relative_crossrefs: yes
5761
check_crossrefs_exclude:
@@ -66,9 +70,11 @@ Additional options are added by this extension. Currently, there are three:
6670
default_handler: python_xref
6771
handlers:
6872
python_xref:
69-
import:
70-
- https://docs.python.org/3/objects.inv
71-
- https://pytorch.org/docs/stable/objects.inv
73+
inventories:
74+
- url: https://docs.python.org/3/objects.inv
75+
domains: [std, py]
76+
- url: https://pytorch.org/docs/stable/objects.inv
77+
domains: [py]
7278
options:
7379
relative_crossrefs: yes
7480
check_crossrefs: no

pixi.lock

Lines changed: 1483 additions & 1436 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ keywords = [
2525
dynamic = ["version"]
2626
requires-python = ">=3.10"
2727
dependencies = [
28-
"mkdocstrings-python >=1.16.6,<2.0",
28+
"mkdocstrings-python >=2.0",
29+
"mkdocstrings >=1.0",
2930
"griffe >=1.0",
3031
]
3132

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.16.5
1+
2.0.0

src/mkdocstrings_handlers/python_xref/handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_options(self, local_options: Mapping[str, Any]) -> PythonRelXRefOptions:
7878
)
7979
return opts
8080

81-
def render(self, data: CollectorItem, options: PythonOptions) -> str:
81+
def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
8282
if options.relative_crossrefs:
8383
if isinstance(options, PythonRelXRefOptions) and options.check_crossrefs:
8484
checkref = partial(
@@ -88,7 +88,7 @@ def render(self, data: CollectorItem, options: PythonOptions) -> str:
8888
substitute_relative_crossrefs(data, checkref=checkref)
8989

9090
try:
91-
return super().render(data, options)
91+
return super().render(data, options, locale=locale)
9292
except Exception: # pragma: no cover
9393
print(f"{data.path=}")
9494
raise

tests/test_handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2025. Analog Devices Inc.
1+
# Copyright (c) 2022-2026. Analog Devices Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -58,6 +58,8 @@ def test_handler(tmpdir: PathLike,
5858
Path(tmpdir),
5959
theme = 'material',
6060
custom_templates = 'custom_templates',
61+
mdx = [],
62+
mdx_config= {},
6163
)
6264
assert handler.name == 'python_xref'
6365

@@ -83,7 +85,7 @@ def fake_collect(_self: PythonHandler, identifier: str, _config: dict) -> Any:
8385
return Object(identifier)
8486
raise CollectionError(identifier)
8587

86-
def fake_render(_self: PythonHandler, data: Object, _config: dict) -> str:
88+
def fake_render(_self: PythonHandler, data: Object, _config: dict, locale: str|None = None) -> str:
8789
assert data.docstring is not None
8890
return data.docstring.value
8991

0 commit comments

Comments
 (0)