Skip to content

Conversation

@TennyZhuang
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

The Python SDK could only delete objects one at a time, which meant callers had to loop and missed out on the batch deletion facilities exposed by the core Operator.

What changes are included in this PR?

  • add Operator.delete_many and AsyncOperator.delete_many wrappers over the core delete_iter API
  • document the new helpers in the generated type stubs
  • extend sync and async delete tests to cover bulk deletion

Are there any user-facing changes?

  • Added Operator.delete_many / AsyncOperator.delete_many for batch deletions.
  • Tests: pytest tests/test_sync_delete.py tests/test_async_delete.py with OPENDAL_TEST=memory.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Oct 16, 2025
@TennyZhuang TennyZhuang changed the title feat(python): add delete_many helpers feat(python): add delete_many API Oct 16, 2025
-------
None
"""
async def delete_many(self, paths: Iterable[PathBuf]) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could just make delete accept this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated it according to your suggestion, but I feel the updated code is a bit complex.

There are two ways to achieve this goal:

Use the current approach in the PR, hack the function in the Python layer to do forwarding.
Accept a generic object as a parameter in Rust, then check the PyType type in Rust and forward accordingly.
Both methods significantly impact readability and seem to introduce unnecessary complexity. If you agree, I can roll back this PR.

None
"""
async def delete_many(self, paths: Iterable[PathBuf]) -> None:
"""Delete multiple objects in a single request.
Copy link
Member

Choose a reason for hiding this comment

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

There is no guarantee about this.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants