C++ extension module for Python bindings - Redmine #2912
The gmxapi
Python package includes a _gmxapi
submodule that provides
bindings to the GROMACS library. This issue tracks the implementation of
that submodule. Scope of this issue is intended to be limited to the set
up of the bindings framework and build environment.
Criteria for completion:
To limit the scope of this Redmine issue, consider this task complete
when the C extension is built as part of
the package described in https://redmine.gromacs.org/issues/2893.
Bindings framework
pybind11 is proposed because it is lightweight, performant, modern, well-maintained, and allows GROMACS development to remain C-based as much as possible. A GROMACS C developer should be able to trouble-shoot API bindings or expose incremental functionality with minimal reference to Python or other non-C syntax.
Build system
Idiomatic Python packaging for the gmxapi
package will undoubtedly be
expanded. scikit-build
provides a convenient bridge between Python
packaging tools and CMake C project
environments.
The library target for the bindings module depends on the public (installed) interface of a GROMACS library with position-independent-code.
Additional information
In this issue, the GROMACS repository becomes the upstream source of
updates to the package historically available from
https://github.com/kassonlab/gmxapi, in which the C extension module is gmx.core
Note: pybind11 is a template header library that helps C++11 code interact with the Python C API. Projects are expected to bundle the pybind11 headers and not to rely on the pybind11 namespace for ABI compatibility with other code. The bundled pybind11 headers should not need to be updated except to take advantage of new functionality, incorporate bug fixes, or address (rare) C API changes in new Python versions.
(from redmine: issue id 2912, created on 2019-03-31 by eirrgang, closed on 2019-12-11)
- Relations:
- relates #2896 (closed)
- relates #701 (closed)
- relates #988 (closed)
- relates #2893 (closed)
- relates #2756 (closed)
- blocks #2894 (closed)
- parent #2045 (closed)
- Changesets:
- Revision 32153515 by Eric Irrgang on 2019-04-10T13:16:24Z:
Use pybind11 to make a minimal C++ Python extension.
* Bundle pybind11 2.2.4 headers
* Create the `gmxapi._gmxapi` submodule as a C++ extension module.
Ref: #2912
Change-Id: Iadc8645906c2b89d98fae57b891deac80793b050
- Revision de0a1d5d by Eric Irrgang on 2019-04-10T14:13:05Z:
Add GROMACS library dependency to gmxapi package.
The `gmxapi` Python package has a C++ extension module configured and
built through CMake. This change links the C++ extension module to the
GROMACS library external interface.
No new code is introduced. This change just establishes that a Python
package can be built, installed, and imported with dynamic linking to
an installed GROMACS library.
Ref: #2912
Change-Id: I1c992c30132df25cf6a91902611cb201962649af
- Revision a9b3206a283196c17a9b39ec72cd99cc8869fb97 by Eric Irrgang on 2019-04-24T13:59:08Z:
Basic mdrun operation for Python gmxapi.
Add wrapper code and bindings so that the Python module can invoke
mdrun through the C++ API of the GROMACS installation.
Refs: #2912
- Revision 2fcc1306 by Eric Irrgang on 2019-07-05T06:52:03Z:
Python bindings for mdrun.
This change makes a near-exact copy of the mdrun Python
bindings from gmxapi 0.0.7.
Reference https://github.com/kassonlab/gmxapi/releases/tag/v0.0.7.3
This establishes a base from which to transition Python bindings
development from GitHub to the GROMACS repository, so Python wrappers,
interface updates, and other changes are deferred to separate commits.
The provided interface largely opaque except for arguments passed the
same way as mdrun command line flags.
GROMACS must be built with GMXAPI=ON.
Fixes #2912
Change-Id: I2f51ae8f2369334d06a7ceaa8a4abf3ed9fc444a
- Revision ffab53913efdee8a82d6e1394f9ddefb895cce44 by Eric Irrgang on 2019-08-22T14:30:53Z:
Python wrapping code for gmxapi mdrun bindings.
Expose the mdrun bindings to the Python interface. Imports workflow.py
and context.py from 0.0.7.4 tagged release of external project at
https://github.com/kassonlab/gmxapi with minimal modifications.
Refs #2893
Refs #2912
Refs #3027
Change-Id: I44a66646eceb191a2ec755169671af326f22526a
- Revision 6cb31a6b by Eric Irrgang on 2019-09-03T07:52:42Z:
Python wrapping code for gmxapi mdrun bindings.
Expose the mdrun bindings to the Python interface.
Updates workflow.py and context.py from 0.0.7.4 tagged release of external project.
Refs #2893
Refs #2912
Refs #3027
Change-Id: I44a66646eceb191a2ec755169671af326f22526a