vprusso/toqito

docs: add missing Raises: sections to function docstrings

Open

#1,888 opened on Jul 25, 2026

 (1 comment) (0 reactions) (0 assignees)Python (154 forks)github user discovery
documentationgood first issue

Repository metrics

Stars
 (277 stars)
PR merge metrics
 (PR metrics pending)

Description

Many functions raise ValueError/TypeError on bad input but do not document it in a Raises: docstring section. Adding these sections makes the API self-documenting and surfaces the conditions in the rendered docs.

What to do

For a function that raises but has no Raises: section, add one listing each exception and the condition that triggers it, in the Google style used elsewhere in the codebase:

    Raises:
        ValueError: If `dim` does not evenly divide the input.

Good targets (pick a few per PR):

  • toqito/channel_ops/kraus_to_choi.py
  • toqito/channel_props/channel_dim.py
  • toqito/channels/amplitude_damping.py, bitflip.py, phase_damping.py, ldot_channel.py
  • toqito/matrices/cyclic_permutation.py

List each raise and its condition with:

git grep -nE "raise (Value|Type)Error" toqito/<file>

Verifying

uv sync --group docs
cd docs && uv run mkdocs build

Confirm the new Raises: section renders on the function's docs page.

Contributor guide