Skip to content

DOC: Update table docstrings to clarify parameters and defaults - #20217

Merged
taldcroft merged 1 commit into
astropy:mainfrom
taldcroft:table-fix-docstring-arguments
Aug 7, 2026
Merged

taldcroft merged 1 commit into
astropy:mainfrom
taldcroft:table-fix-docstring-arguments

Conversation

@taldcroft

@taldcroft taldcroft commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

AI disclosure

This PR was entirely generated by AI (Claude Opus 5) and @taldcroft reviewed the changes.

Description

This pull request is to fix inconsistencies between function signatures and their
numpydoc Parameters sections throughout the astropy.table subpackage.

All 22 modules in astropy/table were audited with an AST-based checker that compares
each function/method signature against its docstring in both directions: parameters
documented but absent from the signature, signature parameters missing from the
docstring, parameter ordering disagreement, documented-vs-actual default values, and
__new__/__init__ signature agreement.

The changes are documentation-only — no runtime behavior is modified.

Incorrect documented default (user-visible)

  • BaseColumn.pprint documented show_dtype as "Default is True" when the signature
    default is False.

Undocumented parameters in public API

  • Column and MaskedColumn class docstrings omitted copy and copy_indices.
    Note that the copy default is None, not True: it is forwarded to
    np.array(..., copy=...) and therefore follows NumPy 2 semantics, where False
    raises ValueError if a copy cannot be avoided. This was verified empirically
    rather than assumed, and is documented accordingly.
  • Table.insert_row omitted index from Parameters (it was only described in the
    prose above the section).
  • simple_table omitted masked, despite the docstring's own example calling
    simple_table(3, 6, masked=True, kinds='ifOS').

Parameter ordering mismatches

  • unique documented keep before silent; the signature is
    unique(input_table, keys=None, silent=False, keep="first"). Both are commonly
    passed positionally, so the documented order was actively misleading.
  • notebook_backends.classic documented table_class before css and
    display_length; the signature has it after.

Undocumented parameters in internal functions

  • _join: added keys_left and keys_right, reusing the wording already present on
    the public join.
  • _vstack: added metadata_conflicts, matching the public vstack wording.
  • table_info: added tbl.
  • Table._convert_string_dtype: added encode_decode_func. The description was
    checked against the two call sites, which pass np.strings.decode / np.strings.encode
    as a UTF-8 fallback after the fast ASCII path fails.
  • TableFormatter._pformat_col, _pformat_col_iter, _pformat_table, and
    _more_tabcol: added the leading col / table / tabcol argument, which is the
    primary subject of each of these methods.
  • TableFormatter._pformat_table: fixed "Default is to False" to "Default is False".
  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@taldcroft taldcroft added this to the v8.1.0 milestone Aug 6, 2026
@pllim pllim modified the milestones: v8.1.0, v8.0.2, v7.2.3 Aug 6, 2026
@pllim pllim added Bug backport-v7.2.x on-merge: backport to v7.2.x backport-v8.0.x on-merge: backport to v8.0.x table labels Aug 6, 2026

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pllim

pllim commented Aug 6, 2026

Copy link
Copy Markdown
Member

Have to wait for GHA to come back online first.

@taldcroft
taldcroft force-pushed the table-fix-docstring-arguments branch from b79a882 to aa6c898 Compare August 7, 2026 13:11
@taldcroft
taldcroft merged commit 440fe54 into astropy:main Aug 7, 2026
37 of 38 checks passed
@taldcroft
taldcroft deleted the table-fix-docstring-arguments branch August 7, 2026 15:03
@lumberbot-app

This comment was marked as outdated.

@lumberbot-app

This comment was marked as outdated.

MaanasArora pushed a commit to MaanasArora/astropy that referenced this pull request Aug 10, 2026
@pllim

pllim commented Aug 10, 2026

Copy link
Copy Markdown
Member

Hmm if auto backport not possible, I guess I'll move it back to original milestone not to backport. Sorry for the noise!

@pllim pllim modified the milestones: v7.2.3, v8.1.0 Aug 10, 2026
@pllim pllim removed Still Needs Manual Backport backport-v7.2.x on-merge: backport to v7.2.x backport-v8.0.x on-merge: backport to v8.0.x labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants