Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*Note that versions roughly correspond to the version of mkdocstrings-python that they
are compatible with.*

## 2.0.0

* Depends on mkdocstrings-python >=2.0 and mkdocstrings >=1.0

## 1.16.5

* Drop python 3.9 support
Expand Down
24 changes: 15 additions & 9 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ Additional options are added by this extension. Currently, there are three:
default_handler: python_xref
handlers:
python_xref:
import:
- https://docs.python.org/3/objects.inv
- https://pytorch.org/docs/stable/objects.inv
inventories:
- url: https://docs.python.org/3/objects.inv
domains: [std, py]
- url: https://pytorch.org/docs/stable/objects.inv
domains: [py]
options:
relative_crossrefs: yes
```
Expand All @@ -49,9 +51,11 @@ Additional options are added by this extension. Currently, there are three:
default_handler: python_xref
handlers:
python_xref:
import:
- https://docs.python.org/3/objects.inv
- https://pytorch.org/docs/stable/objects.inv
inventories:
- url: https://docs.python.org/3/objects.inv
domains: [std, py]
- url: https://pytorch.org/docs/stable/objects.inv
domains: [py]
options:
relative_crossrefs: yes
check_crossrefs_exclude:
Expand All @@ -66,9 +70,11 @@ Additional options are added by this extension. Currently, there are three:
default_handler: python_xref
handlers:
python_xref:
import:
- https://docs.python.org/3/objects.inv
- https://pytorch.org/docs/stable/objects.inv
inventories:
- url: https://docs.python.org/3/objects.inv
domains: [std, py]
- url: https://pytorch.org/docs/stable/objects.inv
domains: [py]
options:
relative_crossrefs: yes
check_crossrefs: no
Expand Down
2,919 changes: 1,483 additions & 1,436 deletions pixi.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ keywords = [
dynamic = ["version"]
requires-python = ">=3.10"
dependencies = [
"mkdocstrings-python >=1.16.6,<2.0",
"mkdocstrings-python >=2.0",
"mkdocstrings >=1.0",
"griffe >=1.0",
]

Expand Down
2 changes: 1 addition & 1 deletion src/mkdocstrings_handlers/python_xref/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.5
2.0.0
4 changes: 2 additions & 2 deletions src/mkdocstrings_handlers/python_xref/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_options(self, local_options: Mapping[str, Any]) -> PythonRelXRefOptions:
)
return opts

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

try:
return super().render(data, options)
return super().render(data, options, locale=locale)
except Exception: # pragma: no cover
print(f"{data.path=}")
raise
Expand Down
6 changes: 4 additions & 2 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2025. Analog Devices Inc.
# Copyright (c) 2022-2026. Analog Devices Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,8 @@ def test_handler(tmpdir: PathLike,
Path(tmpdir),
theme = 'material',
custom_templates = 'custom_templates',
mdx = [],
mdx_config= {},
)
assert handler.name == 'python_xref'

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

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

Expand Down