Skip to content

docs(api): dataclass fields without an Attributes section ship bare autodoc stubs #720

Description

@tony

autodoc renders every field of a NamedTuple, dataclass, or TypedDict whether or not the docstring describes it. An undocumented NamedTuple field reaches the API docs as "Alias for field number 0"; a dataclass or TypedDict field reaches it bare. AGENTS.md now requires an Attributes section covering every field, and this issue tracks the code that predates that rule.

9 classes are missing an Attributes entry for 414 fields in total.

Rendered on the published site today

These modules are named by an autodoc directive under docs/, so the stubs are live in the API docs right now.

  • ServerOptions (dataclass) in libtmux._internal.constants — missing backspace, buffer_limit, command_alias, default_terminal, copy_command, escape_time, editor, exit_empty, exit_unattached, extended_keys, focus_events, history_file, +9 more
  • SessionOptions (dataclass) in libtmux._internal.constants — missing activity_action, assume_paste_time, base_index, bell_action, default_command, default_shell, default_size, destroy_unattached, detach_on_destroy, display_panes_active_colour, display_panes_colour, display_panes_time, +41 more
  • WindowOptions (dataclass) in libtmux._internal.constants — missing aggressive_resize, automatic_rename, automatic_rename_format, clock_mode_colour, clock_mode_style, fill_character, main_pane_height, main_pane_width, copy_mode_match_style, copy_mode_mark_style, copy_mode_current_match_style, mode_keys, +34 more
  • PaneOptions (dataclass) in libtmux._internal.constants — missing allow_passthrough, allow_rename, alternate_screen, cursor_colour, pane_colours, cursor_style, remain_on_exit, remain_on_exit_format, scroll_on_clear, synchronize_panes, window_active_style, window_style, +5 more
  • Hooks (dataclass) in libtmux._internal.constants — missing alert_activity, alert_bell, alert_silence, client_active, client_attached, client_detached, client_focus_in, client_focus_out, client_resized, client_session_changed, pane_died, pane_exited, +78 more
  • Pane (dataclass) in libtmux.pane — missing default_option_scope, default_hook_scope, server
  • Session (dataclass) in libtmux.session — missing default_option_scope, default_hook_scope
  • Window (dataclass) in libtmux.window — missing default_option_scope, default_hook_scope, server

Not rendered yet

No API page names these modules, so nothing ships today — but each one becomes a stub the moment the module gets an autodoc directive.

  • Obj (dataclass) in libtmux.neo — missing server, active_window_index, alternate_saved_x, alternate_saved_y, bracket_paste_flag, buffer_name, buffer_sample, buffer_size, client_activity, client_cell_height, client_cell_width, client_control_mode, +167 more

Fixing one

Add a NumPy-style Attributes section naming every field, with its type and what it holds:

class Example(t.NamedTuple):
    """One-line summary.

    Attributes
    ----------
    path : pathlib.Path | None
        What this field holds, and what ``None`` means.
    """

Partial coverage does not help: a class with three fields and two documented still ships a stub for the third.


Links are permalinks anchored to v0.62.0; a file that changed since the last release is linked at the current trunk commit instead. Produced by a static AST scan of the package for NamedTuple, dataclass, and TypedDict classes whose docstring omits a field, excluding tests and private classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions