apache / apache/opendal

feat: Use factory mode to init the operator instance in Python binding

Open
#3,537 12 comments 0 reactions 1 assignee Claimed by @Zheaoli View on GitHub
bindings/python
Dominant language
Rust
Stars
5.4k
Forks
825
Avg merge
1d 14m
Merged PRs (30d)
127

Description

This could be better

```python
class Operator:
@classmethod
def from_config(scheme: str, **kwargs)-> Operator: ...

@classmethod
def from_async_operator(operator: AsyncOperator) -> Operator: ...

class AsyncOperator:
@classmethod
def from_config(scheme: str, **kwargs)-> AsyncOperator: ...

@classmethod
def from_operator(operator: Operator) -> AsyncOperator: ...
```

We use the factory mode instead of `__init__` completely

_Originally posted by @Zheaoli in https://github.com/apache/incubator-opendal/pull/3514#discussion_r1386123571_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.