-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Examples using Python-specific data structures? #26
Comments
@pganssle milksnake does not care how you declare your CABI. Basically you can only use datastructures that C gives you, and you have to reimplement everything on top. Yes, it's difficult, involves a lot of hand-written unsafe code and is rarely worth it. I would recommend keeping your interface between Rust and Python to a minimum because of that. Consider writing some sort of RPC interface that communicates over a socket instead of all of this. A project that uses this with a relatively clean CABI is semaphore. Even there we once minimized the function signatures by JSON-encoding function arguments, passing them as single string, and decoding them on the other side, because it was easier and fast enough. Error handling is also very painful. I wrote https://github.com/untitaker/shippai because of this but it hasn't gained traction. We don't use it inside of sentry, but basically hand-write error enums. |
I'm certainly gathering that I do still think a "Projects using milksnake" section in the |
milksnake is IMO clear about the fact that it's solely responsible for embedding dynamic libraries into Python packages. It does not generate C bindings, it does not mention Rust except for the example. I agree wrt "Projects using milksnake". |
The
README
(is there more documentation somewhere?) only has a very trivial example of how to use this, and it's not immediately clear how to do anything very complicated. For example, how would I:list
?It is possible that these are "out of scope" for this library (which I gather is very low level), but I would find it difficult to write an interesting Python extension without doing any of these things. If it is out of scope for this library to document the idiomatic use in writing Python backends, maybe you could have a section linking to a few open source projects actually using milksnake so a new user can try to pick up the idioms?
The text was updated successfully, but these errors were encountered: