Skip to content

feat: python code interpreter improvements#1190

Merged
AngeloDanducci merged 3 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1022
Jun 5, 2026
Merged

feat: python code interpreter improvements#1190
AngeloDanducci merged 3 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1022

Conversation

@AngeloDanducci
Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1022

Description

Updates the code interpreter to allow running in sandbox with packages and allow file output - ie matplotlib

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.

@AngeloDanducci AngeloDanducci requested a review from a team as a code owner June 3, 2026 07:54
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

This comment is managed by a bot. Editing it is fine — checking off boxes, adding notes — but please leave the HTML comment marker on the first line alone, otherwise checklist updates will break.

Tool PR Checklist

Use this checklist when adding or modifying tools in mellea/stdlib/tools/.

Protocol Compliance

  • Ensure compatibility with existing backends and providers
    • For most tools being added as functions, this means that calling convert_function_to_tool works

Integration

  • Tool exported in mellea/stdlib/tools/__init__.py or, if you are adding a library of tools, from your sub-module

@AngeloDanducci AngeloDanducci changed the title update python code interpreter feat: update python code interpreter Jun 3, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Jun 3, 2026
@AngeloDanducci AngeloDanducci changed the title feat: update python code interpreter feat: python code interpreter improvements Jun 3, 2026
Copy link
Copy Markdown
Contributor

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Some feedback from Claude — design lines up with #1022 and the helpers are deprecated cleanly. Follow-ups inline.

Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/execution_policy.py
Comment thread mellea/stdlib/tools/interpreter.py Outdated
Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/interpreter.py
Comment thread mellea/stdlib/tools/interpreter.py Outdated
Comment thread docs/examples/tools/python_tool_example.py Outdated
Comment thread test/stdlib/tools/test_python_tool.py Outdated
Comment thread test/stdlib/tools/test_python_tool.py Outdated
Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
@AngeloDanducci
Copy link
Copy Markdown
Contributor Author

Addressed the review feedback, also rebased on main go avoid some of the CI issues we ran into yesterday.

@AngeloDanducci AngeloDanducci requested a review from ajbozarth June 4, 2026 20:31
Copy link
Copy Markdown
Contributor

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Some feedback from Claude — re-reviewed, the 10 prior items are addressed. Three new RST holdouts inline (Example::, two .. deprecated::) — non-blocking, fits naturally into the docstring-sweep work item you just picked up. Worth folding "no RST in Google-style docstrings" into AGENTS.md as part of that.

a normal mellea installation).
ValueError: If any entry in `packages` is empty or begins with `-`.

Example::
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.

Per CONTRIBUTING.md, docstrings are Google-style — Example:: is RST. Should be a single colon (the indented block under it is already fine).

Suggested change
Example::
Example:

Heads up: since you just picked up the double-backtick docstring sweep, worth widening the scope to catch RST stragglers like this and the two .. deprecated:: blocks below in the same pass — and adding a line to AGENTS.md so the policy is "Google-style only, no RST" rather than just "no double backticks." Happy to defer all three to that work item.

Comment on lines +1202 to +1203
.. deprecated::
Use :func:`python_tool` instead::
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.

Same RST-vs-Google issue — .. deprecated:: is a Sphinx directive and the trailing :: on instead:: is an RST literal block. Google style uses a Deprecated: section.

Suggested change
.. deprecated::
Use :func:`python_tool` instead::
Deprecated:
Use `python_tool` instead:

Same pattern at line 1227-1228 below. Roll into the docstring sweep.

Comment on lines +1227 to +1228
.. deprecated::
Use :func:`python_tool` instead::
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.

Suggested change
.. deprecated::
Use :func:`python_tool` instead::
Deprecated:
Use `python_tool` instead:

Copy link
Copy Markdown
Contributor

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

That review above was meant to be an approve as the docstring nits are non-blocking

@AngeloDanducci
Copy link
Copy Markdown
Contributor Author

Sounds good, will merge as is and then pick up related doc string / AGENTS.md update in #1172

@AngeloDanducci AngeloDanducci added this pull request to the merge queue Jun 5, 2026
Merged via the queue into generative-computing:main with commit d5bef51 Jun 5, 2026
9 checks passed
@AngeloDanducci AngeloDanducci deleted the ad-1022 branch June 5, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Code Interpreter

2 participants