Skip to content

Add a Sphinx documentation site: MyST guides + autodoc API reference on Read the Docs#122

Merged
roed314 merged 6 commits into
roed314:mainfrom
roed-math:sphinx-docs
Jul 22, 2026
Merged

Add a Sphinx documentation site: MyST guides + autodoc API reference on Read the Docs#122
roed314 merged 6 commits into
roed314:mainfrom
roed-math:sphinx-docs

Conversation

@roed-math

Copy link
Copy Markdown

A documentation site for psycodict: Sphinx + MyST-Parser + autodoc, furo theme, served on Read the Docs, with the build wired into CI so it can never silently rot.

Structure. The narrative guides are the existing root-level Markdown files — README (as "Getting started"), QueryLanguage, Searching, DataManagement, MetadataFormats — which docs/conf.py copies into docs/ at build time. That keeps the GitHub-rendered copies canonical (no duplication, no moved files, no broken deep links) while their relative links to one another turn into working site links. The API reference is one automodule page per module (all eleven), plus a hand-written map of how the pieces fit; the Sage-convention docstrings (INPUT:/OUTPUT: blocks, EXAMPLES:: transcripts, :meth:/:class: roles) are plain reST and render as-is. GitHub-style heading anchors are enabled so the guides' intra-page #links keep working; intersphinx links Python and psycopg references.

The build contract. A fifth CI job (docs, ~40s, no database — importing psycodict doesn't connect) runs sphinx-build -W --keep-going, and .readthedocs.yaml sets fail_on_warning to match: a broken cross-reference or malformed docstring fails the build rather than degrading the site. Getting to zero warnings surfaced eight real glitches, fixed in the first commit: over-/staircase-indented bullet continuations in the search/lucky INPUT blocks (docutils parses those as stray block quotes), an unterminated ``LISTEN``ed inline literal in NotificationListener, missing H1 titles in QueryLanguage.md and DataManagement.md (GitHub renders those better now too), and a Searching.md TOC link pointing at a raw <a name> anchor Markdown processors don't index (the anchor stays, so old deep links still work).

Build locally with:

pip install '.[pgbinary]' -r docs/requirements.txt
python -m sphinx -W --keep-going -b html docs docs/_build/html

One manual step to go live: import the repository at https://about.readthedocs.com (dashboard → Import a Project). From then on the RTD GitHub app builds every push and gives pull-request preview builds; once 1.0 is tagged, activate the tag under Versions so /stable/ serves the release while /latest/ tracks master.

Deliberately left to #113 (to avoid conflicts with the release capstone, which owns README and pyproject): adding Documentation = "https://psycodict.readthedocs.io" to [project.urls] and a docs badge to the README — one line each.

Future work (noted, not attempted here): the EXAMPLES:: blocks use sage: prompts and several still say from lmfdb import db — relics of the extraction, so they're illustrative rather than runnable. Rewriting them to >>> with psycodict-only setup would let them run as real doctests against the CI PostgreSQL service.

Verified: local build passes with zero warnings; ruff check . clean (conf.py included); built HTML spot-checked — furo assets, guide cross-links resolved to .html, the search/lucky parameter lists render as proper bullets, the notifications Forking/Hot standbys sections and the #parameters anchor all present.

🤖 Generated with Claude Code

roed314 and others added 4 commits July 22, 2026 02:12
- search/lucky INPUT blocks: bullet continuation lines were over- or
  staircase-indented, which docutils parses as stray block quotes and
  broken definition lists (three errors per docstring under Sphinx).
  Whitespace-only reflow; rendered text unchanged.
- NotificationListener: ``LISTEN``ed leaves the inline literal
  unterminated (no separator after the closing backticks); reworded.
- QueryLanguage.md and DataManagement.md had no top-level title (they
  began at ##); added H1s, which the site needs for navigation and
  which GitHub renders better too.
- Searching.md's table of contents pointed at a raw <a name> anchor
  that Markdown processors do not index; point it at the heading's own
  slug (the anchor itself stays, so old deep links keep working).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sphinx + MyST-Parser + autodoc with the furo theme, designed to be
served on Read the Docs.  The narrative guides are the existing
root-level Markdown files, copied into docs/ at build time by conf.py
so the GitHub-rendered copies stay canonical and their relative links
keep working on the site; the API reference is one automodule page per
module, rendering the Sage-convention docstrings as-is.  A fifth CI
job builds with -W --keep-going, and .readthedocs.yaml sets
fail_on_warning to match, so a broken cross-reference or malformed
docstring fails rather than degrading the site.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Versioning.md (from the versioning-policy branch, merged here so this
builds standalone in either merge order) is linked from the README, so
the site must carry it: without the copy and the toctree entry the
combined tree failed sphinx -W with myst.xref_missing on the README
link.  Its own links (QueryLanguage, Searching, DataManagement,
MetadataFormats) all point at guides already on the site.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed-math

Copy link
Copy Markdown
Author

Review caught a cross-PR interaction with #123: it links Versioning.md from the README, but this site didn't copy or list it — the combined tree failed sphinx -W with myst.xref_missing on the README link (reproduced).

Fixed by stacking: versioning-policy is merged into this branch and Versioning.md is wired into _GUIDES, .gitignore and the toctree. Stacking (rather than just adding the wiring) keeps both merge orders green — wiring alone would make this PR's own docs build fail with FileNotFoundError until #123 landed, since conf.py copies every listed guide. If this merges first it simply brings #123's small content along, and #123 then merges as a no-op; if #123 merges first, the shared commit drops out of this diff.

Verified: combined build fails without the wiring, succeeds with it (sphinx -W --keep-going), Versioning.html is generated, the README link resolves to it, and Versioning.md's own links (QueryLanguage/Searching/DataManagement/MetadataFormats) all target guides already on the site.

roed314 and others added 2 commits July 22, 2026 03:04
Nothing on the site links to them yet, so this is not fixing a build
break -- it is preventing the next one: the moment a copied guide gains
a "see CONTRIBUTING.md" line, sphinx -W fails with myst.xref_missing
exactly as the README's Versioning.md link did.  Beyond the tripwire,
CONTRIBUTING.md was written around this site (its Documentation section
gives the sphinx -W build command) and links SECURITY.md plus all four
spec guides, so on the site those links now go live.  They sit under
their own Project caption rather than among the user guides.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed-math

Copy link
Copy Markdown
Author

Follow-up: main also gained CONTRIBUTING.md and SECURITY.md, so they're now carried on the site too (own "Project" toctree caption). CONTRIBUTING.md links SECURITY.md + all four spec guides — all resolve on-site — and its Documentation section already documents this PR's sphinx -W build. Wiring them now also removes the next xref tripwire: a future "see CONTRIBUTING.md" line in any copied guide would have re-broken -W exactly like the Versioning.md link did. Build verified clean.

@roed314
roed314 merged commit 53aac2d into roed314:main Jul 22, 2026
18 checks passed
roed314 added a commit that referenced this pull request Jul 22, 2026
The defaults key list from #119 and the warnings-as-errors docs build
from #122 first met when both merged: a nested bullet list needs blank
lines around it in reST, so the docs job (and the Read the Docs build)
failed on main with 'Unexpected indentation'.  Two blank lines fix it,
and the key list now renders as an actual nested list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
roed-math pushed a commit to roed-math/psycodict that referenced this pull request Jul 22, 2026
Rebased onto main, which absorbed everything this PR used to anticipate;
the reconciliation:

- Version: 1.0.0 is now set in psycodict.__init__.__version__, the single
  source of truth roed314#121 established -- pyproject keeps main's dynamic
  version, SPDX license string and >=3.9 floor, and this PR's classifiers
  drop the License:: entry (setuptools >= 77 rejects it next to an SPDX
  string) and the 3.8 entry.

- README: the rewrite now carries the Versioning.md pointer (roed314#123) in its
  Documentation list, which switches to relative links -- on the Sphinx
  site (roed314#122) those resolve to the copied guide pages, and they still
  render on GitHub; CHANGELOG and LICENSE stay absolute since neither is
  on the site.  Supported Python is 3.9+; blob/master URLs become
  blob/main.

- CHANGELOG: entries for the late wave -- sum/random honoring saving
  (roed314#118) and the 3.9 floor (roed314#121) under breaking changes; the docs site
  (roed314#122), Versioning.md/CONTRIBUTING/SECURITY and __version__ (roed314#121)
  under added; reload metafile+resort (roed314#114), update_from_file stats
  publication (roed314#115), copy_dumps delimiter escaping (roed314#116) under fixed;
  config.ini untracking (roed314#120), this release workflow and CITATION.cff
  (roed314#124) under infrastructure.

- release.yml: the flow notes now say bump __init__.__version__ and merge
  to main.

- Fixes the docs build on main, broken by the roed314#119 x roed314#122 crossing (roed314#119
  merged after roed314#122's last CI run): the Configuration docstring's nested
  defaults list needed blank lines to be valid RST under autodoc, and the
  README's relative LICENSE link had no target on the site.

Suite 857 passed / 36 skipped; ruff clean; sphinx -W clean; python -m
build + twine check --strict pass with Version 1.0.0,
License-Expression GPL-2.0-or-later, Requires-Python >=3.9 and no
License classifier in the wheel metadata.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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