Skip to content

Polish docstrings for the documentation site: fix silent mis-rendering, fill missing docstrings, add module intros#127

Merged
roed314 merged 2 commits into
roed314:mainfrom
roed-math:docstring-polish
Jul 22, 2026
Merged

Polish docstrings for the documentation site: fix silent mis-rendering, fill missing docstrings, add module intros#127
roed314 merged 2 commits into
roed314:mainfrom
roed-math:docstring-polish

Conversation

@roed-math

Copy link
Copy Markdown

A docstring-polish pass following up on the documentation site: the -W build gate catches reST that warns, but plenty renders silently wrong. This PR fixes everything found by auditing the built HTML for bad-render artifacts (plus an AST scan of the sources for their causes), and fills the documentation gaps the site made visible. No code changes — docstrings, comments and one docstring typo only.

Silent mis-rendering, all fixed (verified by re-scanning the built pages):

  • 22 single-backtick spans rendered as italic "title references" instead of code (`x` vs ``x`` in reST) — in reload_all, cleanup_all, create_table, search, reload_final_swap, the stats methods, DelayCommit, filter_sql_injection, and others. Now 0 <cite> artifacts on the API pages (was 21) and 0 bare spans anywhere in the sources.
  • 6 mis-indented blocks rendered as stray blockquotes: reload_all's INPUT section (over-indented bullets plus a floating "INPUTS passed to reload" fragment — rewritten as one proper list), the list_indexes/list_constraints NOTE bullets, and the PostgresStatsTable schema documentation (over-indented list continuations plus two literal blocks missing their ::). Now 0 (was 6).
  • Three foreign !obj fragments on the encoding page: our Dumper.dump overrides had no docstrings, so autodoc inherited psycopg's, whose role-suppression markup only renders inside psycopg's own docs. Fixed by documenting the overrides.

Missing docstrings filled — every class-level public member autodoc renders now has one:

  • PostgresSearchTable itself (the class users actually hold) — a real class docstring describing the dictionary-query interface and pointing at the guides.
  • The meta export/reload/revert family on PostgresTable (copy_to_meta/copy_to_indexes/copy_to_constraints, reload_*, revert_* — documenting the _hist versioning contract) and finalize_changes (honestly labeled a placeholder).
  • The encoding protocol methods (including the Sage-only RealEncoder/dumper classes), setup_connection, NumericLoader.load, jsonb_idx, LockError, range_formatter, QueryLogFilter.filter, Configuration.get_postgresql_default.

Seven module docstrings addedbase, config, database, searchtable, statstable, table, utils had none, so their API pages opened with a bare heading. Each now begins with a short orientation paragraph (what lives here, how it relates to the rest).

Small content fixes along the way: filter_sql_injection's INPUT listed a valid_cols parameter that doesn't exist (dropped); a markdown-style link in _parse_projection became prose; "supset"/"werefalse" typos; the PostgresStatsTable intro now mentions table.stats and marks the lmfdb.utils.display_stats reference as the LMFDB integration point.

Verified: sphinx -W --keep-going clean; 0 <cite> / 0 <blockquote> artifacts across all API pages (from 21/6); 0 bare single-backtick spans by AST scan; ruff check . clean.

Not in this PR (the agreed separate follow-up): modernizing the EXAMPLES:: blocks — 137 sage: prompts, 21 docstrings still importing lmfdb — to >>> with psycodict-only setup, optionally as real doctests against the CI Postgres service.

🤖 Generated with Claude Code

roed314 and others added 2 commits July 22, 2026 03:51
An audit of the rendered API reference (scanning the built HTML for
bad-render artifacts, and the sources for their causes) found problems
in three classes, all fixed here without changing any code:

- Silent mis-rendering: 22 single-backtick spans rendered as italic
  title references instead of code, and six mis-indented docstring
  blocks rendered as stray blockquotes (reload_all's INPUT section,
  the list_indexes/list_constraints notes, and several lists and
  unmarked literal blocks in the PostgresStatsTable schema docs).
  Also three foreign `!obj` fragments on the encoding page, inherited
  from psycopg's Dumper docstrings via undocumented overrides.

- Missing docstrings on rendered API: PostgresSearchTable itself, the
  meta copy/reload/revert family and finalize_changes on
  PostgresTable, the encoding protocol methods, setup_connection,
  jsonb_idx, LockError, range_formatter and get_postgresql_default.

- Seven modules (base, config, database, searchtable, statstable,
  table, utils) had no module docstring, so their API pages opened
  with a bare heading; each now has a short orientation paragraph.

Also drops a stale 'valid_cols' parameter from filter_sql_injection's
docstring, converts a markdown link in _parse_projection to prose, and
fixes a couple of typos.  Verified: sphinx -W clean, zero <cite> and
<blockquote> artifacts on the built API pages (was 21 and 6), zero
bare single-backtick spans in any docstring, ruff clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The audit's follow-up sweep (a full AST walk rather than top-level
iteration) caught four more public members without docstrings, inside
the sage-guarded block of encoding.py: RealEncoder, its getquoted, and
the dump methods of RealLiteralDumper and SageIntegerDumper.  Every
public class, method and function in the package now has a docstring.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@read-the-docs-community

Copy link
Copy Markdown

@roed314
roed314 merged commit bac6dc5 into roed314:main Jul 22, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants