mkdocstrings-python-xref 1.6.0.1__tar.gz → 1.6.2__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.
- {mkdocstrings_python_xref-1.6.0.1 → mkdocstrings_python_xref-1.6.2}/PKG-INFO +3 -2
- mkdocstrings_python_xref-1.6.2/mkdocstrings_handlers/python_xref/VERSION +1 -0
- {mkdocstrings_python_xref-1.6.0.1/src → mkdocstrings_python_xref-1.6.2}/mkdocstrings_handlers/python_xref/crossref.py +8 -11
- {mkdocstrings_python_xref-1.6.0.1/src → mkdocstrings_python_xref-1.6.2}/mkdocstrings_handlers/python_xref/handler.py +1 -1
- {mkdocstrings_python_xref-1.6.0.1 → mkdocstrings_python_xref-1.6.2}/pyproject.toml +67 -6
- mkdocstrings_python_xref-1.6.0.1/src/mkdocstrings_handlers/python_xref/VERSION +0 -1
- {mkdocstrings_python_xref-1.6.0.1 → mkdocstrings_python_xref-1.6.2}/.gitignore +0 -0
- {mkdocstrings_python_xref-1.6.0.1 → mkdocstrings_python_xref-1.6.2}/LICENSE.md +0 -0
- {mkdocstrings_python_xref-1.6.0.1 → mkdocstrings_python_xref-1.6.2}/README.md +0 -0
- {mkdocstrings_python_xref-1.6.0.1/src → mkdocstrings_python_xref-1.6.2}/mkdocstrings_handlers/python_xref/__init__.py +0 -0
- {mkdocstrings_python_xref-1.6.0.1/src → mkdocstrings_python_xref-1.6.2}/mkdocstrings_handlers/python_xref/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: mkdocstrings-python-xref
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.2
|
|
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/
|
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Topic :: Software Development :: Documentation
|
|
18
18
|
Requires-Python: >=3.8
|
|
19
|
+
Requires-Dist: griffe>=1.0
|
|
19
20
|
Requires-Dist: mkdocstrings-python<2.0,>=1.6.2
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.6.2
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2022-
|
|
1
|
+
# Copyright (c) 2022-2024. 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.
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
from __future__ import annotations
|
|
17
17
|
|
|
18
18
|
import re
|
|
19
|
-
import sys
|
|
20
19
|
from typing import Callable, List, Optional, cast
|
|
21
20
|
|
|
22
|
-
from griffe
|
|
21
|
+
from griffe import Docstring, Object
|
|
23
22
|
from mkdocstrings.loggers import get_logger
|
|
24
23
|
|
|
25
24
|
__all__ = [
|
|
@@ -28,9 +27,6 @@ __all__ = [
|
|
|
28
27
|
|
|
29
28
|
logger = get_logger(__name__)
|
|
30
29
|
|
|
31
|
-
# line numbers from griffe are not reliable before python 3.8; this may eventually be fixed...
|
|
32
|
-
_supports_linenums = sys.version_info >= (3,8)
|
|
33
|
-
|
|
34
30
|
def _re_or(*exps: str) -> str:
|
|
35
31
|
"""Construct an "or" regular expression from a sequence of regular expressions.
|
|
36
32
|
|
|
@@ -150,6 +146,8 @@ class _RelativeCrossrefProcessor:
|
|
|
150
146
|
|
|
151
147
|
new_ref = ""
|
|
152
148
|
|
|
149
|
+
# TODO support special syntax to turn off checking
|
|
150
|
+
|
|
153
151
|
if not _RE_REL_CROSSREF.fullmatch(match.group(0)):
|
|
154
152
|
# Just a regular cross reference
|
|
155
153
|
new_ref = ref if ref else title
|
|
@@ -307,10 +305,9 @@ class _RelativeCrossrefProcessor:
|
|
|
307
305
|
prefix = f"file://{parent.filepath}:"
|
|
308
306
|
line = doc.lineno
|
|
309
307
|
if line is not None: # pragma: no branch
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
line += doc.value.count("\n", 0, self._cur_offset)
|
|
308
|
+
# Add line offset to match in docstring. This can still be
|
|
309
|
+
# short if the doc string has leading newlines.
|
|
310
|
+
line += doc.value.count("\n", 0, self._cur_offset)
|
|
314
311
|
prefix += f"{line}:"
|
|
315
312
|
# It would be nice to add the column as well, but we cannot determine
|
|
316
313
|
# that without knowing how much the doc string was unindented.
|
|
@@ -325,7 +322,7 @@ def substitute_relative_crossrefs(obj: Object, checkref: Optional[Callable[[str]
|
|
|
325
322
|
"""Recursively expand relative cross-references in all docstrings in tree.
|
|
326
323
|
|
|
327
324
|
Arguments:
|
|
328
|
-
obj: a Griffe [Object][griffe.
|
|
325
|
+
obj: a Griffe [Object][griffe.] whose docstrings should be modified
|
|
329
326
|
checkref: optional function to check whether computed cross-reference is valid.
|
|
330
327
|
Should return True if valid, False if not valid.
|
|
331
328
|
"""
|
|
@@ -21,7 +21,7 @@ from collections import ChainMap
|
|
|
21
21
|
from pathlib import Path
|
|
22
22
|
from typing import Any, List, Mapping, Optional
|
|
23
23
|
|
|
24
|
-
from griffe
|
|
24
|
+
from griffe import Object
|
|
25
25
|
from mkdocstrings.loggers import get_logger
|
|
26
26
|
from mkdocstrings_handlers.python.handler import PythonHandler
|
|
27
27
|
|
|
@@ -25,7 +25,8 @@ keywords = [
|
|
|
25
25
|
dynamic = ["version"]
|
|
26
26
|
requires-python = ">=3.8"
|
|
27
27
|
dependencies = [
|
|
28
|
-
"mkdocstrings-python >=1.6.2,<2.0"
|
|
28
|
+
"mkdocstrings-python >=1.6.2,<2.0",
|
|
29
|
+
"griffe >=1.0"
|
|
29
30
|
]
|
|
30
31
|
|
|
31
32
|
[project.urls]
|
|
@@ -43,11 +44,11 @@ include = [
|
|
|
43
44
|
"src/mkdocstrings_handlers/python_xref/py.typed",
|
|
44
45
|
]
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
[tool.hatch.build.targets.sdist]
|
|
48
|
+
packages = [
|
|
49
|
+
"src/mkdocstrings_handlers",
|
|
50
|
+
"src/mkdocstrings_handlers/python_xref",
|
|
51
|
+
]
|
|
51
52
|
|
|
52
53
|
[tool.hatch.build.targets.wheel]
|
|
53
54
|
packages = [
|
|
@@ -74,6 +75,66 @@ module = [
|
|
|
74
75
|
]
|
|
75
76
|
ignore_missing_imports = true
|
|
76
77
|
|
|
78
|
+
[tool.ruff.lint]
|
|
79
|
+
# TODO add "I" (isort)
|
|
80
|
+
# TODO add "RUF"
|
|
81
|
+
# TODO add "ARG"
|
|
82
|
+
# TODO add "SIM"
|
|
83
|
+
# TODO add "S" (bandit)
|
|
84
|
+
# TODO add "PT" (pytest style)
|
|
85
|
+
# TODO add "CPY101"
|
|
86
|
+
select = ["E", "F", "PL", "D", "R", "T10", "EXE"]
|
|
87
|
+
ignore = [
|
|
88
|
+
"D105", # missing doc string for dunder methods
|
|
89
|
+
"D200", # one line doc string
|
|
90
|
+
"D202", # blank lines after function docstring
|
|
91
|
+
"D205", # doc on first line
|
|
92
|
+
"D212", # doc on first line
|
|
93
|
+
"D410", # blank line after doc section
|
|
94
|
+
"D411", # blank line before doc section
|
|
95
|
+
"D412", # no blank lines after section header
|
|
96
|
+
"D415", # doc title punctuation
|
|
97
|
+
"E501", # line too long
|
|
98
|
+
"PLC0105", # covariant metatype names
|
|
99
|
+
"PLR0913", # too-many-argument
|
|
100
|
+
"PLR2004", # magic value
|
|
101
|
+
"PT001", # allow @pytest.fixture without parens
|
|
102
|
+
"RET504", # unnecessary assignment to variable before return
|
|
103
|
+
"S101", # use of assert - do we care?
|
|
104
|
+
# TODO: fix the ones below
|
|
105
|
+
"D403", # capitalize first word of doc string
|
|
106
|
+
"D102", # undocumented public method
|
|
107
|
+
"D104", # missing docstring in public package
|
|
108
|
+
"D107", # __init__ docstring
|
|
109
|
+
"D417", # missing argument description
|
|
110
|
+
]
|
|
111
|
+
preview = true
|
|
112
|
+
explicit-preview-rules = true # only preview explicitly selected rules (E.g. CPY001)
|
|
113
|
+
|
|
114
|
+
[tool.ruff.lint.per-file-ignores]
|
|
115
|
+
# Ignore some issues in tests
|
|
116
|
+
"tests/**" = [
|
|
117
|
+
"F401", # unused import (pytest fixture)
|
|
118
|
+
"F403", # wildcard import (for fixtures)
|
|
119
|
+
"F405", # defined from star imports (typicallky a pytest fixture)
|
|
120
|
+
"F811", # redefinition of unused (typically a pytest fixture)
|
|
121
|
+
"PLR0912", # too many branches
|
|
122
|
+
"PLR0915", # too many statements
|
|
123
|
+
"S", # bandit rules
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.ruff.lint.pylint]
|
|
127
|
+
#max-locals = 30
|
|
128
|
+
max-branches = 15
|
|
129
|
+
#max-attributes = 30
|
|
130
|
+
|
|
131
|
+
[tool.ruff.lint.pydocstyle]
|
|
132
|
+
convention = "google"
|
|
133
|
+
|
|
134
|
+
[too.ruff.format]
|
|
135
|
+
skip-magic-trailing-comma = false
|
|
136
|
+
line-ending = "lf"
|
|
137
|
+
|
|
77
138
|
[tool.pylint.main]
|
|
78
139
|
jobs = 0
|
|
79
140
|
# Minimum Python version to use for version dependent checks.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.6.0.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|