python ¤
Python handler for mkdocstrings.
Modules:
-
config–Deprecated. Import from
mkdocstrings_handlers.pythondirectly. -
handler–Deprecated. Import from
mkdocstrings_handlers.pythondirectly. -
rendering–Deprecated. Import from
mkdocstrings_handlers.pythondirectly.
Classes:
-
AutoStyleOptions–Auto style docstring options.
-
AutorefsHook–Autorefs hook.
-
GoogleStyleOptions–Google style docstring options.
-
Inventory–An inventory.
-
NumpyStyleOptions–Numpy style docstring options.
-
PerStyleOptions–Per style options.
-
PythonConfig–Python handler configuration.
-
PythonHandler–The Python handler class.
-
PythonInputConfig–Python handler configuration.
-
PythonInputOptions–Accepted input options.
-
PythonOptions–Final options passed as template context.
-
SphinxStyleOptions–Sphinx style docstring options.
-
SummaryOption–Summary option.
Functions:
-
do_as_attributes_section–Build an attributes section from a list of attributes.
-
do_as_classes_section–Build a classes section from a list of classes.
-
do_as_functions_section–Build a functions section from a list of functions.
-
do_as_modules_section–Build a modules section from a list of modules.
-
do_as_type_aliases_section–Build a type aliases section from a list of type aliases.
-
do_backlink_tree–Build a tree of backlinks.
-
do_crossref–Deprecated. Filter to create cross-references.
-
do_filter_objects–Filter a dictionary of objects based on their docstrings.
-
do_format_attribute–Format an attribute.
-
do_format_code–Format code.
-
do_format_signature–Format a signature.
-
do_format_type_alias–Format a type alias.
-
do_get_template–Get the template name used to render an object.
-
do_multi_crossref–Deprecated. Filter to create cross-references.
-
do_order_members–Order members given an ordering method.
-
do_split_path–Split object paths for building cross-references.
-
get_handler–Return an instance of
PythonHandler.
Attributes:
-
Order–Ordering methods.
-
Tree–A tree type. Each node holds a tuple of items.
-
do_stash_crossref–Filter to stash cross-references (and restore them after formatting and highlighting).
Order module-attribute ¤
Order = Literal['__all__', 'alphabetical', 'source']
Ordering methods.
__all__: order members according to__all__module attributes, if declared;alphabetical: order members alphabetically;source: order members as they appear in the source file.
Tree module-attribute ¤
A tree type. Each node holds a tuple of items.
do_stash_crossref module-attribute ¤
do_stash_crossref = _StashCrossRefFilter()
Filter to stash cross-references (and restore them after formatting and highlighting).
AutoStyleOptions dataclass ¤
AutoStyleOptions(
*,
method: Literal["heuristics", "max_sections"] = "heuristics",
style_order: list[str] = (lambda: ["sphinx", "google", "numpy"])(),
default: str | None = None,
per_style_options: PerStyleOptions = PerStyleOptions()
)
Auto style docstring options.
Methods:
-
from_data–Create an instance from a dictionary.
Attributes:
-
default(str | None) –The default docstring style to use if no other style is detected.
-
method(Literal['heuristics', 'max_sections']) –The method to use to determine the docstring style.
-
per_style_options(PerStyleOptions) –Per-style options.
-
style_order(list[str]) –The order of the docstring styles to try.
default class-attribute instance-attribute ¤
default: str | None = None
The default docstring style to use if no other style is detected.
method class-attribute instance-attribute ¤
method: Literal['heuristics', 'max_sections'] = 'heuristics'
The method to use to determine the docstring style.
per_style_options class-attribute instance-attribute ¤
per_style_options: PerStyleOptions = field(default_factory=PerStyleOptions)
Per-style options.
style_order class-attribute instance-attribute ¤
The order of the docstring styles to try.
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
354 355 356 357 358 359 | |
AutorefsHook ¤
flowchart TD
mkdocstrings_handlers.python.AutorefsHook[AutorefsHook]
click mkdocstrings_handlers.python.AutorefsHook href "" "mkdocstrings_handlers.python.AutorefsHook"
Autorefs hook.
With this hook, we're able to add context to autorefs (cross-references), such as originating file path and line number, to improve error reporting.
Parameters:
-
(current_object¤Object | Alias) –The object being rendered.
-
(config¤dict[str, Any]) –The configuration dictionary.
Methods:
-
expand_identifier–Expand an identifier.
-
get_context–Get the context for the current object.
Attributes:
-
config–The configuration options.
-
current_object–The current object being rendered.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
845 846 847 848 849 850 851 852 853 854 855 | |
current_object instance-attribute ¤
current_object = current_object
The current object being rendered.
expand_identifier ¤
expand_identifier(identifier: str) -> str
Expand an identifier.
Parameters:
Returns:
-
str–The expanded identifier.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | |
get_context ¤
get_context() -> Context
Get the context for the current object.
Returns:
-
Context–The context.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | |
GoogleStyleOptions dataclass ¤
GoogleStyleOptions(
*,
ignore_init_summary: bool = False,
returns_multiple_items: bool = True,
returns_named_value: bool = True,
returns_type_in_property_summary: bool = False,
receives_multiple_items: bool = True,
receives_named_value: bool = True,
trim_doctest_flags: bool = True,
warn_unknown_params: bool = True,
warn_missing_types: bool = True,
warnings: bool = True
)
Google style docstring options.
Attributes:
-
ignore_init_summary(bool) –Whether to ignore the summary in
__init__methods' docstrings. -
receives_multiple_items(bool) –Whether to parse multiple items in
Receivessections. -
receives_named_value(bool) –Whether to parse
Receivessection items as name and description, rather than type and description. -
returns_multiple_items(bool) –Whether to parse multiple items in
YieldsandReturnssections. -
returns_named_value(bool) –Whether to parse
YieldsandReturnssection items as name and description, rather than type and description. -
returns_type_in_property_summary(bool) –Whether to parse the return type of properties at the beginning of their summary:
str: Summary of the property. -
trim_doctest_flags(bool) –Whether to remove doctest flags from Python example blocks.
-
warn_missing_types(bool) –Warn about missing type/annotation for parameters, return values, etc.
-
warn_unknown_params(bool) –Warn about documented parameters not appearing in the signature.
-
warnings(bool) –Generally enable/disable warnings when parsing docstrings.
ignore_init_summary class-attribute instance-attribute ¤
ignore_init_summary: bool = False
Whether to ignore the summary in __init__ methods' docstrings.
receives_multiple_items class-attribute instance-attribute ¤
receives_multiple_items: bool = True
Whether to parse multiple items in Receives sections.
When true, each item's continuation lines must be indented. When false (single item), no further indentation is required.
receives_named_value class-attribute instance-attribute ¤
receives_named_value: bool = True
Whether to parse Receives section items as name and description, rather than type and description.
When true, type must be wrapped in parentheses: (int): Description.. Names are optional: name (int): Description.. When false, parentheses are optional but the items cannot be named: int: Description.
returns_multiple_items class-attribute instance-attribute ¤
returns_multiple_items: bool = True
Whether to parse multiple items in Yields and Returns sections.
When true, each item's continuation lines must be indented. When false (single item), no further indentation is required.
returns_named_value class-attribute instance-attribute ¤
returns_named_value: bool = True
Whether to parse Yields and Returns section items as name and description, rather than type and description.
When true, type must be wrapped in parentheses: (int): Description.. Names are optional: name (int): Description.. When false, parentheses are optional but the items cannot be named: int: Description.
returns_type_in_property_summary class-attribute instance-attribute ¤
returns_type_in_property_summary: bool = False
Whether to parse the return type of properties at the beginning of their summary: str: Summary of the property.
trim_doctest_flags class-attribute instance-attribute ¤
trim_doctest_flags: bool = True
Whether to remove doctest flags from Python example blocks.
warn_missing_types class-attribute instance-attribute ¤
warn_missing_types: bool = True
Warn about missing type/annotation for parameters, return values, etc.
Inventory dataclass ¤
An inventory.
Attributes:
NumpyStyleOptions dataclass ¤
NumpyStyleOptions(
*,
ignore_init_summary: bool = False,
trim_doctest_flags: bool = True,
warn_unknown_params: bool = True,
warn_missing_types: bool = True,
warnings: bool = True
)
Numpy style docstring options.
Attributes:
-
ignore_init_summary(bool) –Whether to ignore the summary in
__init__methods' docstrings. -
trim_doctest_flags(bool) –Whether to remove doctest flags from Python example blocks.
-
warn_missing_types(bool) –Warn about missing type/annotation for parameters, return values, etc.
-
warn_unknown_params(bool) –Warn about documented parameters not appearing in the signature.
-
warnings(bool) –Generally enable/disable warnings when parsing docstrings.
ignore_init_summary class-attribute instance-attribute ¤
ignore_init_summary: bool = False
Whether to ignore the summary in __init__ methods' docstrings.
trim_doctest_flags class-attribute instance-attribute ¤
trim_doctest_flags: bool = True
Whether to remove doctest flags from Python example blocks.
warn_missing_types class-attribute instance-attribute ¤
warn_missing_types: bool = True
Warn about missing type/annotation for parameters, return values, etc.
PerStyleOptions dataclass ¤
PerStyleOptions(
*,
google: GoogleStyleOptions = GoogleStyleOptions(),
numpy: NumpyStyleOptions = NumpyStyleOptions(),
sphinx: SphinxStyleOptions = SphinxStyleOptions()
)
Per style options.
Methods:
-
from_data–Create an instance from a dictionary.
Attributes:
-
google(GoogleStyleOptions) –Google-style options.
-
numpy(NumpyStyleOptions) –Numpydoc-style options.
-
sphinx(SphinxStyleOptions) –Sphinx-style options.
google class-attribute instance-attribute ¤
google: GoogleStyleOptions = field(default_factory=GoogleStyleOptions)
Google-style options.
numpy class-attribute instance-attribute ¤
numpy: NumpyStyleOptions = field(default_factory=NumpyStyleOptions)
Numpydoc-style options.
sphinx class-attribute instance-attribute ¤
sphinx: SphinxStyleOptions = field(default_factory=SphinxStyleOptions)
Sphinx-style options.
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
302 303 304 305 306 307 308 309 310 311 | |
PythonConfig dataclass ¤
PythonConfig(
*,
inventories: list[Inventory] = list(),
paths: list[str] = (lambda: ["."])(),
load_external_modules: bool | None = None,
options: dict[str, Any] = dict(),
locale: str | None = None
)
flowchart TD
mkdocstrings_handlers.python.PythonConfig[PythonConfig]
mkdocstrings_handlers.python._internal.config.PythonInputConfig[PythonInputConfig]
mkdocstrings_handlers.python._internal.config.PythonInputConfig --> mkdocstrings_handlers.python.PythonConfig
click mkdocstrings_handlers.python.PythonConfig href "" "mkdocstrings_handlers.python.PythonConfig"
click mkdocstrings_handlers.python._internal.config.PythonInputConfig href "" "mkdocstrings_handlers.python._internal.config.PythonInputConfig"
Python handler configuration.
Methods:
Attributes:
-
inventories(list[Inventory]) –The object inventories to load.
-
load_external_modules(bool | None) –Whether to always load external modules/packages.
-
locale(str | None) –Deprecated. Use mkdocstrings' own
localesetting instead. The locale to use when translating template strings. -
options(dict[str, Any]) –Configuration options for collecting and rendering objects.
-
paths(list[str]) –The paths in which to search for Python packages.
inventories class-attribute instance-attribute ¤
The object inventories to load.
load_external_modules class-attribute instance-attribute ¤
load_external_modules: bool | None = None
Whether to always load external modules/packages.
locale class-attribute instance-attribute ¤
locale: str | None = None
Deprecated. Use mkdocstrings' own locale setting instead. The locale to use when translating template strings.
options class-attribute instance-attribute ¤
Configuration options for collecting and rendering objects.
paths class-attribute instance-attribute ¤
The paths in which to search for Python packages.
coerce classmethod ¤
coerce(**data: Any) -> MutableMapping[str, Any]
Coerce data.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1159 1160 1161 1162 1163 1164 1165 1166 | |
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1139 1140 1141 1142 | |
PythonHandler ¤
flowchart TD
mkdocstrings_handlers.python.PythonHandler[PythonHandler]
mkdocstrings._internal.handlers.base.BaseHandler[BaseHandler]
mkdocstrings._internal.handlers.base.BaseHandler --> mkdocstrings_handlers.python.PythonHandler
click mkdocstrings_handlers.python.PythonHandler href "" "mkdocstrings_handlers.python.PythonHandler"
click mkdocstrings._internal.handlers.base.BaseHandler href "" "mkdocstrings._internal.handlers.base.BaseHandler"
The Python handler class.
Parameters:
-
(config¤PythonConfig) –The handler configuration.
-
(base_dir¤Path) –The base directory of the project.
-
(**kwargs¤Any, default:{}) –Arguments passed to the parent constructor.
Methods:
-
collect–Collect the documentation for the given identifier.
-
do_convert_markdown–Render Markdown text; for use inside templates.
-
do_heading–Render an HTML heading and register it for the table of contents. For use inside templates.
-
get_aliases–Get the aliases for the given identifier.
-
get_extended_templates_dirs–Load template extensions for the given handler, return their templates directories.
-
get_headings–Return and clear the headings gathered so far.
-
get_inventory_urls–Return the URLs of the inventory files to download.
-
get_options–Get combined default, global and local options.
-
get_templates_dir–Return the path to the handler's templates directory.
-
load_inventory–Yield items and their URLs from an inventory file streamed from
in_file. -
normalize_extension_paths–Resolve extension paths relative to config file.
-
render–Render the collected data.
-
render_backlinks–Render the backlinks.
-
teardown–Teardown the handler.
-
update_env–Update the Jinja environment with custom filters and tests.
Attributes:
-
base_dir–The base directory of the project.
-
config–The handler configuration.
-
custom_templates–The path to custom templates.
-
domain(str) –The cross-documentation domain/language for this handler.
-
enable_inventory(bool) –Whether this handler is interested in enabling the creation of the
objects.invSphinx inventory file. -
env–The Jinja environment.
-
extra_css(str) –Extra CSS.
-
fallback_config(dict) –Fallback configuration when searching anchors for identifiers.
-
fallback_theme(str) –The fallback theme.
-
global_options–The global configuration options (in
mkdocs.yml). -
md(Markdown) –The Markdown instance.
-
mdx–The Markdown extensions to use.
-
mdx_config–The configuration for the Markdown extensions.
-
name(str) –The handler's name.
-
outer_layer(bool) –Whether we're in the outer Markdown conversion layer.
-
theme–The selected theme.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
custom_templates instance-attribute ¤
custom_templates = custom_templates
The path to custom templates.
domain class-attribute ¤
domain: str = 'py'
The cross-documentation domain/language for this handler.
enable_inventory class-attribute ¤
enable_inventory: bool = True
Whether this handler is interested in enabling the creation of the objects.inv Sphinx inventory file.
env instance-attribute ¤
env = Environment(autoescape=True, loader=FileSystemLoader(paths), auto_reload=False)
The Jinja environment.
fallback_config class-attribute ¤
fallback_config: dict = {}
Fallback configuration when searching anchors for identifiers.
global_options instance-attribute ¤
global_options = global_options
The global configuration options (in mkdocs.yml).
mdx_config instance-attribute ¤
mdx_config = mdx_config
The configuration for the Markdown extensions.
collect ¤
collect(identifier: str, options: PythonOptions) -> CollectorItem
Collect the documentation for the given identifier.
Parameters:
-
(identifier¤str) –The identifier of the object to collect.
-
(options¤PythonOptions) –The options to use for the collection.
Returns:
-
CollectorItem–The collected item.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
do_convert_markdown ¤
do_convert_markdown(
text: str,
heading_level: int,
html_id: str = "",
*,
strip_paragraph: bool = False,
autoref_hook: AutorefsHookInterface | None = None
) -> Markup
Render Markdown text; for use inside templates.
Parameters:
-
(text¤str) –The text to convert.
-
(heading_level¤int) –The base heading level to start all Markdown headings from.
-
(html_id¤str, default:'') –The HTML id of the element that's considered the parent of this element.
-
(strip_paragraph¤bool, default:False) –Whether to exclude the
<p>tag from around the whole output.
Returns:
-
Markup–An HTML string.
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
do_heading ¤
do_heading(
content: Markup,
heading_level: int,
*,
role: str | None = None,
hidden: bool = False,
toc_label: str | None = None,
skip_inventory: bool = False,
**attributes: str
) -> Markup
Render an HTML heading and register it for the table of contents. For use inside templates.
Parameters:
-
(content¤Markup) –The HTML within the heading.
-
(heading_level¤int) –The level of heading (e.g. 3 ->
h3). -
(role¤str | None, default:None) –An optional role for the object bound to this heading.
-
(hidden¤bool, default:False) –If True, only register it for the table of contents, don't render anything.
-
(toc_label¤str | None, default:None) –The title to use in the table of contents ('data-toc-label' attribute).
-
(skip_inventory¤bool, default:False) –Flag element to not be registered in the inventory (by setting a
data-skip-inventoryattribute). -
(**attributes¤str, default:{}) –Any extra HTML attributes of the heading.
Returns:
-
Markup–An HTML string.
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | |
get_aliases ¤
get_aliases(identifier: str) -> tuple[str, ...]
Get the aliases for the given identifier.
Parameters:
Returns:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
get_extended_templates_dirs ¤
Load template extensions for the given handler, return their templates directories.
Parameters:
Returns:
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
383 384 385 386 387 388 389 390 391 392 393 | |
get_headings ¤
Return and clear the headings gathered so far.
Returns:
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
526 527 528 529 530 531 532 533 534 | |
get_inventory_urls ¤
Return the URLs of the inventory files to download.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
149 150 151 | |
get_options ¤
get_options(local_options: Mapping[str, Any]) -> HandlerOptions
Get combined default, global and local options.
Parameters:
Returns:
-
HandlerOptions–The combined options.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
get_templates_dir ¤
Return the path to the handler's templates directory.
Override to customize how the templates directory is found.
Parameters:
Raises:
-
ModuleNotFoundError–When no such handler is installed.
-
FileNotFoundError–When the templates directory cannot be found.
Returns:
-
Path–The templates directory path.
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
load_inventory staticmethod ¤
load_inventory(
in_file: BinaryIO,
url: str,
base_url: str | None = None,
domains: list[str] | None = None,
**kwargs: Any
) -> Iterator[tuple[str, str]]
Yield items and their URLs from an inventory file streamed from in_file.
This implements mkdocstrings' load_inventory "protocol" (see mkdocstrings.plugin).
Parameters:
-
(in_file¤BinaryIO) –The binary file-like object to read the inventory from.
-
(url¤str) –The URL that this file is being streamed from (used to guess
base_url). -
(base_url¤str | None, default:None) –The URL that this inventory's sub-paths are relative to.
-
(domains¤list[str] | None, default:None) –A list of domain strings to filter the inventory by, when not passed, "py" will be used.
-
(**kwargs¤Any, default:{}) –Ignore additional arguments passed from the config.
Yields:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
normalize_extension_paths ¤
Resolve extension paths relative to config file.
Parameters:
Returns:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
render ¤
render(data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str
Render the collected data.
Parameters:
-
(data¤CollectorItem) –The collected data.
-
(options¤PythonOptions) –The options to use for rendering.
-
(locale¤str | None, default:None) –The locale to use for rendering (default is "en").
Returns:
-
str–The rendered data (HTML).
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
render_backlinks ¤
render_backlinks(
backlinks: Mapping[str, Iterable[Backlink]], *, locale: str | None = None
) -> str
Render the backlinks.
Parameters:
Returns:
-
str–The rendered backlinks (HTML).
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
teardown ¤
teardown() -> None
Teardown the handler.
This method should be implemented to, for example, terminate a subprocess that was started when creating the handler instance.
Source code in .venv/lib/python3.14/site-packages/mkdocstrings/_internal/handlers/base.py
348 349 350 351 352 353 | |
update_env ¤
Update the Jinja environment with custom filters and tests.
Parameters:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
PythonInputConfig dataclass ¤
PythonInputConfig(
*,
inventories: list[str | Inventory] = list(),
paths: list[str] = (lambda: ["."])(),
load_external_modules: bool | None = None,
options: PythonInputOptions = PythonInputOptions(),
locale: str | None = None
)
Python handler configuration.
Methods:
Attributes:
-
inventories(list[str | Inventory]) –The inventories to load.
-
load_external_modules(bool | None) –Whether to always load external modules/packages.
-
locale(str | None) –Deprecated. Use mkdocstrings' own
localesetting instead. The locale to use when translating template strings. -
options(PythonInputOptions) –Configuration options for collecting and rendering objects.
-
paths(list[str]) –The paths in which to search for Python packages.
inventories class-attribute instance-attribute ¤
The inventories to load.
load_external_modules class-attribute instance-attribute ¤
load_external_modules: bool | None = None
Whether to always load external modules/packages.
locale class-attribute instance-attribute ¤
locale: str | None = None
Deprecated. Use mkdocstrings' own locale setting instead. The locale to use when translating template strings.
options class-attribute instance-attribute ¤
options: PythonInputOptions = field(default_factory=PythonInputOptions)
Configuration options for collecting and rendering objects.
paths class-attribute instance-attribute ¤
The paths in which to search for Python packages.
coerce classmethod ¤
coerce(**data: Any) -> MutableMapping[str, Any]
Coerce data.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1134 1135 1136 1137 | |
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1139 1140 1141 1142 | |
PythonInputOptions dataclass ¤
PythonInputOptions(
*,
allow_inspection: bool = True,
force_inspection: bool = False,
annotations_path: Literal["brief", "source", "full"] = "brief",
backlinks: Literal["flat", "tree", False] = False,
docstring_options: (
GoogleStyleOptions
| NumpyStyleOptions
| SphinxStyleOptions
| AutoStyleOptions
| None
) = None,
docstring_section_style: Literal["table", "list", "spacy"] = "table",
docstring_style: Literal["auto", "google", "numpy", "sphinx"] | None = "google",
extensions: list[str | dict[str, Any]] = list(),
filters: list[str] | Literal["public"] = (lambda: copy())(),
find_stubs_package: bool = False,
group_by_category: bool = True,
heading: str = "",
heading_level: int = 2,
inheritance_diagram_direction: Literal["TB", "TD", "BT", "RL", "LR"] = "TD",
inherited_members: bool | list[str] = False,
line_length: int = 60,
members: list[str] | bool | None = None,
members_order: Order | list[Order] = "alphabetical",
merge_init_into_class: bool = False,
modernize_annotations: bool = False,
overloads_only: bool = False,
parameter_headings: bool = False,
preload_modules: list[str] = list(),
relative_crossrefs: bool = False,
scoped_crossrefs: bool = False,
show_overloads: bool = True,
separate_signature: bool = False,
show_attribute_values: bool = True,
show_bases: bool = True,
show_category_heading: bool = False,
show_docstring_attributes: bool = True,
show_docstring_classes: bool = True,
show_docstring_description: bool = True,
show_docstring_examples: bool = True,
show_docstring_functions: bool = True,
show_docstring_modules: bool = True,
show_docstring_other_parameters: bool = True,
show_docstring_parameters: bool = True,
show_docstring_raises: bool = True,
show_docstring_receives: bool = True,
show_docstring_returns: bool = True,
show_docstring_type_aliases: bool = True,
show_docstring_type_parameters: bool = True,
show_docstring_warns: bool = True,
show_docstring_yields: bool = True,
show_if_no_docstring: bool = False,
show_inheritance_diagram: bool = False,
show_labels: bool = True,
show_object_full_path: bool = False,
show_root_full_path: bool = True,
show_root_heading: bool = False,
show_root_members_full_path: bool = False,
show_root_toc_entry: bool = True,
show_signature_annotations: bool = False,
show_signature_type_parameters: bool = False,
show_signature: bool = True,
show_source: bool = True,
show_submodules: bool = False,
show_symbol_type_heading: bool = False,
show_symbol_type_toc: bool = False,
skip_local_inventory: bool = False,
signature_crossrefs: bool = False,
summary: bool | SummaryOption = SummaryOption(),
toc_label: str = "",
type_parameter_headings: bool = False,
unwrap_annotated: bool = False,
extra: dict[str, Any] = dict()
)
Accepted input options.
Methods:
Attributes:
-
allow_inspection(bool) –Whether to allow inspecting modules when visiting them is not possible.
-
annotations_path(Literal['brief', 'source', 'full']) –The verbosity for annotations path:
brief(recommended),source(as written in the source), orfull. -
backlinks(Literal['flat', 'tree', False]) –Whether to render backlinks, and how.
-
docstring_options(GoogleStyleOptions | NumpyStyleOptions | SphinxStyleOptions | AutoStyleOptions | None) –The options for the docstring parser.
-
docstring_section_style(Literal['table', 'list', 'spacy']) –The style used to render docstring sections.
-
docstring_style(Literal['auto', 'google', 'numpy', 'sphinx'] | None) –The docstring style to use:
auto,google,numpy,sphinx, orNone. -
extensions(list[str | dict[str, Any]]) –A list of Griffe extensions to load.
-
extra(dict[str, Any]) –Extra options.
-
filters(list[str] | Literal['public']) –A list of filters, or
"public". -
find_stubs_package(bool) –Whether to load stubs package (package-stubs) when extracting docstrings.
-
force_inspection(bool) –Whether to force using dynamic analysis when loading data.
-
group_by_category(bool) –Group the object's children by categories: attributes, classes, functions, and modules.
-
heading(str) –A custom string to override the autogenerated heading of the root object.
-
heading_level(int) –The initial heading level to use.
-
inheritance_diagram_direction(Literal['TB', 'TD', 'BT', 'RL', 'LR']) –The direction of the Mermaid chart presenting the inheritance diagram of a class.
-
inherited_members(bool | list[str]) –A boolean, or an explicit list of inherited members to render.
-
line_length(int) –Maximum line length when formatting code/signatures.
-
members(list[str] | bool | None) –A boolean, or an explicit list of members to render.
-
members_order(Order | list[Order]) –The members ordering to use.
-
merge_init_into_class(bool) –Whether to merge the
__init__method into the class' signature and docstring. -
modernize_annotations(bool) –Whether to modernize annotations, for example
Optional[str]intostr | None. -
overloads_only(bool) –Whether to hide the implementation signature if the overloads are shown.
-
parameter_headings(bool) –Whether to render headings for parameters (therefore showing parameters in the ToC).
-
preload_modules(list[str]) –Pre-load modules that are not specified directly in autodoc instructions (
::: identifier). -
relative_crossrefs(bool) –Whether to enable the relative crossref syntax.
-
scoped_crossrefs(bool) –Whether to enable the scoped crossref ability.
-
separate_signature(bool) –Whether to put the whole signature in a code block below the heading.
-
show_attribute_values(bool) –Show initial values of attributes in classes.
-
show_bases(bool) –Show the base classes of a class.
-
show_category_heading(bool) –When grouped by categories, show a heading for each category.
-
show_docstring_attributes(bool) –Whether to display the 'Attributes' section in the object's docstring.
-
show_docstring_classes(bool) –Whether to display the 'Classes' section in the object's docstring.
-
show_docstring_description(bool) –Whether to display the textual block (including admonitions) in the object's docstring.
-
show_docstring_examples(bool) –Whether to display the 'Examples' section in the object's docstring.
-
show_docstring_functions(bool) –Whether to display the 'Functions' or 'Methods' sections in the object's docstring.
-
show_docstring_modules(bool) –Whether to display the 'Modules' section in the object's docstring.
-
show_docstring_other_parameters(bool) –Whether to display the 'Other Parameters' section in the object's docstring.
-
show_docstring_parameters(bool) –Whether to display the 'Parameters' section in the object's docstring.
-
show_docstring_raises(bool) –Whether to display the 'Raises' section in the object's docstring.
-
show_docstring_receives(bool) –Whether to display the 'Receives' section in the object's docstring.
-
show_docstring_returns(bool) –Whether to display the 'Returns' section in the object's docstring.
-
show_docstring_type_aliases(bool) –Whether to display the 'Type Aliases' section in the object's docstring.
-
show_docstring_type_parameters(bool) –Whether to display the 'Type Parameters' section in the object's docstring.
-
show_docstring_warns(bool) –Whether to display the 'Warns' section in the object's docstring.
-
show_docstring_yields(bool) –Whether to display the 'Yields' section in the object's docstring.
-
show_if_no_docstring(bool) –Show the object heading even if it has no docstring or children with docstrings.
-
show_inheritance_diagram(bool) –Show the inheritance diagram of a class using Mermaid.
-
show_labels(bool) –Whether to show labels of the members.
-
show_object_full_path(bool) –Show the full Python path of every object.
-
show_overloads(bool) –Show the overloads of a function or method.
-
show_root_full_path(bool) –Show the full Python path for the root object heading.
-
show_root_heading(bool) –Show the heading of the object at the root of the documentation tree.
-
show_root_members_full_path(bool) –Show the full Python path of the root members.
-
show_root_toc_entry(bool) –If the root heading is not shown, at least add a ToC entry for it.
-
show_signature(bool) –Show methods and functions signatures.
-
show_signature_annotations(bool) –Show the type annotations in methods and functions signatures.
-
show_signature_type_parameters(bool) –Show the type parameters in generic classes, methods, functions and type aliases signatures.
-
show_source(bool) –Show the source code of this object.
-
show_submodules(bool) –When rendering a module, show its submodules recursively.
-
show_symbol_type_heading(bool) –Show the symbol type in headings (e.g. mod, class, meth, func and attr).
-
show_symbol_type_toc(bool) –Show the symbol type in the Table of Contents (e.g. mod, class, methd, func and attr).
-
signature_crossrefs(bool) –Whether to render cross-references for type annotations in signatures.
-
skip_local_inventory(bool) –Whether to prevent objects from being registered in the local objects inventory.
-
summary(bool | SummaryOption) –Whether to render summaries of modules, classes, functions (methods) and attributes.
-
toc_label(str) –A custom string to override the autogenerated toc label of the root object.
-
type_parameter_headings(bool) –Whether to render headings for type parameters (therefore showing type parameters in the ToC).
-
unwrap_annotated(bool) –Whether to unwrap
Annotatedtypes to show only the type without the annotations.
allow_inspection class-attribute instance-attribute ¤
allow_inspection: bool = True
Whether to allow inspecting modules when visiting them is not possible.
annotations_path class-attribute instance-attribute ¤
annotations_path: Literal['brief', 'source', 'full'] = 'brief'
The verbosity for annotations path: brief (recommended), source (as written in the source), or full.
backlinks class-attribute instance-attribute ¤
backlinks: Literal['flat', 'tree', False] = False
Whether to render backlinks, and how.
docstring_options class-attribute instance-attribute ¤
docstring_options: (
GoogleStyleOptions
| NumpyStyleOptions
| SphinxStyleOptions
| AutoStyleOptions
| None
) = None
The options for the docstring parser.
See docstring parsers and their options in Griffe docs.
docstring_section_style class-attribute instance-attribute ¤
docstring_section_style: Literal['table', 'list', 'spacy'] = 'table'
The style used to render docstring sections.
docstring_style class-attribute instance-attribute ¤
docstring_style: Literal['auto', 'google', 'numpy', 'sphinx'] | None = 'google'
The docstring style to use: auto, google, numpy, sphinx, or None.
extensions class-attribute instance-attribute ¤
A list of Griffe extensions to load.
extra class-attribute instance-attribute ¤
Extra options.
filters class-attribute instance-attribute ¤
A list of filters, or "public".
List of filters
A filter starting with ! will exclude matching objects instead of including them. The members option takes precedence over filters (filters will still be applied recursively to lower members in the hierarchy).
Filtering methods
The public method will include only public objects: those added to __all__ or not starting with an underscore (except for special methods/attributes).
find_stubs_package class-attribute instance-attribute ¤
find_stubs_package: bool = False
Whether to load stubs package (package-stubs) when extracting docstrings.
force_inspection class-attribute instance-attribute ¤
force_inspection: bool = False
Whether to force using dynamic analysis when loading data.
group_by_category class-attribute instance-attribute ¤
group_by_category: bool = True
Group the object's children by categories: attributes, classes, functions, and modules.
heading class-attribute instance-attribute ¤
heading: str = ''
A custom string to override the autogenerated heading of the root object.
heading_level class-attribute instance-attribute ¤
heading_level: int = 2
The initial heading level to use.
inheritance_diagram_direction class-attribute instance-attribute ¤
inheritance_diagram_direction: Literal['TB', 'TD', 'BT', 'RL', 'LR'] = 'TD'
The direction of the Mermaid chart presenting the inheritance diagram of a class.
inherited_members class-attribute instance-attribute ¤
A boolean, or an explicit list of inherited members to render.
If true, select all inherited members, which can then be filtered with members. If false or empty list, do not select any inherited member.
line_length class-attribute instance-attribute ¤
line_length: int = 60
Maximum line length when formatting code/signatures.
members class-attribute instance-attribute ¤
A boolean, or an explicit list of members to render.
If true, select all members without further filtering. If false or empty list, do not render members. If none, select all members and apply further filtering with filters and docstrings.
members_order class-attribute instance-attribute ¤
The members ordering to use.
__all__: order members according to__all__module attributes, if declared;alphabetical: order members alphabetically;source: order members as they appear in the source file.
Since __all__ is a module-only attribute, it can't be used to sort class members, therefore the members_order option accepts a list of ordering methods, indicating ordering preferences.
merge_init_into_class class-attribute instance-attribute ¤
merge_init_into_class: bool = False
Whether to merge the __init__ method into the class' signature and docstring.
modernize_annotations class-attribute instance-attribute ¤
modernize_annotations: bool = False
Whether to modernize annotations, for example Optional[str] into str | None.
overloads_only class-attribute instance-attribute ¤
overloads_only: bool = False
Whether to hide the implementation signature if the overloads are shown.
parameter_headings class-attribute instance-attribute ¤
parameter_headings: bool = False
Whether to render headings for parameters (therefore showing parameters in the ToC).
preload_modules class-attribute instance-attribute ¤
Pre-load modules that are not specified directly in autodoc instructions (::: identifier).
It is useful when you want to render documentation for a particular member of an object, and this member is imported from another package than its parent.
For an imported member to be rendered, you need to add it to the __all__ attribute of the importing module.
The modules must be listed as an array of strings.
relative_crossrefs class-attribute instance-attribute ¤
relative_crossrefs: bool = False
Whether to enable the relative crossref syntax.
scoped_crossrefs class-attribute instance-attribute ¤
scoped_crossrefs: bool = False
Whether to enable the scoped crossref ability.
separate_signature class-attribute instance-attribute ¤
separate_signature: bool = False
Whether to put the whole signature in a code block below the heading.
If Black or Ruff are installed, the signature is also formatted using them.
show_attribute_values class-attribute instance-attribute ¤
show_attribute_values: bool = True
Show initial values of attributes in classes.
show_bases class-attribute instance-attribute ¤
show_bases: bool = True
Show the base classes of a class.
show_category_heading class-attribute instance-attribute ¤
show_category_heading: bool = False
When grouped by categories, show a heading for each category.
show_docstring_attributes class-attribute instance-attribute ¤
show_docstring_attributes: bool = True
Whether to display the 'Attributes' section in the object's docstring.
show_docstring_classes class-attribute instance-attribute ¤
show_docstring_classes: bool = True
Whether to display the 'Classes' section in the object's docstring.
show_docstring_description class-attribute instance-attribute ¤
show_docstring_description: bool = True
Whether to display the textual block (including admonitions) in the object's docstring.
show_docstring_examples class-attribute instance-attribute ¤
show_docstring_examples: bool = True
Whether to display the 'Examples' section in the object's docstring.
show_docstring_functions class-attribute instance-attribute ¤
show_docstring_functions: bool = True
Whether to display the 'Functions' or 'Methods' sections in the object's docstring.
show_docstring_modules class-attribute instance-attribute ¤
show_docstring_modules: bool = True
Whether to display the 'Modules' section in the object's docstring.
show_docstring_other_parameters class-attribute instance-attribute ¤
show_docstring_other_parameters: bool = True
Whether to display the 'Other Parameters' section in the object's docstring.
show_docstring_parameters class-attribute instance-attribute ¤
show_docstring_parameters: bool = True
Whether to display the 'Parameters' section in the object's docstring.
show_docstring_raises class-attribute instance-attribute ¤
show_docstring_raises: bool = True
Whether to display the 'Raises' section in the object's docstring.
show_docstring_receives class-attribute instance-attribute ¤
show_docstring_receives: bool = True
Whether to display the 'Receives' section in the object's docstring.
show_docstring_returns class-attribute instance-attribute ¤
show_docstring_returns: bool = True
Whether to display the 'Returns' section in the object's docstring.
show_docstring_type_aliases class-attribute instance-attribute ¤
show_docstring_type_aliases: bool = True
Whether to display the 'Type Aliases' section in the object's docstring.
show_docstring_type_parameters class-attribute instance-attribute ¤
show_docstring_type_parameters: bool = True
Whether to display the 'Type Parameters' section in the object's docstring.
show_docstring_warns class-attribute instance-attribute ¤
show_docstring_warns: bool = True
Whether to display the 'Warns' section in the object's docstring.
show_docstring_yields class-attribute instance-attribute ¤
show_docstring_yields: bool = True
Whether to display the 'Yields' section in the object's docstring.
show_if_no_docstring class-attribute instance-attribute ¤
show_if_no_docstring: bool = False
Show the object heading even if it has no docstring or children with docstrings.
show_inheritance_diagram class-attribute instance-attribute ¤
show_inheritance_diagram: bool = False
Show the inheritance diagram of a class using Mermaid.
show_labels class-attribute instance-attribute ¤
show_labels: bool = True
Whether to show labels of the members.
show_object_full_path class-attribute instance-attribute ¤
show_object_full_path: bool = False
Show the full Python path of every object.
show_overloads class-attribute instance-attribute ¤
show_overloads: bool = True
Show the overloads of a function or method.
show_root_full_path class-attribute instance-attribute ¤
show_root_full_path: bool = True
Show the full Python path for the root object heading.
show_root_heading class-attribute instance-attribute ¤
show_root_heading: bool = False
Show the heading of the object at the root of the documentation tree.
The root object is the object referenced by the identifier after :::.
show_root_members_full_path class-attribute instance-attribute ¤
show_root_members_full_path: bool = False
Show the full Python path of the root members.
show_root_toc_entry class-attribute instance-attribute ¤
show_root_toc_entry: bool = True
If the root heading is not shown, at least add a ToC entry for it.
show_signature class-attribute instance-attribute ¤
show_signature: bool = True
Show methods and functions signatures.
show_signature_annotations class-attribute instance-attribute ¤
show_signature_annotations: bool = False
Show the type annotations in methods and functions signatures.
show_signature_type_parameters class-attribute instance-attribute ¤
show_signature_type_parameters: bool = False
Show the type parameters in generic classes, methods, functions and type aliases signatures.
show_source class-attribute instance-attribute ¤
show_source: bool = True
Show the source code of this object.
show_submodules class-attribute instance-attribute ¤
show_submodules: bool = False
When rendering a module, show its submodules recursively.
show_symbol_type_heading class-attribute instance-attribute ¤
show_symbol_type_heading: bool = False
Show the symbol type in headings (e.g. mod, class, meth, func and attr).
show_symbol_type_toc class-attribute instance-attribute ¤
show_symbol_type_toc: bool = False
Show the symbol type in the Table of Contents (e.g. mod, class, methd, func and attr).
signature_crossrefs class-attribute instance-attribute ¤
signature_crossrefs: bool = False
Whether to render cross-references for type annotations in signatures.
skip_local_inventory class-attribute instance-attribute ¤
skip_local_inventory: bool = False
Whether to prevent objects from being registered in the local objects inventory.
summary class-attribute instance-attribute ¤
summary: bool | SummaryOption = field(default_factory=SummaryOption)
Whether to render summaries of modules, classes, functions (methods) and attributes.
toc_label class-attribute instance-attribute ¤
toc_label: str = ''
A custom string to override the autogenerated toc label of the root object.
type_parameter_headings class-attribute instance-attribute ¤
type_parameter_headings: bool = False
Whether to render headings for type parameters (therefore showing type parameters in the ToC).
unwrap_annotated class-attribute instance-attribute ¤
unwrap_annotated: bool = False
Whether to unwrap Annotated types to show only the type without the annotations.
coerce classmethod ¤
coerce(**data: Any) -> MutableMapping[str, Any]
Coerce data.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | |
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1039 1040 1041 1042 | |
PythonOptions dataclass ¤
PythonOptions(
*,
allow_inspection: bool = True,
force_inspection: bool = False,
annotations_path: Literal["brief", "source", "full"] = "brief",
backlinks: Literal["flat", "tree", False] = False,
docstring_options: (
GoogleStyleOptions
| NumpyStyleOptions
| SphinxStyleOptions
| AutoStyleOptions
| None
) = None,
docstring_section_style: Literal["table", "list", "spacy"] = "table",
docstring_style: Literal["auto", "google", "numpy", "sphinx"] | None = "google",
extensions: list[str | dict[str, Any]] = list(),
filters: list[tuple[Pattern, bool]] | Literal["public"] = (
lambda: [
(compile(removeprefix("!")), startswith("!")) for filtr in _DEFAULT_FILTERS
]
)(),
find_stubs_package: bool = False,
group_by_category: bool = True,
heading: str = "",
heading_level: int = 2,
inheritance_diagram_direction: Literal["TB", "TD", "BT", "RL", "LR"] = "TD",
inherited_members: bool | list[str] = False,
line_length: int = 60,
members: list[str] | bool | None = None,
members_order: Order | list[Order] = "alphabetical",
merge_init_into_class: bool = False,
modernize_annotations: bool = False,
overloads_only: bool = False,
parameter_headings: bool = False,
preload_modules: list[str] = list(),
relative_crossrefs: bool = False,
scoped_crossrefs: bool = False,
show_overloads: bool = True,
separate_signature: bool = False,
show_attribute_values: bool = True,
show_bases: bool = True,
show_category_heading: bool = False,
show_docstring_attributes: bool = True,
show_docstring_classes: bool = True,
show_docstring_description: bool = True,
show_docstring_examples: bool = True,
show_docstring_functions: bool = True,
show_docstring_modules: bool = True,
show_docstring_other_parameters: bool = True,
show_docstring_parameters: bool = True,
show_docstring_raises: bool = True,
show_docstring_receives: bool = True,
show_docstring_returns: bool = True,
show_docstring_type_aliases: bool = True,
show_docstring_type_parameters: bool = True,
show_docstring_warns: bool = True,
show_docstring_yields: bool = True,
show_if_no_docstring: bool = False,
show_inheritance_diagram: bool = False,
show_labels: bool = True,
show_object_full_path: bool = False,
show_root_full_path: bool = True,
show_root_heading: bool = False,
show_root_members_full_path: bool = False,
show_root_toc_entry: bool = True,
show_signature_annotations: bool = False,
show_signature_type_parameters: bool = False,
show_signature: bool = True,
show_source: bool = True,
show_submodules: bool = False,
show_symbol_type_heading: bool = False,
show_symbol_type_toc: bool = False,
skip_local_inventory: bool = False,
signature_crossrefs: bool = False,
summary: SummaryOption = SummaryOption(),
toc_label: str = "",
type_parameter_headings: bool = False,
unwrap_annotated: bool = False,
extra: dict[str, Any] = dict()
)
flowchart TD
mkdocstrings_handlers.python.PythonOptions[PythonOptions]
mkdocstrings_handlers.python._internal.config.PythonInputOptions[PythonInputOptions]
mkdocstrings_handlers.python._internal.config.PythonInputOptions --> mkdocstrings_handlers.python.PythonOptions
click mkdocstrings_handlers.python.PythonOptions href "" "mkdocstrings_handlers.python.PythonOptions"
click mkdocstrings_handlers.python._internal.config.PythonInputOptions href "" "mkdocstrings_handlers.python._internal.config.PythonInputOptions"
Final options passed as template context.
Methods:
Attributes:
-
allow_inspection(bool) –Whether to allow inspecting modules when visiting them is not possible.
-
annotations_path(Literal['brief', 'source', 'full']) –The verbosity for annotations path:
brief(recommended),source(as written in the source), orfull. -
backlinks(Literal['flat', 'tree', False]) –Whether to render backlinks, and how.
-
docstring_options(GoogleStyleOptions | NumpyStyleOptions | SphinxStyleOptions | AutoStyleOptions | None) –The options for the docstring parser.
-
docstring_section_style(Literal['table', 'list', 'spacy']) –The style used to render docstring sections.
-
docstring_style(Literal['auto', 'google', 'numpy', 'sphinx'] | None) –The docstring style to use:
auto,google,numpy,sphinx, orNone. -
extensions(list[str | dict[str, Any]]) –A list of Griffe extensions to load.
-
extra(dict[str, Any]) –Extra options.
-
filters(list[tuple[Pattern, bool]] | Literal['public']) –A list of filters, or
"public". -
find_stubs_package(bool) –Whether to load stubs package (package-stubs) when extracting docstrings.
-
force_inspection(bool) –Whether to force using dynamic analysis when loading data.
-
group_by_category(bool) –Group the object's children by categories: attributes, classes, functions, and modules.
-
heading(str) –A custom string to override the autogenerated heading of the root object.
-
heading_level(int) –The initial heading level to use.
-
inheritance_diagram_direction(Literal['TB', 'TD', 'BT', 'RL', 'LR']) –The direction of the Mermaid chart presenting the inheritance diagram of a class.
-
inherited_members(bool | list[str]) –A boolean, or an explicit list of inherited members to render.
-
line_length(int) –Maximum line length when formatting code/signatures.
-
members(list[str] | bool | None) –A boolean, or an explicit list of members to render.
-
members_order(Order | list[Order]) –The members ordering to use.
-
merge_init_into_class(bool) –Whether to merge the
__init__method into the class' signature and docstring. -
modernize_annotations(bool) –Whether to modernize annotations, for example
Optional[str]intostr | None. -
overloads_only(bool) –Whether to hide the implementation signature if the overloads are shown.
-
parameter_headings(bool) –Whether to render headings for parameters (therefore showing parameters in the ToC).
-
preload_modules(list[str]) –Pre-load modules that are not specified directly in autodoc instructions (
::: identifier). -
relative_crossrefs(bool) –Whether to enable the relative crossref syntax.
-
scoped_crossrefs(bool) –Whether to enable the scoped crossref ability.
-
separate_signature(bool) –Whether to put the whole signature in a code block below the heading.
-
show_attribute_values(bool) –Show initial values of attributes in classes.
-
show_bases(bool) –Show the base classes of a class.
-
show_category_heading(bool) –When grouped by categories, show a heading for each category.
-
show_docstring_attributes(bool) –Whether to display the 'Attributes' section in the object's docstring.
-
show_docstring_classes(bool) –Whether to display the 'Classes' section in the object's docstring.
-
show_docstring_description(bool) –Whether to display the textual block (including admonitions) in the object's docstring.
-
show_docstring_examples(bool) –Whether to display the 'Examples' section in the object's docstring.
-
show_docstring_functions(bool) –Whether to display the 'Functions' or 'Methods' sections in the object's docstring.
-
show_docstring_modules(bool) –Whether to display the 'Modules' section in the object's docstring.
-
show_docstring_other_parameters(bool) –Whether to display the 'Other Parameters' section in the object's docstring.
-
show_docstring_parameters(bool) –Whether to display the 'Parameters' section in the object's docstring.
-
show_docstring_raises(bool) –Whether to display the 'Raises' section in the object's docstring.
-
show_docstring_receives(bool) –Whether to display the 'Receives' section in the object's docstring.
-
show_docstring_returns(bool) –Whether to display the 'Returns' section in the object's docstring.
-
show_docstring_type_aliases(bool) –Whether to display the 'Type Aliases' section in the object's docstring.
-
show_docstring_type_parameters(bool) –Whether to display the 'Type Parameters' section in the object's docstring.
-
show_docstring_warns(bool) –Whether to display the 'Warns' section in the object's docstring.
-
show_docstring_yields(bool) –Whether to display the 'Yields' section in the object's docstring.
-
show_if_no_docstring(bool) –Show the object heading even if it has no docstring or children with docstrings.
-
show_inheritance_diagram(bool) –Show the inheritance diagram of a class using Mermaid.
-
show_labels(bool) –Whether to show labels of the members.
-
show_object_full_path(bool) –Show the full Python path of every object.
-
show_overloads(bool) –Show the overloads of a function or method.
-
show_root_full_path(bool) –Show the full Python path for the root object heading.
-
show_root_heading(bool) –Show the heading of the object at the root of the documentation tree.
-
show_root_members_full_path(bool) –Show the full Python path of the root members.
-
show_root_toc_entry(bool) –If the root heading is not shown, at least add a ToC entry for it.
-
show_signature(bool) –Show methods and functions signatures.
-
show_signature_annotations(bool) –Show the type annotations in methods and functions signatures.
-
show_signature_type_parameters(bool) –Show the type parameters in generic classes, methods, functions and type aliases signatures.
-
show_source(bool) –Show the source code of this object.
-
show_submodules(bool) –When rendering a module, show its submodules recursively.
-
show_symbol_type_heading(bool) –Show the symbol type in headings (e.g. mod, class, meth, func and attr).
-
show_symbol_type_toc(bool) –Show the symbol type in the Table of Contents (e.g. mod, class, methd, func and attr).
-
signature_crossrefs(bool) –Whether to render cross-references for type annotations in signatures.
-
skip_local_inventory(bool) –Whether to prevent objects from being registered in the local objects inventory.
-
summary(SummaryOption) –Whether to render summaries of modules, classes, functions (methods), attributes and type aliases.
-
toc_label(str) –A custom string to override the autogenerated toc label of the root object.
-
type_parameter_headings(bool) –Whether to render headings for type parameters (therefore showing type parameters in the ToC).
-
unwrap_annotated(bool) –Whether to unwrap
Annotatedtypes to show only the type without the annotations.
allow_inspection class-attribute instance-attribute ¤
allow_inspection: bool = True
Whether to allow inspecting modules when visiting them is not possible.
annotations_path class-attribute instance-attribute ¤
annotations_path: Literal['brief', 'source', 'full'] = 'brief'
The verbosity for annotations path: brief (recommended), source (as written in the source), or full.
backlinks class-attribute instance-attribute ¤
backlinks: Literal['flat', 'tree', False] = False
Whether to render backlinks, and how.
docstring_options class-attribute instance-attribute ¤
docstring_options: (
GoogleStyleOptions
| NumpyStyleOptions
| SphinxStyleOptions
| AutoStyleOptions
| None
) = None
The options for the docstring parser.
See docstring parsers and their options in Griffe docs.
docstring_section_style class-attribute instance-attribute ¤
docstring_section_style: Literal['table', 'list', 'spacy'] = 'table'
The style used to render docstring sections.
docstring_style class-attribute instance-attribute ¤
docstring_style: Literal['auto', 'google', 'numpy', 'sphinx'] | None = 'google'
The docstring style to use: auto, google, numpy, sphinx, or None.
extensions class-attribute instance-attribute ¤
A list of Griffe extensions to load.
extra class-attribute instance-attribute ¤
Extra options.
filters class-attribute instance-attribute ¤
filters: list[tuple[Pattern, bool]] | Literal["public"] = field(
default_factory=lambda: [
(compile(removeprefix("!")), startswith("!")) for filtr in _DEFAULT_FILTERS
]
)
A list of filters, or "public".
find_stubs_package class-attribute instance-attribute ¤
find_stubs_package: bool = False
Whether to load stubs package (package-stubs) when extracting docstrings.
force_inspection class-attribute instance-attribute ¤
force_inspection: bool = False
Whether to force using dynamic analysis when loading data.
group_by_category class-attribute instance-attribute ¤
group_by_category: bool = True
Group the object's children by categories: attributes, classes, functions, and modules.
heading class-attribute instance-attribute ¤
heading: str = ''
A custom string to override the autogenerated heading of the root object.
heading_level class-attribute instance-attribute ¤
heading_level: int = 2
The initial heading level to use.
inheritance_diagram_direction class-attribute instance-attribute ¤
inheritance_diagram_direction: Literal['TB', 'TD', 'BT', 'RL', 'LR'] = 'TD'
The direction of the Mermaid chart presenting the inheritance diagram of a class.
inherited_members class-attribute instance-attribute ¤
A boolean, or an explicit list of inherited members to render.
If true, select all inherited members, which can then be filtered with members. If false or empty list, do not select any inherited member.
line_length class-attribute instance-attribute ¤
line_length: int = 60
Maximum line length when formatting code/signatures.
members class-attribute instance-attribute ¤
A boolean, or an explicit list of members to render.
If true, select all members without further filtering. If false or empty list, do not render members. If none, select all members and apply further filtering with filters and docstrings.
members_order class-attribute instance-attribute ¤
The members ordering to use.
__all__: order members according to__all__module attributes, if declared;alphabetical: order members alphabetically;source: order members as they appear in the source file.
Since __all__ is a module-only attribute, it can't be used to sort class members, therefore the members_order option accepts a list of ordering methods, indicating ordering preferences.
merge_init_into_class class-attribute instance-attribute ¤
merge_init_into_class: bool = False
Whether to merge the __init__ method into the class' signature and docstring.
modernize_annotations class-attribute instance-attribute ¤
modernize_annotations: bool = False
Whether to modernize annotations, for example Optional[str] into str | None.
overloads_only class-attribute instance-attribute ¤
overloads_only: bool = False
Whether to hide the implementation signature if the overloads are shown.
parameter_headings class-attribute instance-attribute ¤
parameter_headings: bool = False
Whether to render headings for parameters (therefore showing parameters in the ToC).
preload_modules class-attribute instance-attribute ¤
Pre-load modules that are not specified directly in autodoc instructions (::: identifier).
It is useful when you want to render documentation for a particular member of an object, and this member is imported from another package than its parent.
For an imported member to be rendered, you need to add it to the __all__ attribute of the importing module.
The modules must be listed as an array of strings.
relative_crossrefs class-attribute instance-attribute ¤
relative_crossrefs: bool = False
Whether to enable the relative crossref syntax.
scoped_crossrefs class-attribute instance-attribute ¤
scoped_crossrefs: bool = False
Whether to enable the scoped crossref ability.
separate_signature class-attribute instance-attribute ¤
separate_signature: bool = False
Whether to put the whole signature in a code block below the heading.
If Black or Ruff are installed, the signature is also formatted using them.
show_attribute_values class-attribute instance-attribute ¤
show_attribute_values: bool = True
Show initial values of attributes in classes.
show_bases class-attribute instance-attribute ¤
show_bases: bool = True
Show the base classes of a class.
show_category_heading class-attribute instance-attribute ¤
show_category_heading: bool = False
When grouped by categories, show a heading for each category.
show_docstring_attributes class-attribute instance-attribute ¤
show_docstring_attributes: bool = True
Whether to display the 'Attributes' section in the object's docstring.
show_docstring_classes class-attribute instance-attribute ¤
show_docstring_classes: bool = True
Whether to display the 'Classes' section in the object's docstring.
show_docstring_description class-attribute instance-attribute ¤
show_docstring_description: bool = True
Whether to display the textual block (including admonitions) in the object's docstring.
show_docstring_examples class-attribute instance-attribute ¤
show_docstring_examples: bool = True
Whether to display the 'Examples' section in the object's docstring.
show_docstring_functions class-attribute instance-attribute ¤
show_docstring_functions: bool = True
Whether to display the 'Functions' or 'Methods' sections in the object's docstring.
show_docstring_modules class-attribute instance-attribute ¤
show_docstring_modules: bool = True
Whether to display the 'Modules' section in the object's docstring.
show_docstring_other_parameters class-attribute instance-attribute ¤
show_docstring_other_parameters: bool = True
Whether to display the 'Other Parameters' section in the object's docstring.
show_docstring_parameters class-attribute instance-attribute ¤
show_docstring_parameters: bool = True
Whether to display the 'Parameters' section in the object's docstring.
show_docstring_raises class-attribute instance-attribute ¤
show_docstring_raises: bool = True
Whether to display the 'Raises' section in the object's docstring.
show_docstring_receives class-attribute instance-attribute ¤
show_docstring_receives: bool = True
Whether to display the 'Receives' section in the object's docstring.
show_docstring_returns class-attribute instance-attribute ¤
show_docstring_returns: bool = True
Whether to display the 'Returns' section in the object's docstring.
show_docstring_type_aliases class-attribute instance-attribute ¤
show_docstring_type_aliases: bool = True
Whether to display the 'Type Aliases' section in the object's docstring.
show_docstring_type_parameters class-attribute instance-attribute ¤
show_docstring_type_parameters: bool = True
Whether to display the 'Type Parameters' section in the object's docstring.
show_docstring_warns class-attribute instance-attribute ¤
show_docstring_warns: bool = True
Whether to display the 'Warns' section in the object's docstring.
show_docstring_yields class-attribute instance-attribute ¤
show_docstring_yields: bool = True
Whether to display the 'Yields' section in the object's docstring.
show_if_no_docstring class-attribute instance-attribute ¤
show_if_no_docstring: bool = False
Show the object heading even if it has no docstring or children with docstrings.
show_inheritance_diagram class-attribute instance-attribute ¤
show_inheritance_diagram: bool = False
Show the inheritance diagram of a class using Mermaid.
show_labels class-attribute instance-attribute ¤
show_labels: bool = True
Whether to show labels of the members.
show_object_full_path class-attribute instance-attribute ¤
show_object_full_path: bool = False
Show the full Python path of every object.
show_overloads class-attribute instance-attribute ¤
show_overloads: bool = True
Show the overloads of a function or method.
show_root_full_path class-attribute instance-attribute ¤
show_root_full_path: bool = True
Show the full Python path for the root object heading.
show_root_heading class-attribute instance-attribute ¤
show_root_heading: bool = False
Show the heading of the object at the root of the documentation tree.
The root object is the object referenced by the identifier after :::.
show_root_members_full_path class-attribute instance-attribute ¤
show_root_members_full_path: bool = False
Show the full Python path of the root members.
show_root_toc_entry class-attribute instance-attribute ¤
show_root_toc_entry: bool = True
If the root heading is not shown, at least add a ToC entry for it.
show_signature class-attribute instance-attribute ¤
show_signature: bool = True
Show methods and functions signatures.
show_signature_annotations class-attribute instance-attribute ¤
show_signature_annotations: bool = False
Show the type annotations in methods and functions signatures.
show_signature_type_parameters class-attribute instance-attribute ¤
show_signature_type_parameters: bool = False
Show the type parameters in generic classes, methods, functions and type aliases signatures.
show_source class-attribute instance-attribute ¤
show_source: bool = True
Show the source code of this object.
show_submodules class-attribute instance-attribute ¤
show_submodules: bool = False
When rendering a module, show its submodules recursively.
show_symbol_type_heading class-attribute instance-attribute ¤
show_symbol_type_heading: bool = False
Show the symbol type in headings (e.g. mod, class, meth, func and attr).
show_symbol_type_toc class-attribute instance-attribute ¤
show_symbol_type_toc: bool = False
Show the symbol type in the Table of Contents (e.g. mod, class, methd, func and attr).
signature_crossrefs class-attribute instance-attribute ¤
signature_crossrefs: bool = False
Whether to render cross-references for type annotations in signatures.
skip_local_inventory class-attribute instance-attribute ¤
skip_local_inventory: bool = False
Whether to prevent objects from being registered in the local objects inventory.
summary class-attribute instance-attribute ¤
summary: SummaryOption = field(default_factory=SummaryOption)
Whether to render summaries of modules, classes, functions (methods), attributes and type aliases.
toc_label class-attribute instance-attribute ¤
toc_label: str = ''
A custom string to override the autogenerated toc label of the root object.
type_parameter_headings class-attribute instance-attribute ¤
type_parameter_headings: bool = False
Whether to render headings for type parameters (therefore showing type parameters in the ToC).
unwrap_annotated class-attribute instance-attribute ¤
unwrap_annotated: bool = False
Whether to unwrap Annotated types to show only the type without the annotations.
coerce classmethod ¤
coerce(**data: Any) -> MutableMapping[str, Any]
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1059 1060 1061 1062 1063 1064 1065 1066 1067 | |
from_data classmethod ¤
from_data(**data: Any) -> Self
Create an instance from a dictionary.
Source code in src/mkdocstrings_handlers/python/_internal/config.py
1039 1040 1041 1042 | |
SphinxStyleOptions dataclass ¤
SphinxStyleOptions(
*,
warn_unknown_params: bool = True,
warn_missing_types: bool = True,
warnings: bool = True
)
Sphinx style docstring options.
Attributes:
-
warn_missing_types(bool) –Warn about missing type/annotation for return values.
-
warn_unknown_params(bool) –Warn about documented parameters not appearing in the signature.
-
warnings(bool) –Generally enable/disable warnings when parsing docstrings.
SummaryOption dataclass ¤
SummaryOption(
*,
attributes: bool = False,
functions: bool = False,
classes: bool = False,
modules: bool = False,
type_aliases: bool = False
)
Summary option.
Attributes:
-
attributes(bool) –Whether to render summaries of attributes.
-
classes(bool) –Whether to render summaries of classes.
-
functions(bool) –Whether to render summaries of functions (methods).
-
modules(bool) –Whether to render summaries of modules.
-
type_aliases(bool) –Whether to render summaries of type aliases.
attributes class-attribute instance-attribute ¤
attributes: bool = False
Whether to render summaries of attributes.
classes class-attribute instance-attribute ¤
classes: bool = False
Whether to render summaries of classes.
functions class-attribute instance-attribute ¤
functions: bool = False
Whether to render summaries of functions (methods).
do_as_attributes_section ¤
do_as_attributes_section(
context: Context, attributes: Sequence[Attribute], *, check_public: bool = True
) -> DocstringSectionAttributes
Build an attributes section from a list of attributes.
Parameters:
-
(attributes¤Sequence[Attribute]) –The attributes to build the section from.
-
(check_public¤bool, default:True) –Whether to check if the attribute is public.
Returns:
-
DocstringSectionAttributes–An attributes docstring section.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
do_as_classes_section ¤
do_as_classes_section(
context: Context, classes: Sequence[Class], *, check_public: bool = True
) -> DocstringSectionClasses
Build a classes section from a list of classes.
Parameters:
-
(classes¤Sequence[Class]) –The classes to build the section from.
-
(check_public¤bool, default:True) –Whether to check if the class is public.
Returns:
-
DocstringSectionClasses–A classes docstring section.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | |
do_as_functions_section ¤
do_as_functions_section(
context: Context, functions: Sequence[Function], *, check_public: bool = True
) -> DocstringSectionFunctions
Build a functions section from a list of functions.
Parameters:
-
(functions¤Sequence[Function]) –The functions to build the section from.
-
(check_public¤bool, default:True) –Whether to check if the function is public.
Returns:
-
DocstringSectionFunctions–A functions docstring section.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
do_as_modules_section ¤
do_as_modules_section(
context: Context, modules: Sequence[Module], *, check_public: bool = True
) -> DocstringSectionModules
Build a modules section from a list of modules.
Parameters:
-
(modules¤Sequence[Module]) –The modules to build the section from.
-
(check_public¤bool, default:True) –Whether to check if the module is public.
Returns:
-
DocstringSectionModules–A modules docstring section.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
do_as_type_aliases_section ¤
do_as_type_aliases_section(
context: Context, type_aliases: Sequence[TypeAlias], *, check_public: bool = True
) -> DocstringSectionTypeAliases
Build a type aliases section from a list of type aliases.
Parameters:
-
(type_aliases¤Sequence[TypeAlias]) –The type aliases to build the section from.
-
(check_public¤bool, default:True) –Whether to check if the type_alias is public.
Returns:
-
DocstringSectionTypeAliases–A type aliases docstring section.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | |
do_backlink_tree ¤
do_backlink_tree(backlinks: list[Backlink]) -> Tree[BacklinkCrumb]
Build a tree of backlinks.
Parameters:
Returns:
-
Tree[BacklinkCrumb]–A tree of backlinks.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
956 957 958 959 960 961 962 963 964 965 | |
do_crossref ¤
Deprecated. Filter to create cross-references.
Parameters:
-
(path¤str) –The path to link to.
-
(brief¤bool, default:True) –Show only the last part of the path, add full path as hover.
Returns:
-
Markup–Markup text.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
do_filter_objects ¤
do_filter_objects(
objects_dictionary: dict[str, Object | Alias],
*,
filters: Sequence[tuple[Pattern, bool]] | Literal["public"] | None = None,
members_list: bool | list[str] | None = None,
inherited_members: bool | list[str] = False,
keep_no_docstrings: bool = True
) -> list[Object | Alias]
Filter a dictionary of objects based on their docstrings.
Parameters:
-
(objects_dictionary¤dict[str, Object | Alias]) –The dictionary of objects.
-
(filters¤Sequence[tuple[Pattern, bool]] | Literal['public'] | None, default:None) –Filters to apply, based on members' names, or
"public". Each element is a tuple: a pattern, and a boolean indicating whether to reject the object if the pattern matches. -
(members_list¤bool | list[str] | None, default:None) –An optional, explicit list of members to keep. When given and empty, return an empty list. When given and not empty, ignore filters and docstrings presence/absence.
-
(inherited_members¤bool | list[str], default:False) –Whether to keep inherited members or exclude them.
-
(keep_no_docstrings¤bool, default:True) –Whether to keep objects with no/empty docstrings (recursive check).
Returns:
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
do_format_attribute ¤
do_format_attribute(
context: Context,
attribute_path: Markup,
attribute: Attribute,
line_length: int,
*,
crossrefs: bool = False,
show_value: bool = True
) -> str
Format an attribute.
Parameters:
-
(context¤Context) –Jinja context, passed automatically.
-
(attribute_path¤Markup) –The path of the callable we render the signature of.
-
(attribute¤Attribute) –The attribute we render the signature of.
-
(line_length¤int) –The line length.
-
(crossrefs¤bool, default:False) –Whether to cross-reference types in the signature.
Returns:
-
str–The same code, formatted.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
do_format_code ¤
do_format_code(code: str, line_length: int) -> str
Format code.
Parameters:
Returns:
-
str–The same code, formatted.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
do_format_signature ¤
do_format_signature(
context: Context,
callable_path: Markup,
function: Function,
line_length: int,
*,
annotations: bool | None = None,
crossrefs: bool = False
) -> str
Format a signature.
Parameters:
-
(context¤Context) –Jinja context, passed automatically.
-
(callable_path¤Markup) –The path of the callable we render the signature of.
-
(function¤Function) –The function we render the signature of.
-
(line_length¤int) –The line length.
-
(annotations¤bool | None, default:None) –Whether to show type annotations.
-
(crossrefs¤bool, default:False) –Whether to cross-reference types in the signature.
Returns:
-
str–The same code, formatted.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
do_format_type_alias ¤
do_format_type_alias(
context: Context,
type_alias_path: Markup,
type_alias: TypeAlias,
line_length: int,
*,
crossrefs: bool = False
) -> str
Format a type alias.
Parameters:
-
(context¤Context) –Jinja context, passed automatically.
-
(type_alias_path¤Markup) –The path of the type alias we render the signature of.
-
(type_alias¤TypeAlias) –The type alias we render the signature of.
-
(line_length¤int) –The line length.
-
(crossrefs¤bool, default:False) –Whether to cross-reference types in the signature.
Returns:
-
str–The same code, formatted.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
do_get_template ¤
Get the template name used to render an object.
Parameters:
-
(env¤Environment) –The Jinja environment, passed automatically.
-
(obj¤str | Object) –A Griffe object, or a template name.
Returns:
-
str–A template name.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
do_multi_crossref ¤
Deprecated. Filter to create cross-references.
Parameters:
-
(text¤str) –The text to scan.
-
(code¤bool, default:True) –Whether to wrap the result in a code tag.
Returns:
-
Markup–Markup text.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
do_order_members ¤
do_order_members(
members: Sequence[Object | Alias],
order: Order | list[Order],
members_list: bool | list[str] | None,
) -> Sequence[Object | Alias]
Order members given an ordering method.
Parameters:
-
(members¤Sequence[Object | Alias]) –The members to order.
-
(order¤Order | list[Order]) –The ordering method.
-
(members_list¤bool | list[str] | None) –An optional member list (manual ordering).
Returns:
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
do_split_path ¤
Split object paths for building cross-references.
Parameters:
-
(path¤str) –The path to split.
-
(full_path¤str) –The full path, used to compute correct paths for each part of the path.
Yields:
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
get_handler ¤
get_handler(
handler_config: MutableMapping[str, Any], tool_config: MkDocsConfig, **kwargs: Any
) -> PythonHandler
Return an instance of PythonHandler.
Parameters:
-
(handler_config¤MutableMapping[str, Any]) –The handler configuration.
-
(tool_config¤MkDocsConfig) –The tool (SSG) configuration.
-
(**kwargs¤Any, default:{}) –Additional arguments to pass to the handler.
Returns:
-
PythonHandler–An instance of
PythonHandler.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
config ¤
Deprecated. Import from mkdocstrings_handlers.python directly.
handler ¤
Deprecated. Import from mkdocstrings_handlers.python directly.
rendering ¤
Deprecated. Import from mkdocstrings_handlers.python directly.