Skip to content

Commit 93a68d0

Browse files
committed
refactor: Move modules into internal folder, expose API in top-level module
Also synchronize docs (objects inventory) with public API.
1 parent 138562c commit 93a68d0

19 files changed

+299
-132
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
589589

590590
### Breaking changes
591591

592-
- The signature of the [`format_signature` filter](https://mkdocstrings.github.io/python/reference/mkdocstrings_handlers/python/rendering/#mkdocstrings_handlers.python.rendering.do_format_signature) has changed.
592+
- The signature of the [`format_signature` filter][mkdocstrings_handlers.python.do_format_signature] has changed.
593593
If you override templates in your project to customize the output,
594594
make sure to update the following templates so that they use
595595
the new filter signature:

docs/insiders/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@
8181

8282
- Add [cross-references for type annotations in signatures](../usage/configuration/signatures.md#signature_crossrefs).
8383
Make sure to update your local templates as the signature of the
84-
[`format_signature` filter][mkdocstrings_handlers.python.rendering.do_format_signature]
84+
[`format_signature` filter][mkdocstrings_handlers.python.do_format_signature]
8585
has changed. The templates that must be updated:
8686
`class.html`, `expression.html`, `function.html` and `signature.html`.

docs/reference/api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ hide:
55
---
66

77
# ::: mkdocstrings_handlers.python
8+
options:
9+
show_submodules: true

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ plugins:
143143
- autorefs
144144
- markdown-exec
145145
- section-index
146-
- coverage
146+
# - coverage
147147
- mkdocstrings:
148148
handlers:
149149
python:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ maintain = [
8686
"yore>=0.3.3",
8787
]
8888
ci = [
89+
"blacK>=25.1",
8990
"duty>=1.6",
9091
"ruff>=0.4",
9192
"pytest>=8.2",
@@ -108,6 +109,7 @@ ci = [
108109
"mkdocs-material>=9.5",
109110
"pydantic>=2.10",
110111
"mkdocs-minify-plugin>=0.8",
112+
"mkdocs-redirects>=1.2",
111113
"mkdocs-section-index>=0.3",
112114
# YORE: EOL 3.10: Remove line.
113115
"tomli>=2.0; python_version < '3.11'",

scripts/mkdocs_hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
try:
1515
from pydantic import TypeAdapter
1616
except ImportError:
17-
TypeAdapter = None
17+
TypeAdapter = None # type: ignore[assignment,misc]
1818

1919

2020
_logger = get_plugin_logger(__name__)
@@ -38,9 +38,9 @@ class PythonHandlerSchema:
3838
_logger.debug("Generated JSON schema")
3939

4040
autorefs = config["plugins"]["autorefs"]
41-
for field in fields(PythonInputConfig): # type: ignore[arg-type]
41+
for field in fields(PythonInputConfig):
4242
if f"setting-{field.name}" not in autorefs._primary_url_map:
4343
_logger.warning(f"Handler setting `{field.name}` is not documented")
44-
for field in fields(PythonInputOptions): # type: ignore[arg-type]
44+
for field in fields(PythonInputOptions):
4545
if f"option-{field.name}" not in autorefs._primary_url_map:
4646
_logger.warning(f"Configuration option `{field.name}` is not documented")
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,70 @@
11
"""Python handler for mkdocstrings."""
22

33
from mkdocstrings_handlers.python._internal.config import (
4+
AutoStyleOptions,
5+
GoogleStyleOptions,
6+
Inventory,
7+
NumpyStyleOptions,
8+
PerStyleOptions,
49
PythonConfig,
510
PythonInputConfig,
611
PythonInputOptions,
712
PythonOptions,
13+
SphinxStyleOptions,
14+
SummaryOption,
815
)
916
from mkdocstrings_handlers.python._internal.handler import PythonHandler, get_handler
17+
from mkdocstrings_handlers.python._internal.rendering import (
18+
AutorefsHook,
19+
Order,
20+
Tree,
21+
do_as_attributes_section,
22+
do_as_classes_section,
23+
do_as_functions_section,
24+
do_as_modules_section,
25+
do_backlink_tree,
26+
do_crossref,
27+
do_filter_objects,
28+
do_format_attribute,
29+
do_format_code,
30+
do_format_signature,
31+
do_get_template,
32+
do_multi_crossref,
33+
do_order_members,
34+
do_split_path,
35+
do_stash_crossref,
36+
)
1037

1138
__all__ = [
39+
"AutoStyleOptions",
40+
"AutorefsHook",
41+
"GoogleStyleOptions",
42+
"Inventory",
43+
"NumpyStyleOptions",
44+
"Order",
45+
"PerStyleOptions",
1246
"PythonConfig",
1347
"PythonHandler",
1448
"PythonInputConfig",
1549
"PythonInputOptions",
1650
"PythonOptions",
51+
"SphinxStyleOptions",
52+
"SummaryOption",
53+
"Tree",
54+
"do_as_attributes_section",
55+
"do_as_classes_section",
56+
"do_as_functions_section",
57+
"do_as_modules_section",
58+
"do_backlink_tree",
59+
"do_crossref",
60+
"do_filter_objects",
61+
"do_format_attribute",
62+
"do_format_code",
63+
"do_format_signature",
64+
"do_get_template",
65+
"do_multi_crossref",
66+
"do_order_members",
67+
"do_split_path",
68+
"do_stash_crossref",
1769
"get_handler",
1870
]

0 commit comments

Comments
 (0)