Details
-
Type:
Improvement
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: afw
-
Labels:
-
Story Points:6
-
Epic Link:
-
Sprint:DRP S17-3, DRP S17-4
-
Team:Data Release Production
Description
The way BaseRecord is wrapped in pybind11 needs some work:
- get and __getitem__ should be wrapped the way they were with SWIG, which is simpler code than was used, and looks identical for the two methods (though that code uses $action so there are subtle differences). Better yet, make the methods identical if possible.
- The wrappings should probably use C++ method _get, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes.
- The C++ wrapper defines _getitem_ for each data type and the code is radically different than for _get_ + suffix. It would be nice if the differences could be eliminated.
Similar issues apply to several other afw::table classes.
Attachments
Issue Links
- blocks
-
DM-9100 Merge pybind11 branches to master
- Done
- is blocked by
-
DM-8805 Metaclass for wrapped-template ABCs and class extension decorators
- Done
-
DM-9099 Begin cleanup of pybind11 branch
- Done
- relates to
-
DM-9018 Investigate downcasting of Table and Record types in pybind11
- Done
-
DM-8674 Wrap testSourceTable with pybind11
- Done
-
DM-6782 afw table string keyword access is much slower than asKey access
- Invalid
(1 relates to)
Activity
Description |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be identical (as they were with SWIG) but they are different and neither one can be used in place of the other. One or two tests fail either way. Furthermore the code bears little resemblance to the original SWIG (for good reasons, but I understand Fred knows how to work around this now). - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file. - The C++ wrapper defines {{_getitem_}} for each data type and the code is radically different than for {{_get_ + suffix}}; I hope it can be eliminated or made the same as {{_get_ + suffix}} and renamed to {{_get}}. |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped identically (as they were with SWIG) or should actually be identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{_getitem_}} for each data type and the code is radically different than for {{_get_ + suffix}}; I hope it can be eliminated or made the same as {{_get_ + suffix}} and renamed to {{_get}}. |
Description |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped identically (as they were with SWIG) or should actually be identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{_getitem_}} for each data type and the code is radically different than for {{_get_ + suffix}}; I hope it can be eliminated or made the same as {{_get_ + suffix}} and renamed to {{_get}}. |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped identically (as they were with SWIG) or should actually be identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{\_getitem\_}} for each data type and the code is radically different than for {{\_get_ + suffix}}. It would be nice if the differences could be eliminated. |
Description |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped identically (as they were with SWIG) or should actually be identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{\_getitem\_}} for each data type and the code is radically different than for {{\_get_ + suffix}}. It would be nice if the differences could be eliminated. |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped the way they were with SWIG, which is simpler code than was used, and looks identical for the two methods (though that code uses {{$action}} so there are subtle differences). Better yet, make the methods identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{\_getitem\_}} for each data type and the code is radically different than for {{\_get_ + suffix}}. It would be nice if the differences could be eliminated. |
Assignee | Fred Moolekamp [ fred3m ] |
Assignee | Jim Bosch [ jbosch ] |
Epic Link |
|
Epic Link |
|
Epic Link |
|
Team | Data Release Production [ 10301 ] |
Status | To Do [ 10001 ] | In Progress [ 3 ] |
Summary | BaseRecord wrapping of set and get needs work | Use visitor pattern to clean up afw::table pybind11 wrappers |
Description |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped the way they were with SWIG, which is simpler code than was used, and looks identical for the two methods (though that code uses {{$action}} so there are subtle differences). Better yet, make the methods identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{\_getitem\_}} for each data type and the code is radically different than for {{\_get_ + suffix}}. It would be nice if the differences could be eliminated. |
The way {{BaseRecord}} is wrapped in pybind11 needs some work:
- {{get}} and {{\_\_getitem\_\_}} should be wrapped the way they were with SWIG, which is simpler code than was used, and looks identical for the two methods (though that code uses {{$action}} so there are subtle differences). Better yet, make the methods identical if possible. - The wrappings should probably use C++ method {{_get}}, which needs to be added in the pybind11 wrapper file, rather than the specializations that use suffixes. - The C++ wrapper defines {{\_getitem\_}} for each data type and the code is radically different than for {{\_get_ + suffix}}. It would be nice if the differences could be eliminated. Similar issues apply to several other afw::table classes. |
Sprint | DRP S17-3 [ 360 ] |
Story Points | 6 |
Component/s | afw [ 10714 ] |
Sprint | DRP S17-3 [ 360 ] | DRP S17-3, DRP S17-4 [ 360, 363 ] |
Rank | Ranked higher |
Reviewers | Krzysztof Findeisen, Pim Schellart, Russell Owen [ krzys, pschella, rowen ] | |
Status | In Progress [ 3 ] | In Review [ 10004 ] |
Reviewers | Krzysztof Findeisen, Pim Schellart, Russell Owen [ krzys, pschella, rowen ] | Pim Schellart, Russell Owen [ pschella, rowen ] |
Status | In Review [ 10004 ] | Reviewed [ 10101 ] |
Resolution | Done [ 10000 ] | |
Status | Reviewed [ 10101 ] | Done [ 10002 ] |
While get and __getitem__ have a similar structure in the SWIG code, the $action command is different.
__getitem__ calls the C++ operator[] method and returns a reference, while getX returns a value, and specifies the type that it expects. For convenience (and to make the code more pythonic) get was implemented in SWIG so that the user doesn't need to specify the type. However, there are numerous tests and places in the code that use getX methods, so when I wrapped afw::table I had to keep that design. This causes the python code to look slightly different since pybind11 doesn't have a $action command.
So completing this ticket would require changing the API for afw::table, which is probably not a good idea until after the pybind11 port is successful.