Skip to content

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

Draft
Jim Garrison (garrison) wants to merge 1 commit into
mainfrom
sphinx-docs
Draft

Jim Garrison (garrison) wants to merge 1 commit 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
Comment on lines +18 to +21
Installation, the environment variables that control which backends are compiled, and
runnable examples are documented in the `README
<https://github.com/Qiskit/sbd-eigensolver-python/blob/main/README.md>`__ in the root
of this project's repository. Example scripts and a notebook live in `python/examples

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This sentence may need a slight tweak once #44 merges.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant