Skip to content

Uniffi multiple crates not supported #1904

@Hinton

Description

@Hinton

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions