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
Make OpenCOR's simulation environment available in a Python package #1746
Comments
Personally, to make OpenCOR's simulation environment (and maybe other aspects of OpenCOR too, at some point? E.g. the conversion of a CellML file to say Python) available in a Python package would be very nice to have since this would allow people to use OpenCOR directly from their Python environment. However, this seems to have quite a few technological implications, so we will have to think very carefully about it and, in fact, make sure that this is the kind of Python support that Python users would expect to have for OpenCOR (@hsauro, @hsorby, @metatoaster, @MichaelClerx, @nickerso, @ssafaei, any views on this?).
If we were to go that route, does it mean that our current Python support approach would be dropped in favour of this new one, or could it live alongside the new approach?
Regarding PySide 2 vs. PyQt5, the former has become the official Qt for Python, so that would settle it for me. However, quite a few bindings seem to be missing from PySide 2 (see here)? |
When using it from Python, would the Qt parts be necessary? It'd simplify things a lot if they weren't (i.e. just using the simulation / cellml parts, not the GUI) |
Right now, we can already run a simulation from Python without the GUI side of OpenCOR, if that's what you mean. |
So where do the python bindings for Qt come in? Don't really see why they'd be needed! |
@dbrnz may have to explain things further, but as far as I understand it, right now, we ship our own copy of Python with OpenCOR, as well Personally, I wish we could use OpenCOR directly from a Python script using a generic Python installation (as well as have a Python console in the GUI version of OpenCOR, which we already do), and this is what this issue is about. However, I want to make sure that this is indeed what Python users would expect to have when it comes to Python support in OpenCOR (since this is going to involve quite a bit of work). |
Of the packages shipped,
That's true for any major Python upgrade unless the user sets up local directories to hold installed packages, separate from their Python installation. The same can be done for OpenCOR's Python -- it's just not an out-of-the-box thing for Python novices. Hmm, we could do this automatically by using say
No. Python code is run by PythonQt is used to embed Python into OpenCOR's C++ Qt code. This is the approach taken by other Qt-based applications that provide Python scripting, including Slicer and MeVisLab.
@MichaelClerx, the non-gui code in OpenCOR makes extensive use of Qt classes (e.g. for strings, lists, plugins, signals/slots, etc, etc), so any Python wrapper for an OpenCOR library must also wrap QObjects. The alternative would be to provide the non-Gui functionality of OpenCOR in a library that doesn't use Qt. |
Currently OpenCOR provides the user with a Python console via an embedded Python interpreter. This also allows OpenCOR to run as a Jupyter kernel and have clients (Web browsers, IPython consoles, etc) run Python code contained in Jupyter Notebook files.
The current implementation though does not allow a user with a generic Python installation to take advantage of OpenCOR. To do so would require having OpenCOR available as a library with Python wrappers. This will necessitate a rework of some of OpenCOR and its current Python implementation.
Because OpenCOR makes extensive use of Qt, and because any generic
opencor
package should be able to coexist with other Qt5 Python packages, we need to choose a suitable Qt5 package as a base (PySide2 has a better license than PyQt5) and use its Qt binaries in our library version of OpenCOR. OpenCOR's third-party libraries will also have to be bundled with our Python package.The text was updated successfully, but these errors were encountered: