chitralverma opened a new pull request, #7869:
URL: https://github.com/apache/opendal/pull/7869
# Which issue does this PR close?
No tracking issue. New feature for the Python binding.
# Rationale for this change
The Rust core exposes `Operator::from_uri` for URI-based construction (e.g.
`s3://bucket/path?region=us-east-1`), and the Node.js binding already surfaces
it as `Operator.fromUri`. The Python binding only supported scheme + kwargs
construction (`Operator("s3", ...)`), so URI-based construction was unavailable.
# What changes are included in this PR?
- Add `Operator.from_uri` and `AsyncOperator.from_uri` classmethods, backed
by the core `Operator::from_uri` registry path. Extra kwargs are merged over
URI-encoded options, matching the Node.js `fromUri` semantics.
- Replace `__getnewargs_ex__` with `__reduce__` on both classes. URI-built
operators store the raw URI, which the scheme-based `__new__` would normalize
and corrupt; `__reduce__` routes reconstruction through dedicated pickle
helpers on the private `_opendal` module. The scheme-based path is unchanged.
- Regenerated type stubs.
- Add `tests/test_from_uri.py`, wired into the shared service fixtures so it
runs across all services in CI. Includes a pickle round-trip test gated on the
`shared` capability.
# Are there any user-facing changes?
Yes. New `Operator.from_uri(uri, **kwargs)` and `AsyncOperator.from_uri(uri,
**kwargs)` classmethods. No breaking changes; existing constructors are
unaffected.
# AI Usage Statement
Implemented with assistance from an AI coding agent (opencode, Claude Opus).
All changes reviewed and validated locally (`cargo clippy`, `cargo fmt`,
`ruff`, `ty`, `pytest`).
--
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]