mkdocstrings-python-xref 1.16.4__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-python-xref
3
- Version: 1.16.4
3
+ Version: 2.0.0
4
4
  Summary: Enhanced mkdocstrings python handler
5
5
  Project-URL: Repository, https://github.com/analog-garage/mkdocstrings-python-xref
6
6
  Project-URL: Documentation, https://analog-garage.github.io/mkdocstrings-python-xref/
@@ -9,15 +9,16 @@ License-File: LICENSE.md
9
9
  Keywords: documentation-tool,mkdocstrings,mkdocstrings-handler,python
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
16
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
17
  Classifier: Topic :: Software Development :: Documentation
18
- Requires-Python: >=3.9
18
+ Requires-Python: >=3.10
19
19
  Requires-Dist: griffe>=1.0
20
- Requires-Dist: mkdocstrings-python<2.0,>=1.16.6
20
+ Requires-Dist: mkdocstrings-python>=2.0
21
+ Requires-Dist: mkdocstrings>=1.0
21
22
  Provides-Extra: dev
22
23
  Requires-Dist: beautifulsoup4>=4.12; extra == 'dev'
23
24
  Requires-Dist: black>=23.12; extra == 'dev'
@@ -29,9 +30,11 @@ Requires-Dist: mike>=1.1; extra == 'dev'
29
30
  Requires-Dist: mkdocs-material>=9.5.4; extra == 'dev'
30
31
  Requires-Dist: mkdocs<2.0,>=1.5.3; extra == 'dev'
31
32
  Requires-Dist: mypy>=1.10; extra == 'dev'
33
+ Requires-Dist: pip>=25.0; extra == 'dev'
32
34
  Requires-Dist: pytest-cov>=5.0; extra == 'dev'
33
35
  Requires-Dist: pytest>=8.2; extra == 'dev'
34
36
  Requires-Dist: ruff>=0.4.10; extra == 'dev'
37
+ Requires-Dist: whl2conda>=25.3; extra == 'dev'
35
38
  Description-Content-Type: text/markdown
36
39
 
37
40
  # mkdocstrings-python-xref
@@ -13,19 +13,20 @@ classifiers = [
13
13
  "Development Status :: 5 - Production/Stable",
14
14
  "Intended Audience :: Developers",
15
15
  "Topic :: Software Development :: Documentation",
16
- "Programming Language :: Python :: 3.9",
17
16
  "Programming Language :: Python :: 3.10",
18
17
  "Programming Language :: Python :: 3.11",
19
18
  "Programming Language :: Python :: 3.12",
20
19
  "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
21
  ]
22
22
  keywords = [
23
23
  "documentation-tool", "mkdocstrings", "mkdocstrings-handler", "python"
24
24
  ]
25
25
  dynamic = ["version"]
26
- requires-python = ">=3.9"
26
+ requires-python = ">=3.10"
27
27
  dependencies = [
28
- "mkdocstrings-python >=1.16.6,<2.0",
28
+ "mkdocstrings-python >=2.0",
29
+ "mkdocstrings >=1.0",
29
30
  "griffe >=1.0",
30
31
  ]
31
32
 
@@ -36,7 +37,9 @@ Documentation = "https://analog-garage.github.io/mkdocstrings-python-xref/"
36
37
  [project.optional-dependencies]
37
38
  dev = [
38
39
  "build >=1.0.0", # python-build on conda
40
+ "pip >=25.0",
39
41
  "hatchling >=1.21",
42
+ "whl2conda >=25.3",
40
43
  "coverage >=7.4.0",
41
44
  "pytest >=8.2",
42
45
  "pytest-cov >=5.0",
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2022-2025. Analog Devices Inc.
1
+ # Copyright (c) 2022-2026. Analog Devices Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -17,8 +17,7 @@ from __future__ import annotations
17
17
 
18
18
  import ast
19
19
  import re
20
- import sys
21
- from typing import Any, Callable, List, Optional, cast
20
+ from typing import Callable, List, Optional, cast
22
21
 
23
22
  from griffe import Alias, Docstring, GriffeError, Object
24
23
  from mkdocstrings import get_logger
@@ -365,7 +364,7 @@ def doc_value_offset_to_location(doc: Docstring, offset: int) -> tuple[int,int]:
365
364
  try:
366
365
  source = doc.source
367
366
  # compute docstring without cleaning up spaces and indentation
368
- rawvalue = str(safe_eval(source))
367
+ rawvalue = str(ast.literal_eval(source))
369
368
 
370
369
  # adjust line offset by number of lines removed from front of docstring
371
370
  lineoffset += leading_space(rawvalue).count("\n")
@@ -401,12 +400,4 @@ def leading_space(s: str) -> str:
401
400
  return m[0]
402
401
  return "" # pragma: no cover
403
402
 
404
- if sys.version_info < (3, 10) or True:
405
- # TODO: remove when 3.9 support is dropped
406
- # In 3.9, literal_eval cannot handle comments in input
407
- def safe_eval(s: str) -> Any:
408
- """Safely evaluate a string expression."""
409
- return eval(s) #eval(s, dict(__builtins__={}), {})
410
- else:
411
- save_eval = ast.literal_eval
412
403
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2022-2025. Analog Devices Inc.
1
+ # Copyright (c) 2022-2026. Analog Devices Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ Implementation of python_xref handler
18
18
  from __future__ import annotations
19
19
 
20
20
  import re
21
- import sys
22
21
  from dataclasses import dataclass, field, fields
23
22
  from functools import partial
24
23
  from pathlib import Path
@@ -37,12 +36,7 @@ __all__ = [
37
36
 
38
37
  logger = get_logger(__name__)
39
38
 
40
- # TODO python 3.9 - remove when 3.9 support is dropped
41
- _dataclass_options = {"frozen": True}
42
- if sys.version_info >= (3, 10):
43
- _dataclass_options["kw_only"] = True
44
-
45
- @dataclass(**_dataclass_options)
39
+ @dataclass(frozen=True, kw_only=True)
46
40
  class PythonRelXRefOptions(PythonOptions):
47
41
  check_crossrefs: bool = True
48
42
  check_crossrefs_exclude: list[str | re.Pattern] = field(default_factory=list)
@@ -84,7 +78,7 @@ class PythonRelXRefHandler(PythonHandler):
84
78
  )
85
79
  return opts
86
80
 
87
- def render(self, data: CollectorItem, options: PythonOptions) -> str:
81
+ def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
88
82
  if options.relative_crossrefs:
89
83
  if isinstance(options, PythonRelXRefOptions) and options.check_crossrefs:
90
84
  checkref = partial(
@@ -94,7 +88,7 @@ class PythonRelXRefHandler(PythonHandler):
94
88
  substitute_relative_crossrefs(data, checkref=checkref)
95
89
 
96
90
  try:
97
- return super().render(data, options)
91
+ return super().render(data, options, locale=locale)
98
92
  except Exception: # pragma: no cover
99
93
  print(f"{data.path=}")
100
94
  raise