This issue I believe is related to unresolved issue I voiced awhile back as well as the multi-crate features added in #2208.
I currently have a Python project I'm hoping can leverage an external crate's UniFFI .udl to export Python bindings for the crate. Right now I just have the external crate added as a dependency and have the following in my lib.rs:
pub use odict::*;
odict::uniffi_reexport_scaffolding!();
Running maturin develop, the following files get generated:
__init__.py
libuniffi_pyodict.dylib
odict.py
Inside __init__.py, it attempts to export from a nonexistent module:
from .pyodict import * # NOQA
Similarly, odict.py attempts to read from libpyodict.dylib, which doesn't exist unless I manually override the cdylib name to be pyodict, but that could be a separate issue.
I looked at the source code and saw this __init__.pyseems to be hardcoded to use the current project's name. I think this could be fixed by #1910, as it includes a change to init.py that isn't present in #2208. Clarity on the cdylib issue would also be appreciated!
Your maturin version (maturin --version)
1.7.4
Your Python version (python -V)
3.13.0
Your pip version (pip -V)
24.3.1
What bindings you're using
uniffi
Does cargo build work?
[X] Yes, it works
If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?
Bug Description
Hey folks,
This issue I believe is related to unresolved issue I voiced awhile back as well as the multi-crate features added in #2208.
I currently have a Python project I'm hoping can leverage an external crate's UniFFI .udl to export Python bindings for the crate. Right now I just have the external crate added as a dependency and have the following in my
lib.rs
:Running
maturin develop
, the following files get generated:__init__.py
libuniffi_pyodict.dylib
odict.py
Inside
__init__.py
, it attempts to export from a nonexistent module:Similarly,
odict.py
attempts to read fromlibpyodict.dylib
, which doesn't exist unless I manually override the cdylib name to bepyodict
, but that could be a separate issue.I looked at the source code and saw this
__init__.py
seems to be hardcoded to use the current project's name. I think this could be fixed by #1910, as it includes a change to init.py that isn't present in #2208. Clarity on the cdylib issue would also be appreciated!Your maturin version (
maturin --version
)1.7.4
Your Python version (
python -V
)3.13.0
Your pip version (
pip -V
)24.3.1
What bindings you're using
uniffi
Does
cargo build
work?If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash
/
)?Steps to Reproduce
Described above