diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index db58fe3f3485..871b8d0c4267 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -28,7 +28,7 @@ version = "0.30.3" [lib] crate-type = ["cdylib"] doc = false -name = "opendal" +name = "_opendal" [dependencies] chrono = { version = "0.4.24", default-features = false, features = ["std"] } @@ -37,3 +37,6 @@ opendal = { version = "0.30", path = "../../core" } pyo3 = { version = "0.18", features = ["chrono"] } pyo3-asyncio = { version = "0.18", features = ["tokio-runtime"] } tokio = "1" + +[package.metadata.maturin] +name = "opendal._opendal" diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 4b300767a7a7..bed528db520b 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -42,3 +42,4 @@ Repository = "https://github.com/apache/incubator-opendal" [tool.maturin] features = ["pyo3/extension-module"] +python-source = "python" diff --git a/bindings/python/python/opendal/__init__.py b/bindings/python/python/opendal/__init__.py new file mode 100644 index 000000000000..25e5f8eff07e --- /dev/null +++ b/bindings/python/python/opendal/__init__.py @@ -0,0 +1,6 @@ +from ._opendal import * + + +__doc__ = _opendal.__doc__ +__all__ = _opendal.__all__ + diff --git a/bindings/python/opendal.pyi b/bindings/python/python/opendal/__init__.pyi similarity index 100% rename from bindings/python/opendal.pyi rename to bindings/python/python/opendal/__init__.pyi diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 2688ee43cfde..44a486ef9c0c 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -447,7 +447,7 @@ fn format_pyerr(err: od::Error) -> PyErr { /// asyncio.run(main()) /// ``` #[pymodule] -fn opendal(py: Python, m: &PyModule) -> PyResult<()> { +fn _opendal(py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?;