-
|
This behavior shows up in my real projects and in a clean project using >>> import pyo3_test
>>> dir(pyo3_test)
['__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'pyo3_test', 'sum_as_string']Why does >>> dir(pyo3_test.pyo3_test)
['__all__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'sum_as_string'] |
Beta Was this translation helpful? Give feedback.
Answered by
ravenexp
Mar 18, 2026
Replies: 1 comment 1 reply
-
|
This happens because maturin creates a Python package containing an extension module with the same name, rather than a bare extension module.
There are good reasons to use this layout, such as adding Python type stubs files (.pyi) to the package (see PEP 561). |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
pydsigner
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This happens because maturin creates a Python package containing an extension module with the same name, rather than a bare extension module.
pyo3_test.pyo3_testin your case refers to the inner extension module (the DSO/DLL binary built with rustc).There are good reasons to use this layout, such as adding Python type stubs files (.pyi) to the package (see PEP 561).