-
Notifications
You must be signed in to change notification settings - Fork 46
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
Transpile to native extension #62
Comments
@pombredanne - the most interesting candidate in this space is I can imagine a mode where we add a new command line option:
That results in:
|
@adsharma this would be awesome! |
This was tested with: ``` def sum_as_string(a: int, b: int) -> int: return a + b ``` py2many --rust=1 --extension=1 /tmp/foo.py and by copying over foo.rs as src/lib.rs in a pyO3 example template. Related to: #62
@pombredanne - could you please take a look? These are the basics. Could you give us feedback on what's missing? |
Missing feature: handling strings and return values If you look at the example here: https://pyo3.rs/v0.13.2/#using-rust-from-python
py2many produces:
Two things we need to teach the transpiler:
|
This was tested with: ``` def sum_as_string(a: int, b: int) -> int: return a + b ``` py2many --rust=1 --extension=1 /tmp/foo.py and by copying over foo.rs as src/lib.rs in a pyO3 example template. Related to: #62
This was tested with: ``` def sum_as_string(a: int, b: int) -> int: return a + b ``` py2many --rust=1 --extension=1 /tmp/foo.py and by copying over foo.rs as src/lib.rs in a pyO3 example template. Related to: #62
This was tested with: ``` def sum_as_string(a: int, b: int) -> int: return a + b ``` py2many --rust=1 --extension=1 /tmp/foo.py and by copying over foo.rs as src/lib.rs in a pyO3 example template. Related to: #62
This covers the mechanics of using PyResult from an extension. Tested via the canonical pyO3 example: ``` def sum_as_string(a: int, b: int) -> str: return str(a + b) ``` Related to: #62
Some discussion of this topic here: |
#228 is doing classes and methods as per documentation |
This was tested with: ``` def sum_as_string(a: int, b: int) -> int: return a + b ``` py2many --rust=1 --extension=1 /tmp/foo.py and by copying over foo.rs as src/lib.rs in a pyO3 example template. Related to: py2many#62
This covers the mechanics of using PyResult from an extension. Tested via the canonical pyO3 example: ``` def sum_as_string(a: int, b: int) -> str: return str(a + b) ``` Related to: py2many#62
When I transpile Python code to say C or Rust, I would like to be able to use the transpiled code from Python. It would be very nice if there was an option (at least for some language that are amenable to this) such that the transpiled code would be a valid Python native extension callable from Python.
The text was updated successfully, but these errors were encountered: