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

Uniffi multiple crates not supported #1904

Open
1 of 2 tasks
Hinton opened this issue Jan 4, 2024 · 0 comments · May be fixed by #1910
Open
1 of 2 tasks

Uniffi multiple crates not supported #1904

Hinton opened this issue Jan 4, 2024 · 0 comments · May be fixed by #1910
Labels
bindings/uniffi uniffi bindings enhancement New feature or request

Comments

@Hinton
Copy link
Contributor

Hinton commented Jan 4, 2024

Bug Description

Uniffi supports using types from dependent crates, https://mozilla.github.io/uniffi-rs/proc_macro/index.html#types-from-dependent-crates. Consider a crate a which depends on b. This results in two python files being generated, a.py and b.py.

The types exposed by crate a are exported in a.py, and b in b.py. In order to correctly use the library both python files needs to be imported.

The sample repository https://github.com/Hinton/maturin-repro produces the following wheel:

a.whl
  a/
    __init__.py
    a.py
    liba.dylib
  a-0.1.0.dist-info/

As noted, b.py is missing which is referenced by a.py.

Your maturin version (maturin --version)

1.4.0

Your Python version (python -V)

3.9.6

Your pip version (pip -V)

21.2.4

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

  1. Checkout https://github.com/Hinton/maturin-repro
  2. Run maturin build
  3. Unpack target/wheels/a-0.1.0-py3-none-macosx_11_0_arm64.whl
  4. Note missing b.py.
  5. Attempt to run and get an error complaining about b missing since it's imported from a.py.
@Hinton Hinton added the bug Something isn't working label Jan 4, 2024
@messense messense added the bindings/uniffi uniffi bindings label Jan 7, 2024
@Hinton Hinton linked a pull request Jan 9, 2024 that will close this issue
@messense messense added enhancement New feature or request and removed bug Something isn't working labels Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/uniffi uniffi bindings enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants