python Β€
Python handler for mkdocstrings.
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_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_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
748 749 750 751 752 753 754 755 756 757 758 | |
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
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | |
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
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | |
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_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
73 74 75 76 77 78 79 80 81 82 83 84 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 | |
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.
global_options instance-attribute Β€
global_options = 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
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 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 | |
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
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 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
383 384 385 386 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 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 | |
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
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
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
311 312 313 314 315 316 317 318 319 320 321 | |
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
454 455 456 457 458 459 460 461 462 | |
get_inventory_urls Β€
Return the URLs of the inventory files to download.
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
128 129 130 | |
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
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
get_templates_dir Β€
Return the path to the handler's templates directory.
Override to customize how the templates directory is found.
Parameters:
-
(handlerΒ€str | None, default:None) βThe name of the handler to get the templates directory of.
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
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 | |
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.BaseHandler.load_inventory).
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
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
normalize_extension_paths Β€
Resolve extension paths relative to config file.
Parameters:
Returns:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
351 352 353 354 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 | |
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
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 | |
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
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
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
276 277 278 279 280 281 | |
update_env Β€
Update the Jinja environment with custom filters and tests.
Parameters:
Source code in src/mkdocstrings_handlers/python/_internal/handler.py
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 | |
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"] = 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:
-
coerceβCreate an instance from a dictionary.
-
from_dataβCreate an instance from a dictionary.
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
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
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
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 | |
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
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | |
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
685 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 | |
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
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | |
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
859 860 861 862 863 864 865 866 867 868 | |
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
439 440 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 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 | |
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
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 | |
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
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
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
146 147 148 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 | |
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
270 271 272 273 274 275 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 | |
do_get_template Β€
Get the template name used to render an object.
Parameters:
Returns:
-
strβA template name.
Source code in src/mkdocstrings_handlers/python/_internal/rendering.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
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
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 | |
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
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
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
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |