Skip to content

Add doctest examples to the public SCS API (0 runnable examples today) #240

Description

@tschm

Subcategory: executable documentation
Current → target: 6 → 9

Problem

There are no runnable examples anywhere in the source. The doc-example checker reports:

"docstrings": { "source_root": "scs", "files": 1, "examples": 0, "locations": [] }
"notes": ["no doctest examples found — docstring coverage says nothing about whether the
          docstrings are true, and here there is nothing to check"]

Every public symbol in scs/py/__init__.py carries prose documentation — LinearSolver,
SCS.__init__, SCS.solve, SCS.update — but none of it is executable, so nothing verifies
that what the docstrings claim is still true. This is the failure with the longest half-life
in a library: the docstring keeps rendering perfectly after the behaviour changes underneath it.

Two related gaps in the same file, worth closing at the same time:

  • the SCS class itself (scs/py/__init__.py:87) has no class docstring
  • the public legacy solve() function (scs/py/__init__.py:218) has only a # comment
    above it, not a docstring

Files / lines to change

  • scs/py/__init__.py:186 (SCS.solve), :205 (SCS.update), :218 (legacy solve) —
    add >>> examples
  • scs/py/__init__.py:87 — add a class docstring for SCS
  • wire --doctest-modules (or the doc-example checker with --run) into a CI job

Done when

SCS.solve, SCS.update and the legacy solve() each carry a >>> example, and those
doctests are executed by CI rather than only rendered.

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions