This is an automated email from the ASF dual-hosted git repository.

psiace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new f12c89197 fix(bindings/python): improve the typing discovering of the 
python package (#7180)
f12c89197 is described below

commit f12c891972a8adeb10bae178900cf13fa7b3976f
Author: Frost Ming <[email protected]>
AuthorDate: Thu Feb 5 19:18:28 2026 +0800

    fix(bindings/python): improve the typing discovering of the python package 
(#7180)
    
    fix(bindings/python): improve the typing discovering of the python
    package.
    
    Expose __version__ attribute correctly.
---
 bindings/python/python/opendal/__init__.py | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/bindings/python/python/opendal/__init__.py 
b/bindings/python/python/opendal/__init__.py
index 92daf93cc..77f0687c6 100644
--- a/bindings/python/python/opendal/__init__.py
+++ b/bindings/python/python/opendal/__init__.py
@@ -16,19 +16,25 @@
 # under the License.
 
 # ruff: noqa: D104
-import builtins
+from __future__ import annotations
 
-from opendal._opendal import (  # noqa: F403
-    capability,
-    exceptions,
-    file,
-    layers,
-    services,
-    types,
-)
-from opendal.operator import AsyncOperator, Operator  # pyright:ignore
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+    __version__: str
+    from opendal import capability, exceptions, file, layers, services, types
+else:
+    from opendal._opendal import (
+        __version__,  # noqa: F401
+        capability,
+        exceptions,
+        file,
+        layers,
+        services,
+        types,
+    )
 
-__version__: builtins.str
+from opendal.operator import AsyncOperator, Operator  # pyright:ignore
 
 __all__ = [
     "capability",

Reply via email to