Repository navigation
feat(bindings/python): generate Capability from core - #9123
Merged
Merged
Conversation
chitralverma
marked this pull request as ready for review
November 26, 2026 04:02
chitralverma
requested review from
Xuanwo,
Zheaoli,
messense and
tisonkun
as code owners
November 26, 2026 04:02
This was referenced Nov 26, 2026
Member
|
Please complete the Jcode entry in the PR description with the model and reasoning effort used. If Jcode did not expose an effort setting, please say so. AI Usage Statement requirements I checked the Python stubs at AI-generated review comment. |
This was referenced Nov 26, 2026
Contributor
Author
this is done and updates have been made. |
Render bindings/python/src/capability.rs from core/core/src/types/capability.rs via the shared dev/src/generate/capability.rs parser, so the Python binding exposes every core capability field with its core docs. The .pyi stub is derived by just stub-gen. The class docs note that the flags describe the underlying operator, so a flag can be true without a matching Python method. Run the Python binding CI when generators under dev/src/generate change. Part of apache#9122. Signed-off-by: Chitral Verma <chitralverma@gmail.com>
chitralverma
force-pushed
the
feat/generate-python-capability
branch
from
November 27, 2026 08:37
1ace801 to
3c5d58c
Compare
29 of 33 tasks
Xuanwo
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Part of #9122.
Rationale for this change
The Python
Capabilitywas copied from core by hand and had fallen behind: it exposed 50 of the 98 core fields, with reworded docs. Java (#8644) and .NET (#8146) already generateCapabilityfrom core throughdev/src/generate/capability.rs. This PR does the same for Python.What changes are included in this PR?
dev/src/generate/python.rs+dev/src/generate/python/capability_rs.j2:generate -l pythonnow rendersbindings/python/src/capability.rs(the struct andCapability::new) fromcore/core/src/types/capability.rs, using core's doc comments.bindings/python/python/opendal/capability.pyi: regenerated withjust stub-gen.bindings/python/ruff.toml: ignoreE501for the generatedcapability.pyi, the same as the existing rule for the generatedconfig.py, because core docs are copied verbatim..github/workflows/ci_bindings_python.yml: also run the Python binding CI whendev/src/generate/**changes.restore).The existing
check_generatedjob inci_odev.ymlalready runsgenerate -l pythonandcargo fmt, then fails on diff, andci_bindings_python.ymlregenerates the stubs and fails on diff, so future drift from core gets caught.Are there any user-facing changes?
Yes, additions only.
Operator.capability()now exposes all 98 core fields, 48 more than before (for examplecompose*,restore*,*_with_if_version_match,stat_with_override_*,list_with_glob,read_with_checksum,write_with_checksum). The 50 existing properties keep their names and types. Field docstrings now match core's wording.Breaking changes
AI Usage Statement
main, regeneratedcapability.rsand the stubs for the core fields added since (read_with_checksum,write_with_checksum), squashed the branch, and synced this description. Ran the generators,just stub-gen,just lint,just test-typing, and the Python tests against the memory service locally.