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

Does RustPython support interoperability with rust code/crates? #1609

Closed
knowsuchagency opened this issue Nov 24, 2019 · 4 comments
Closed

Comments

@knowsuchagency
Copy link

I'm just curious whether or not it would be possible to call rust code from within the RustPython interpreter.

Also I just want to say that I'm excited to start testing out this project, thanks for all the hard work of the contributors!

@coolreader18
Copy link
Member

Do you mean Rust code compiled to a shared library and imported into RustPython at runtime, or Rust code added into the binary at compile-time? The latter we have, and it's how much of our standard library is implemented. The former is a WIP, as it requires a stable Rust ABI for Rust->Rust FFI, which is not currently one of the Rust project's goals, and the current solutions are fairly verbose and clunky to work with.

@cedric-h
Copy link
Contributor

cedric-h commented Nov 29, 2019

Is there documentation to assist with pursuing the latter in Rust projects?
Can you instantiate, pass around, and manipulate Rust structs/types from Python?

@tanekere
Copy link

I think what he’s asking is whether it is possible to use regular rust crates from RustPython. If I got it wrong please correct me. Also, I have the same doubt.

@coolreader18
Copy link
Member

Sorry for not responding earlier, it is certainly possible to store Rust structs in PyObjects and we do that quite a bit in the codebase; you can look in the vm/src/stdlib subdirectory for some examples, specifically socket for a module that's centered almost completely around a built-in class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants