-
Notifications
You must be signed in to change notification settings - Fork 41
Py additions #93
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
Py additions #93
Conversation
Codecov Report
@@ Coverage Diff @@
## master #93 +/- ##
==========================================
- Coverage 16.58% 15.43% -1.15%
==========================================
Files 139 150 +11
Lines 5367 6019 +652
Branches 487 496 +9
==========================================
+ Hits 890 929 +39
- Misses 4477 5090 +613
Continue to review full report at Codecov.
|
…ions added pybind11/stl and fixed some errors
@pandeyhs remove the WIP when you are ready to merge. You can always improve the design in a separate PR until we make a final release (2.1). Or you can continue to work on this PR, that's fine too. |
@pandeyhs, if you check the details on the failed Travis build |
|
||
void init_TruthResolution(py::module &m) { | ||
py::class_<TruthResolution, MixingTimeResolution>(m, "TruthResolution") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to add the empty constructor, I think .def(py::init<>())
|
||
using namespace GooFit; | ||
namespace py = pybind11; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MixingTimeResolution has some pure virtual methods in it. So I think you'll need to do what I did in DataSet to make this work. Look at the PyBind docs under virtual functions, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Virtual functions needed to be binded as well, and that makes sense. I am just confused that I am getting successful tests and build on my computer but the pytest is failing over here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried running pytest
in the build directory, and have you made sure you are using the version you built? You might need to run pip -v install . -e
in the main directory, depending on which build python is picking up. You can use pip uninstall goofit
to make sure you don't pick up the pip build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tricky part about a pure virtual function is that the class cannot be instanciated if it contains a pure virtual function (that's the point of a pure v.f.). So you have to make a special C++ class that just adds non-pure functions (using a PyBind macro) so that you can bind it (since PyBind instanciates the class as part of preparing the python version).
Some additions related to building python bindings.
pip
andsetup.py
.I'll need to cherry-pick the bugfix for the 2D plot to stable.