Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid exports in __init__.py when UniFFI project doesn't include .udl files #2294

Closed
1 of 2 tasks
Nickersoft opened this issue Nov 9, 2024 · 0 comments · Fixed by #2305
Closed
1 of 2 tasks

Invalid exports in __init__.py when UniFFI project doesn't include .udl files #2294

Nickersoft opened this issue Nov 9, 2024 · 0 comments · Fixed by #2305
Labels
bug Something isn't working

Comments

@Nickersoft
Copy link
Contributor

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:

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__.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?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

Described above

@Nickersoft Nickersoft added the bug Something isn't working label Nov 9, 2024
@Nickersoft Nickersoft changed the title Invalid exports in __init__.py when UniFFI project doesn't include .udl files Invalid exports in __init__.py when UniFFI project doesn't include .udl files Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant