Skip to content

Improve docstrings across all hand-written modules for pdoc#21

Merged
guenp merged 1 commit into
mainfrom
improve-pdoc-docstrings
Apr 24, 2026
Merged

Improve docstrings across all hand-written modules for pdoc#21
guenp merged 1 commit into
mainfrom
improve-pdoc-docstrings

Conversation

@splch

@splch splch commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds comprehensive Google-style docstrings to every hand-written module so the pdoc-generated API reference site (https://ionq.github.io/ionq-core-python/) is useful as standalone documentation.

Landing page (__init__.py + Jinja template):

  • Quick start, authentication, and job submission code examples
  • Key features overview with clickable cross-reference links to every major symbol (IonQClient, SessionManager, iter_jobs, etc.)

Per-module improvements:

  • ionq_client.py - IonQClient now has full Args, Returns, Raises, and three Examples (env var, explicit config, async context manager)
  • _exceptions.py - Exception hierarchy diagram in the module docstring; APIError attributes (status_code, body, message, request_id) and RateLimitError.retry_after documented; raise_for_status has full Args/Raises
  • _extensions.py - All 11 ClientExtension fields documented in an Attributes section; EventHook/AsyncEventHook protocol methods have Args; HookTransport has behavioral description and Args; module-level usage example
  • _gates.py - Parameter conventions and type alias descriptions in module docstring; variable docstrings for Matrix2x2/Matrix4x4; Args/Returns/Examples on all four gate functions
  • _pagination.py - All 4 public functions have Args, Yields, Raises; module-level example
  • _polling.py - JobTimeoutError/JobFailedError attributes documented; both wait_for_job and async_wait_for_job have Args/Returns/Raises; module-level example
  • _session.py - SessionManager class docstring with constructor Args and sync/async context manager examples; all public methods documented
  • _transport.py - Variable docstrings for RETRYABLE_STATUS_CODES and DEFAULT_MAX_RETRIES; ErrorRaisingTransport and build_transport fully documented

No code logic was changed - only docstrings and the __init__.py Jinja template.

Test plan

  • uv run ruff check passes on all modified files
  • uv run ruff format --check passes on all modified files
  • uv run pytest - all 218 tests pass, 100% coverage maintained
  • uv run pdoc -o docs/ -d google ionq_core generates cleanly
  • Verified cross-reference links (IonQClient, ClientExtension, SessionManager, iter_jobs, wait_for_job, etc.) resolve to clickable anchors in the generated HTML
  • Verified no reST artifacts (:class:) appear in the rendered output
  • Verified code examples render with syntax highlighting
  • Verified ClientExtension Attributes section renders all 11 field descriptions

Important

Most code in ionq_core/ is auto-generated. Do not edit files under ionq_core/api/,
ionq_core/models/, or ionq_core/client.py, errors.py, types.py directly.
See CONTRIBUTING.md for details.

Add comprehensive Google-style docstrings to every hand-written module
so that the pdoc-generated API reference site is useful on its own.

- Replace the one-line __init__.py module docstring with a full landing
  page (quick start, authentication, job submission examples, and a
  key-features overview with cross-reference links to every major symbol)
- Update the Jinja template to match so regeneration preserves the
  landing page
- Add Args, Returns, Raises, Yields, Examples, and Attributes sections
  to IonQClient, all exception classes, ClientExtension, EventHook,
  AsyncEventHook, HookTransport, SessionManager, all pagination helpers,
  both polling functions, ErrorRaisingTransport, and build_transport
- Document module-level constants (RETRYABLE_STATUS_CODES,
  DEFAULT_MAX_RETRIES) and type aliases (Matrix2x2, Matrix4x4) with
  variable docstrings so they appear in the generated docs
- Add exception hierarchy diagram to _exceptions module docstring
- Add module-level usage examples to _extensions, _pagination, _polling,
  _session, and _gates

@guenp guenp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm!

@guenp guenp merged commit 9a8310e into main Apr 24, 2026
9 checks passed
@guenp guenp deleted the improve-pdoc-docstrings branch April 24, 2026 21:26
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