Skip to content

fix: convert remaining rst docstrings#1244

Open
AngeloDanducci wants to merge 2 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1172
Open

fix: convert remaining rst docstrings#1244
AngeloDanducci wants to merge 2 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1172

Conversation

@AngeloDanducci

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1172

Description

Converts remaining RST docstrings

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
@AngeloDanducci AngeloDanducci requested review from a team, jakelorocco and nrfulton as code owners June 10, 2026 05:14
@AngeloDanducci AngeloDanducci requested a review from markstur June 10, 2026 05:14
@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026

@planetf1 planetf1 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.

A few gaps in the RST conversion — details inline.

Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/formatters/granite/base/io.py Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread mellea/stdlib/components/intrinsic/core.py Outdated
Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
@AngeloDanducci AngeloDanducci enabled auto-merge June 12, 2026 04:13

@planetf1 planetf1 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.

Thanks for the follow-up commit — the issues I flagged in the first round are all resolved: the Example: and Deprecated: fences in interpreter.py are in place, the CONTRIBUTING.md fence nesting is correct (4-backtick outer, 3-backtick inner), and the documents type annotation in intrinsic/core.py is now present. Approving with a few small suggestions below.

# Pattern for ``python ... `` blocks
python_blocks = re.findall(r"``python\s*\n(.*?)\n``", content, re.DOTALL)
# Pattern for ``python / ```python blocks (RST and Markdown)
python_blocks = re.findall(r"```?python\s*\n(.*?)\n```?", content, re.DOTALL)

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.

Nice catch making the fences RST-aware. One gap: the optional third backtick means we now also match python `` blocks, but all the existing tests in test_reqlib_python.py use triple-backtick Markdown — which the old regex already matched. So the new double-backtick path has no coverage. Worth adding a test case that feeds in something like:

``python
def f():
    return 1
``

...and asserts the block is extracted. That locks in the behaviour this change is actually for.

Args:
response (str | None): Assistant response. When `None`, extracted from the
last assistant output in `context`.
documents (collections.abc.Iterable[str | Document]): Documents used to generate `response`. Each element may be a

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.

Cosmetic only (ruff doesn't flag docstring prose), but this line runs long with the fully-qualified type inline. Breaking after the type keeps it aligned with the other args.

Suggested change
documents (collections.abc.Iterable[str | Document]): Documents used to generate `response`. Each element may be a
documents (collections.abc.Iterable[str | Document]): Documents used to
generate `response`. Each element may be a

"""Separate the system message from other messages.

:returns: Tuple of system message, if present, and remaining messages.
Returns:

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.

Not a regression — the old :returns: was just as vague — but since we're touching this, the signature gives us the element types and the conversion was a chance to make the Returns line precise.

Suggested change
Returns:
tuple[SystemMessage | None, list]: The system message if present
(else `None`), and the remaining non-system messages.

Comment thread mellea/core/utils.py
Comment on lines +112 to +113
Note: Prefer `log_context` as the primary API — it guarantees cleanup
(including restoring outer values on same-key nesting) even on exceptions.

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.

Tiny style nit while we're tidying these — Google style puts Note: on its own line with the body indented under it, matching how Args:/Raises: render. Inline works but is slightly inconsistent.

Suggested change
Note: Prefer `log_context` as the primary APIit guarantees cleanup
(including restoring outer values on same-key nesting) even on exceptions.
Note:
Prefer `log_context` as the primary APIit guarantees cleanup
(including restoring outer values on same-key nesting) even on exceptions.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: convert remaining RST docstring constructs to Google style

2 participants