diff --git a/src/module_writer.rs b/src/module_writer.rs index 4e4102267..8ea835a10 100644 --- a/src/module_writer.rs +++ b/src/module_writer.rs @@ -621,7 +621,11 @@ pub fn write_bindings_module( // Reexport the shared library as if it were the top level module writer.add_bytes( &module.join("__init__.py"), - format!("from .{} import *\n", module_name).as_bytes(), + format!( + "from .{module_name} import *\n\n__doc__ = {module_name}.__doc__\n", + module_name = module_name + ) + .as_bytes(), )?; let type_stub = rust_module.join(format!("{}.pyi", module_name)); if type_stub.exists() { diff --git a/test-crates/pyo3-pure/src/lib.rs b/test-crates/pyo3-pure/src/lib.rs index e8aed975a..01b691ae6 100644 --- a/test-crates/pyo3-pure/src/lib.rs +++ b/test-crates/pyo3-pure/src/lib.rs @@ -11,6 +11,7 @@ impl DummyClass { } } +/// module level doc string #[pymodule] fn pyo3_pure(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?;