-
Notifications
You must be signed in to change notification settings - Fork 240
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
dogfooding new remote types #2334
Comments
Thanks for the report:
We should look in to that!
If I understand correctly, that's intended - only types actually used are exposed to foreign bindings. I might be misunderstanding though, so an example would be appreciated.
To be clear, the problem you are having is that uniffi_test doesn't really work in that scenario because there's no opportunity to put the generated files into the correct package structure? But for your "real" use of that code, it's fine because you can change that structure? If so, that's a good and interesting point. We welcome ideas (or even better, PRs :) which tried to address this. |
Yes and no. In core crate:
In binding crate:
In python binding:
But It could be wonderful if binding crate registers |
We have some examples of this - eg, here's a custom type in a "core" crate and here is where it is used in a "binding" crate - and here's the Python test for that function So I'm not sure what the difference is in what you are reporting versus what we have tests for. |
Because |
Sorry, but bouncing back to that first issue (#2352, thanks for that info!)
I don't see how I'll try and get more insight into the |
Haha, because the binding and core crates are both owned by me, and I would use |
So the only thing left here is Python and I agree that's a bit of a mess. We don't use python + uniffi, so I'd love to hear your thoughts on how this might work with multiple crates and packages. It seems wrong to insist the .so is next to the .py even without that consideration. Maybe we should open a new issue for improving the python package story? Really happy to hear you've been using this for so long and it keeps working for you! I'd love your feedback on #2355 too! |
The change of #2355 is welcomed because the more type info, the more good. 👍 Talking about python binding, actually, we're using python + uniffi only when testing. Thank you for response, I'm totally satisfied. |
Hello, I'm using the new merged #2317 to avoid some callback wrappings between uniffi binding and core crate. And it's served well, but I still find some glitches, and want to share here.
As a old project starting with
uniffi v0.17
, we have a mixedudl
andprocmacro
for binding crate, and onlyprocmacro
for core crate.udl: Remote for interface
[Enum]
It seems the old interface enum cannot be annotated both with
[Enum]
and[Remote]
, because[Enum]
is specified it must be the only attribute.And
[External=...]
is a workaround. It doesn't really matter to me.procmacro: bindings for custom types
The custom types in core crate without referenced by other core uniffi types, are not visible in python bindings (maybe all other bindings, neither?), and it seems due to
extract_from_library
doesn't give a code for custom types?I have to do a dummy
uniffi::Record
to export them. I can stay with this.python: ImportError: attempted relative import with no known parent package
We use uniffi's bindgen-tests feature to run python test. However, it throws the above error message because core crate is already a root package.
I tried with
bindings.python.external_packages
to give core crate a namespace, andcargo test
still lacks the structure. More importantly, the core binding should be the same directory as the dylib file, because it callsctypes.cdll.LoadLibrary
!I have to manually create a directory beside the test file, move all generated assets under it, import them from that package, and run
python test_binding.py
by hand... It's painful, so I have to disable the test.That's all my journey, and thank you all for the hard working!
The text was updated successfully, but these errors were encountered: