chitralverma opened a new pull request, #9426: URL: https://github.com/apache/opendal/pull/9426
# Which issue does this PR close? Part of #9321 (tracker: #9320). # Rationale for this change Python cannot compose objects. Only `gcs` composes today. Typical uses, shown in the `Operator.compose` docstring: - Parallel upload: write parts from a thread pool, compose them, then delete them. - Compaction: compose listed small objects with a per-source `if_not_changed`, then delete them with the same condition. - Append: core rejects a `target` that is also a source (`IsSameFile`). Copy the current version, compose `[head, tail]` with `if_version_match`, and pass the returned `version` to the next append. # What changes are included in this PR? - `Operator.compose(sources, target, **kwargs) -> Metadata` wraps `blocking::Operator::compose_options` (#9423). `AsyncOperator.compose` wraps `Operator::compose_options`. - `sources` is `Iterable[str | PathLike[str] | ComposeSource]`. `ComposeSource` is a `TypedDict`: `path: Required[str | PathLike[str]]`, `version`, `if_match`, `if_not_changed: Metadata`. - The generator makes `ComposeKwargs` (12 keys) and `ComposeSource` from core, with docs in Python names. New keys accept `None`. - Not included: the incremental `Composer`, and `Entry` or tuples as sources. # Are there any user-facing changes? - New `compose` methods, and new `opendal.options` types `ComposeKwargs` and `ComposeSource`. - `compose()` raises `TypeError` before any request for a single path or dict as `sources`, an unknown key, or a source without `path`. A dict whose type defines `__fspath__` is a path, as in `delete_many`. Verified: on fake-gcs-server 1.52.2, sync and async: `[a, a, b]` gives `aabc` and length 4, source `version`, `PathLike` paths, target metadata, each documented exception, and the docstring examples (single deletes: the emulator has no batch delete). Mutations such as reversed sources, dropped metadata, `()` from async, and dropped options fail the new tests. Suite on `memory` and `fs`, native and abi3; `just stub-gen`, `lint`, `test-typing`; Sphinx `-W -n`; `dev` tests; `ci_odev.yml` generators with `git diff --exit-code`. Not verified: real GCS (the nightly `gcs` job runs the new tests). The emulator ignores compose preconditions and source generations. # Breaking changes None. # AI Usage Statement - **Harness:** Claude Code via T3 Code | **Model:** Claude Opus 5.5 | **Effort:** xhigh - **Role:** Implemented the changes and tests, verified them on fake-gcs-server, and drafted this text. The author reviews every change and claim. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
