.md →
ApiDoc API#
ApiDoc takes a Python class or function and renders what inspect can see about it —
the signature, a parameter table with types and defaults, the docstring, and any methods
and properties — as a formatted card in the notebook, without a docs build in the loop.
Useful when you are teaching a library in a notebook and want the reference sitting next
to the example instead of in another tab; show_private decides whether
underscore-prefixed methods show up.
See also: ModuleTreeWidget for inspecting a PyTorch module's structure, LiveEdit for showing what a function actually does when it runs, and CellTour for walking a reader through the notebook around it.
Bases: AnyWidget
Renders API documentation for a Python class or function in a notebook.
Examples:
Create an ApiDoc widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
A Python class or function to document. |
None
|
width
|
int
|
Maximum pixel width for the widget. |
700
|
show_private
|
bool
|
Whether to include _-prefixed methods. |
False
|
Source code in wigglystuff/api_doc.py
to_markdown #
Export the API documentation as a Markdown string.
Source code in wigglystuff/api_doc.py
Synced traitlets#
| Traitlet | Type | Notes |
|---|---|---|
doc |
dict |
Introspected documentation payload (auto-generated from the target object). |
width |
int |
Container width in pixels. |
show_private |
bool |
Whether to include private (underscore-prefixed) methods. |