Menu

#117 Try out boost.python (High priority)

0.2.2
done
nobody
None
nobody
2018-08-17
2017-12-22
Ulf Lorenz
No

Using boost.python, it seems to be reasonably easy to produce a wrapper to import C++ code into python. On the plus side, this would hugely simplify the usability for end users: Instead of all the CMake workarounds, you simply build a python module and use python.

However, the documentation is lacking in many respects, so a few things need to be tried out. In particular, things that I can think of:

  • can the tensor lib be made to work with boost::python?
  • how does the whole ecosystem work with shared_ptr and other complex types?
  • Does every class need a factory function then for the shared_ptr or what?
  • What to do with callbacks? The user may want to write functions in python that need to be handled as functors in C++.
  • does unit conversion work?
  • any other uncommon issues: class enums, templatized types, ...?

Also, have a look at SWIG as alternative: http://swig.org


Resolution

Used pybind11 (boost::python alternative). Not everything has been solved (see ticket [#130] for not yet implemented features), but there is a working prototype including conversion of tensors into python data types (numpy.array) and back.

Related

Tickets: #118
Tickets: #130
Tickets: #131

Discussion

  • Ulf Lorenz

    Ulf Lorenz - 2018-04-02
    • Milestone: 0.3 goal --> 0.2.2
     
  • Ulf Lorenz

    Ulf Lorenz - 2018-06-03
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -7,3 +7,5 @@
     * Does every class need a factory function then for the shared_ptr or what?
     * What to do with callbacks? The user may want to write functions in python that need to be handled as functors in C++.
     * any other uncommon issues: class enums, templatized types, ...?
    +
    +Also, have a look at SWIG as alternative: http://swig.org
    
    • status: open --> assigned
    • assigned_to: Ulf Lorenz
     
  • Ulf Lorenz

    Ulf Lorenz - 2018-06-03
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,6 +6,7 @@
     * how does the whole ecosystem work with shared_ptr and other complex types?
     * Does every class need a factory function then for the shared_ptr or what?
     * What to do with callbacks? The user may want to write functions in python that need to be handled as functors in C++.
    +* does unit conversion work?
     * any other uncommon issues: class enums, templatized types, ...?
    
     Also, have a look at SWIG as alternative: http://swig.org
    
     
  • Ulf Lorenz

    Ulf Lorenz - 2018-08-17
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -10,3 +10,9 @@
     * any other uncommon issues: class enums, templatized types, ...?
    
     Also, have a look at SWIG as alternative: http://swig.org
    +
    +----
    +
    +#### Resolution ####
    +
    +Used pybind11 (boost::python alternative). Not everything has been solved (see ticket [#130] for not yet implemented features), but there is a working prototype including conversion of tensors into python data types (numpy.array) and back.
    
    • status: assigned --> done
    • assigned_to: Ulf Lorenz --> nobody
     

    Related

    Tickets: #130


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.