You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Zheaoli (via GitHub)" <gi...@apache.org> on 2023/12/18 15:40:25 UTC
[I] idea: Make Python type hint more complete [incubator-opendal]
Zheaoli opened a new issue, #3773:
URL: https://github.com/apache/incubator-opendal/issues/3773
For now, we have different services. Each service has their own argument, it a little bit had to use.
So I think maybe we can use the `overload` to help as solve this issue
```python
from typing import AsyncIterable, Iterable, Optional, Literal, overload
from opendal.layers import Layer
class Operator:
@overload
def __init__(self, scheme: Literal["fs"], root: str): ...
@overload
def __init__(
self,
scheme: Literal["s3"],
bucket: str,
endpoint: str,
region: str,
access_key_id: str,
secret_access_key: str,
security_token: str,
default_storage_class: str,
server_side_encryption: str,
server_side_encryption_aws_kms_key_id: str,
server_side_encryption_customer_algorithm: str,
server_side_encryption_customer_key: str,
server_side_encryption_customer_key_md5: str,
disable_config_load: str,
enable_virtual_host_style: str,
): ...
def __init__(self, scheme: str, **kwargs): ...
```
If we write the hint for the params which are depend by the service, the developer can full use the IDE/Editor/LSP code completion function like


--
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: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [opendal]
Posted by "asukaminato0721 (via GitHub)" <gi...@apache.org>.
asukaminato0721 commented on issue #3773:
URL: https://github.com/apache/opendal/issues/3773#issuecomment-2682833218
oh, this fix the issue https://github.com/apache/opendal/pull/5457
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3773:
URL: https://github.com/apache/opendal/issues/3773#issuecomment-2684190555
Thank you @asukaminato0721 for the research. Let's close this old issue.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [incubator-opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3773:
URL: https://github.com/apache/incubator-opendal/issues/3773#issuecomment-1860907982
Cool! But I'm worried about maintenance. Maybe it's time for us to introduce some code generation 🥹
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #3773: idea: Make Python type hint more complete
URL: https://github.com/apache/opendal/issues/3773
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [incubator-opendal]
Posted by "Zheaoli (via GitHub)" <gi...@apache.org>.
Zheaoli commented on issue #3773:
URL: https://github.com/apache/incubator-opendal/issues/3773#issuecomment-1860934661
> Cool! But I'm worried about maintenance. Maybe it's time for us to introduce some code generation 🥹
This is exactly what I want(
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] idea: Make Python type hint more complete [opendal]
Posted by "asukaminato0721 (via GitHub)" <gi...@apache.org>.
asukaminato0721 commented on issue #3773:
URL: https://github.com/apache/opendal/issues/3773#issuecomment-2676359787
If I guess it correctly, all the `config.rs` includes one of
`__init__` typing hint. Like <https://github.com/apache/opendal/blob/main/core/src/services/aliyun_drive/config.rs>
So do codegen from code can be a method.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org