Skip to content

Conversation

@chitralverma
Copy link
Contributor

@chitralverma chitralverma commented Feb 5, 2026

Which issue does this PR close?

Closes #.
Links to: #6748

Rationale for this change

This PR refactors the Python bindings for OpenDAL by renaming internal Rust structs with a Py prefix and removing the services module.

The changes prepare the py bindings codebase for a future split/ reorganization by simplifying the API surface.

What changes are included in this PR?

  • Renamed Rust types (OperatorPyOperator, AsyncOperatorPyAsyncOperator, CapabilityPyCapability) using the name attribute in #[pyclass] to maintain the same Python-facing API. this was done to avoid confusion with core types.
  • Removed the services module and Scheme enum, simplifying operator constructors to accept only string schemes in line with core
  • Updated stub files with proper __all__ exports and fixed type annotations (adding | None to optional parameters). this is because pyo3-stub-gen>=0.18 uses a different logic to render stubs.
  • Updated dependencies: bumped pyo3-stub-gen to 0.18, relaxed version constraints on other dependencies
  • Modified build configuration in pyproject.toml and updated justfile scripts
  • Simplified base __init__.py for better discovery

Are there any user-facing changes?

Yes.

Following breaking changes have been introduced:

  • service module is removed from rust and py side for these bindings
  • Service overload python stubs for for operators have been removed for now. This will come back with the new split version.
  • The lint extra group has been removed, and its dependencies (ruff) have been moved to the dev group. This is a breaking change for users who may have been using pip install opendal[lint].

AI Usage Statement

None

Copilot AI review requested due to automatic review settings February 5, 2026 11:25
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" labels Feb 5, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Python bindings for OpenDAL by renaming internal Rust structs with a Py prefix and removing the services module. The changes prepare the codebase for a potential split or reorganization by simplifying the API surface.

Changes:

  • Renamed Rust types (OperatorPyOperator, AsyncOperatorPyAsyncOperator, CapabilityPyCapability) using the name attribute in #[pyclass] to maintain the same Python-facing API
  • Removed the services module and Scheme enum, simplifying operator constructors to accept only string schemes
  • Updated stub files with proper __all__ exports and fixed type annotations (adding | None to optional datetime parameters)
  • Updated dependencies: bumped pyo3-stub-gen to 0.18, relaxed version constraints on other dependencies
  • Modified build configuration in pyproject.toml and updated justfile scripts

Reviewed changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
bindings/python/src/operator.rs Renamed structs to PyOperator/PyAsyncOperator, simplified constructors, added deprecation to scan() methods
bindings/python/src/capability.rs Renamed Capability to PyCapability with proper Python name mapping
bindings/python/src/lib.rs Removed services module, updated struct references, added #[allow(deprecated)]
bindings/python/python/opendal/__init__.py Changed import from _opendal to _core, removed services from exports
bindings/python/python/opendal/__init__.pyi Added new stub file with module exports
bindings/python/python/opendal/services.pyi Deleted entire file (87 lines) containing Scheme enum
bindings/python/python/opendal/operator/__init__.pyi New stub file replacing old operator.pyi, simplified constructor signatures
bindings/python/python/opendal/types/__init__.pyi Added __all__ exports and updated ruff noqa
bindings/python/python/opendal/layers/__init__.pyi Added __all__ exports
bindings/python/python/opendal/file/__init__.pyi Added __all__ exports
bindings/python/python/opendal/exceptions/__init__.pyi Added __all__ exports
bindings/python/python/opendal/capability/__init__.pyi Added __all__ exports
bindings/python/Cargo.toml Updated dependencies with relaxed version constraints, bumped pyo3-stub-gen
bindings/python/pyproject.toml Removed maturin features/strip, merged lint into dev, updated dependencies
bindings/python/justfile Improved build scripts with better formatting and cleanup logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +44
@echo "{{ BOLD }}--- Removing build directories, other caches, python bytecode and compiled extensions ---{{ NORMAL }}"
@find . \
\( -type d \( -name __pycache__ -o -name .venv -o -name .build -o -name dist -o -name .pytest_cache -o -name .mypy_cache -o -name .hypothesis -o -name .ruff_cache \) -prune -exec rm -rf {} + \) \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same logic as before, just done in 1 command now

@chitralverma chitralverma requested a review from Xuanwo February 5, 2026 11:52

from opendal.operator import AsyncOperator, Operator # pyright:ignore
from opendal._opendal import * # ty: ignore
from opendal.operator import AsyncOperator, Operator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@frostming as you made some recent changes, can you check this out, if this works ?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, it reverts my change and the typecheckers can't find types, because opendal._opendal is not typed.

In fact I don't understand why you moved *.pyi into its own package. it looks less clean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact I don't understand why you moved *.pyi into its own package. it looks less clean

This is done by a recent update of pyo3-stub-gen that is used to generate stubs. the inclusion of all the entries in __all__ is actually working much better for me with both ty and pyright in zed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@chitralverma chitralverma changed the title refactor: Update Stubs and dependencies for split refactor(bindings/python): Update Stubs and dependencies for split Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants