-
Notifications
You must be signed in to change notification settings - Fork 3
Python bindings with PyO3 #51
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
Conversation
Hi @alecandido , I don't mind at all, and in fact I think that would be very useful. Go ahead, and let me know if you need to know anything. For a minimal set of structs and methods, just have a look at #50 , in particular the file https://github.com/N3PDF/pineappl/pull/50/files#diff-4a3c785edeb3672939e989f1aedce3a888747e39fabed535fba4a7909f13f7b2. This file more or less contains everything important from the user side. Don't forget to change the author of |
First, small, trade off due to python + rust interaction:
And now the problem: while the current python package it's named Maybe we can overcome this little pain by using Is it worth? |
It's probably best to rename it, since keeping the name of the other python package suggest they're compatible, which they probably won't. |
You're right, we can think a little on the name ( And it will keep the complexity low, without any extra than bindings themselves. |
* 'pyo3' of github.com:N3PDF/pineappl: Add a small note on maturin workflow Fix final layout (hopefully)
Do we actually need a separate crate for the python bindings? It might be beneficial to put everything into the main crate, preferably only when the python feature is activated. In this way there's less code duplication and adding a method is easy (?!). |
You're right, doing it in the main crate would be easier, but when I decided to split I made two considerations:
On the other hand there are some pros:
Nevertheless being outside the main crate I need to wrap all the structs and functions to annotate them, and it's a pain in the neck, so it would be much better to use the main crate just for this reason. What do you think? |
If it isn't |
Fine. Let's say that since I started this way I'll try to complete just the proof of concept, with the goal of running As soon as I get there we can merge in |
Agreed! |
you were thinking of https://github.com/N3PDF/pineappl/blob/fe5b83989144c4360db156daf7a12134d5ac86c4/pineappl_py/pineappl/grid.py#L23, right? |
it is still used here: https://github.com/N3PDF/yadism/blob/be995caf3a7f76dafd06336ba83fc570bc31f0a3/src/yadism/output.py#L236 |
actually, where? Rust@pineappl, Rust@pineappl_py, Python@pineappl_py ? |
I made a proposal in e8e1809 - please take a look |
What I'd like to see is tests of the Python interface, so tests written in Python! |
Hi @cschwan, I was reading about PyO3, and after a while I started thinking that it may be not so hard to provide bindings for
pineappl
using it.I don't know how much you care, but I decided to make a try, just in my spare time. The goal it's to port a minimal subset of things, just a proof of concept, to expand after to the full one.
It should not take so much, but of course it's not my main business, so it will take its time. Do you mind if I try?
I also thought it was a good way to familiarize a little more with
pineappl
, since soon it will be useful (both because ofyadism
, but also because I am going to work onpineko
too, and I know you are the expert onpineappl
, but it won't hurt to know something more).If you agree maybe you can suggest me which one could be "a minimal set".