Skip to content

Add a minimal Sphinx docs build with reno release notes - #43

Open
Jim Garrison (garrison) wants to merge 4 commits into
mainfrom
sphinx-docs
Open

Jim Garrison (garrison) wants to merge 4 commits into
mainfrom
sphinx-docs

Conversation

@garrison

Copy link
Copy Markdown
Member

This project had no docs build at all. This adds the smallest real one, modeled on qiskit-addon-sqd: an API reference generated from the existing docstrings, a working reno setup, and a CI job that fails a pull request when either breaks. Guides and notebooks are out of scope and can be layered on later.

What's here

  • docs/ with conf.py, a landing page, a release-notes page, and one API page per module (sbd, sbd.sbd_solver, sbd.device_config), using the qiskit-ecosystem theme.
  • releasenotes/ floored at earliest_version: 1.6.1, with no backfilled notes — reno attaches a note to the commit it lands in, so notes written now would show up under "Upcoming release" rather than under the shipped 1.6.1 tag.
  • A docs extra and tox -e docs / tox -e docs-clean environments.
  • .github/workflows/docs.yml, building on pushes and pull requests, deploying to GitHub Pages only from main.

Details

The docs environment builds and installs the wheel rather than just adding to sys.path, because autodoc has to import the package: the import name sbd doesn't match its directory python/, and only setuptools knows that mapping. That's also why the CI job installs MPI and BLAS.

linkcode_resolve uses two separate path spellings, since the installed directory (sbd/) differs from the in-repository one (python/); a single token would 404 on every "source" link. The sbd page excludes the sbd_solver member, which is in sbd.__all__ as a submodule while also having its own page — a duplicate object description, fatal under -W.

The build runs with -W, which surfaced two pre-existing docstring defects in python/, fixed here: an unmarked indented block in assemble_rdms becomes a literal block, and the over-indented alias list in init is reflowed to the indentation napoleon expects.

The deploy job needs GitHub Pages enabled on the repo with source set to "GitHub Actions". Until then it will fail on main; pull requests are unaffected since deploy is gated on refs/heads/main.


This pull request was generated by Claude Opus 5 under my guidance.

The project had no documentation build at all: no `docs/`, no reno, and no
docs CI. Everything user-facing lived in the README, whose hand-written
"API Reference" section duplicated the module structure by hand and was free
to drift from the code.

This adds the smallest thing that is actually real: an API reference generated
from the existing docstrings, a working reno setup, and a CI job that fails a
pull request when either breaks. Guides and notebooks are deliberately out of
scope and can be layered on later without redoing any of this.

Two properties of this package shaped the setup. First, autodoc needs the
package genuinely installed rather than merely on `sys.path`: the import name
`sbd` does not match its directory `python/`, and only setuptools knows the
`package-dir` mapping, so the docs environment builds and installs the wheel
like the test environments do. Second, importing `sbd` is cheap and GPU-free
because backends load lazily, so a CPU-only build on a GPU-less runner is
enough to document it.

Two details differ from the equivalent setup in qiskit-addon-sqd, where a
verbatim copy would have been wrong here:

- `linkcode_resolve` needs two separate spellings, since the installed
  directory (`sbd/`) and the in-repository directory (`python/`) differ. Using
  one token for both would 404 on every "source" link.
- The `sbd` page excludes the `sbd_solver` member. It appears in `sbd.__all__`
  as a submodule while also having a page of its own, which is a duplicate
  object description and therefore fatal under `-W`.

Enabling `-W` surfaced two pre-existing docstring defects, both fixed here: an
unmarked indented block in `assemble_rdms` is now a literal block, which also
renders the index formulas as intended, and the over-indented alias list in
`init` is reflowed to the indentation napoleon expects.

Note that reno only sees notes that git tracks, so a newly added note must be
staged before it renders. The release-notes page is also cached across
incremental builds; `tox -e docs-clean` forces it to be regenerated.

Assisted-by: Claude Opus 5
Comment thread docs/index.rst Outdated
#44 moved the examples from python/examples to examples/, grouped by basis
type, and split the installation documentation out of the README into
INSTALL.md. The landing page's getting-started paragraph predated both: it
sent readers to the README for the build environment variables, which are now
in INSTALL.md, and linked python/examples, which #44 left behind as a
signpost holding no scripts.

Name all three files for what they now cover.

Assisted-by: Claude Opus 5
The `sbd` module docstring and `DeviceConfig`'s both introduced an indented
example with a single colon, which RST reads as a blockquote of body text. The
examples were typeset as prose: the heading ran straight into the first line
("Usage:import sbd"), the blank lines inside collapsed, and the quotes were
rendered as curly ones.

Use the double colon that marks a literal block, as `assemble_rdms` already
does, so the examples get a real code block with highlighting.

Assisted-by: Claude Opus 5
@garrison
Jim Garrison (garrison) marked this pull request as ready for review October 7, 2026 17:55
@garrison Jim Garrison (garrison) added the documentation Improvements or additions to documentation label Oct 7, 2026
Sophia Wen (hfwen0502) added a commit that referenced this pull request Oct 7, 2026
#43's API reference documents every public-named function in sbd.sbd_solver,
because the module has no __all__. extract_carryover and
rank_carryover_from_amplitudes are internal to _solve_sci_core and would have
appeared there, so prefix them with an underscore. Nothing outside the module
calls them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant