Polish docstrings for the documentation site: fix silent mis-rendering, fill missing docstrings, add module intros#127
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A docstring-polish pass following up on the documentation site: the
-Wbuild 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):
`x`vs``x``in reST) — inreload_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.reload_all's INPUT section (over-indented bullets plus a floating "INPUTS passed to reload" fragment — rewritten as one proper list), thelist_indexes/list_constraintsNOTE bullets, and thePostgresStatsTableschema documentation (over-indented list continuations plus two literal blocks missing their::). Now 0 (was 6).!objfragments on the encoding page: ourDumper.dumpoverrides 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:
PostgresSearchTableitself (the class users actually hold) — a real class docstring describing the dictionary-query interface and pointing at the guides.PostgresTable(copy_to_meta/copy_to_indexes/copy_to_constraints,reload_*,revert_*— documenting the_histversioning contract) andfinalize_changes(honestly labeled a placeholder).RealEncoder/dumper classes),setup_connection,NumericLoader.load,jsonb_idx,LockError,range_formatter,QueryLogFilter.filter,Configuration.get_postgresql_default.Seven module docstrings added —
base,config,database,searchtable,statstable,table,utilshad 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 avalid_colsparameter that doesn't exist (dropped); a markdown-style link in_parse_projectionbecame prose; "supset"/"werefalse" typos; thePostgresStatsTableintro now mentionstable.statsand marks thelmfdb.utils.display_statsreference as the LMFDB integration point.Verified:
sphinx -W --keep-goingclean; 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 — 137sage:prompts, 21 docstrings still importing lmfdb — to>>>with psycodict-only setup, optionally as real doctests against the CI Postgres service.🤖 Generated with Claude Code