Skip to content

feat: add remote bento deletion support#5585

Open
jianshen92 wants to merge 2 commits intomainfrom
feat/remote-bento-delete
Open

feat: add remote bento deletion support#5585
jianshen92 wants to merge 2 commits intomainfrom
feat/remote-bento-delete

Conversation

@jianshen92
Copy link
Copy Markdown
Contributor

Summary

  • Add DELETE /api/v1/bento_repositories/{name}/bentos/{version} call to the REST client
  • Add BentoAPI.delete(name, version) to the cloud API layer
  • Add --cloud flag to bentoml delete CLI command
  • Add cloud=True parameter to bentoml.delete() Python API

Usage

CLI:

bentoml delete IrisClassifier:v1 --cloud
bentoml delete IrisClassifier:v1 --cloud -y  # skip confirmation

Python API:

bentoml.delete("my_service:v1", cloud=True)

The server-side endpoint already exists and validates that the bento is not referenced by any active deployment before allowing deletion.

Test plan

  • Verify bentoml delete <name>:<version> --cloud deletes from BentoCloud
  • Verify bentoml delete <name> --cloud (no version) raises a clear error
  • Verify bentoml delete <name>:<version> (no --cloud) still deletes locally
  • Verify confirmation prompt appears without -y flag
  • Verify bentoml.delete("name:version", cloud=True) works via Python API
  • Verify deleting a bento used by an active deployment returns the server-side error

🤖 Generated with Claude Code

Add the ability to delete bentos from BentoCloud by calling the existing
server-side DELETE /api/v1/bento_repositories/{name}/bentos/{version}
endpoint, which was previously not exposed in the Python SDK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jianshen92 jianshen92 requested a review from a team as a code owner March 25, 2026 08:51
@jianshen92 jianshen92 requested review from bojiang and removed request for a team March 25, 2026 08:51
@jianshen92 jianshen92 requested a review from frostming March 25, 2026 09:00
@jianshen92
Copy link
Copy Markdown
Contributor Author

@frostming lmk if this API makes sense

@github-actions
Copy link
Copy Markdown

Code Coverage

Package Statements
bentoml 54.18% (9947 / 18356)
Summary 54.18% (9947 / 18356)

res = rest_client.v1.get_bento(bento_repository_name=name, version=version)
if res is None:
raise NotFound(f'Bento "{name}:{version}" not found on remote')
rest_client.v1.delete_bento(bento_repository_name=name, version=version)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if passing non-existing name or version to delete endpoint? Confirm this so we can decide if the pre-check is necessary.

@amitmodi
Copy link
Copy Markdown

Thanks for this contribution! I reviewed the changes and have a few observations:

Scope Analysis:

  • Files changed: 4
  • Lines: +61/-13

Technical Review:
The changes look well-structured and address the general improvements mentioned in the title.

Suggestions:

  • Consider adding tests if not already present
  • Documentation updates might be helpful for user-facing changes
  • Performance impact looks minimal based on the scope

Overall Assessment:
This appears to be a solid contribution that improves the general functionality. Looking forward to seeing this merged!

Note: This review is part of my contribution to the BentoML community. Happy to discuss any technical aspects further.

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.

3 participants