Skip to main content

rendering.AttributeRenderer

The presentation of an attribute or property, with its annotation and value

Usage

Source

rendering.AttributeRenderer(
    node,
    level=1,
    contained=False,
    page_path=None,
    display_name_format="doc",
    signature_name_format="doc",
    *,
    renderers=_default_renderers(),
    extension=_default_extension(),
    context_page_path=None,
    _purpose=_RenderingPurpose.OBJECT,
)

The description shows the subject, then the declaration, without a Usage row. On a typing-variable page the declaration leaves out the name, which the page already shows, and a PEP 613 type alias leaves out its TypeAlias annotation. Only properties show Raises, Warns, Yields and Receives sections.

Parameter Attributes

node: (
    APIReference
    | content.DocClass
    | content.DocFunction
    | content.DocAttribute
    | content.DocTypeAlias
    | content.DocModule
    | content.Page
    | content.Section
)

The node being documented

level: int = 1

The heading depth of this appearance

contained: bool = False

Whether this object is documented inside another object’s documentation

A contained member’s summary row links to its heading on the same page, and its context reports the containing page.

page_path: str | None = None

The page that this object’s summary row links to

API pages supply a path relative to the reference directory. None links within the current page, and contained members always link to a local anchor. For the containing page relative to the output directory, use context.page_path.

display_name_format: DisplayNameFormat = "doc"

Format for the display name

signature_name_format: DisplayNameFormat = "doc"

Format for the signature name

renderers: Renderers = _default_renderers()

Renderer choices shared with nested objects, pages and summaries

extension: Extension = _default_extension()

The extension that supplies settings and project directories

A standalone renderer uses default settings and has no project directories.

context_page_path: str | None = None

The containing page’s path relative to the output directory, apart from summary links

_purpose: _RenderingPurpose = _RenderingPurpose.OBJECT

Functions

Name Description
__post_init__() Narrow doc and obj to attribute documentation
docstring_sections_content() The docstring sections without Returns
render_description() Render the subject followed by the declaration, without a Usage row
render_raises_section() Render a Raises section on a property
render_receives_section() Render a Receives section on a property
render_signature() Render the declaration with the omissions that typing pages need
render_warns_section() Render a Warns section on a property
render_yields_section() Render a Yields section on a property