Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-8716

Use visitor pattern to clean up afw::table pybind11 wrappers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Story Points:
      6
    • 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

            Activity

            rowen Russell Owen created issue -
            rowen Russell Owen made changes -
            Field Original Value New Value
            Link This issue relates to DM-8674 [ DM-8674 ]
            rowen Russell Owen made changes -
            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}}.
            rowen Russell Owen made changes -
            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.
            rowen Russell Owen made changes -
            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.
            fred3m Fred Moolekamp made changes -
            Assignee Fred Moolekamp [ fred3m ]
            jbosch Jim Bosch made changes -
            Assignee Jim Bosch [ jbosch ]
            swinbank John Swinbank made changes -
            Epic Link DM-7717 [ 26925 ]
            swinbank John Swinbank made changes -
            Epic Link DM-7717 [ 26925 ]
            swinbank John Swinbank made changes -
            Epic Link DM-7717 [ 26925 ]
            swinbank John Swinbank made changes -
            Team Data Release Production [ 10301 ]
            jbosch Jim Bosch made changes -
            Status To Do [ 10001 ] In Progress [ 3 ]
            jbosch Jim Bosch made changes -
            Summary BaseRecord wrapping of set and get needs work Use visitor pattern to clean up afw::table pybind11 wrappers
            jbosch Jim Bosch made changes -
            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.
            jbosch Jim Bosch made changes -
            Link This issue blocks DM-9100 [ DM-9100 ]
            jbosch Jim Bosch made changes -
            Link This issue is blocked by DM-9099 [ DM-9099 ]
            jbosch Jim Bosch made changes -
            Link This issue is blocked by DM-8805 [ DM-8805 ]
            swinbank John Swinbank made changes -
            Sprint DRP S17-3 [ 360 ]
            swinbank John Swinbank made changes -
            Story Points 6
            tjenness Tim Jenness made changes -
            Component/s afw [ 10714 ]
            swinbank John Swinbank made changes -
            Sprint DRP S17-3 [ 360 ] DRP S17-3, DRP S17-4 [ 360, 363 ]
            swinbank John Swinbank made changes -
            Rank Ranked higher
            jbosch Jim Bosch made changes -
            Link This issue relates to DM-9018 [ DM-9018 ]
            jbosch Jim Bosch made changes -
            Reviewers Krzysztof Findeisen, Pim Schellart, Russell Owen [ krzys, pschella, rowen ]
            Status In Progress [ 3 ] In Review [ 10004 ]
            krzys Krzysztof Findeisen made changes -
            Reviewers Krzysztof Findeisen, Pim Schellart, Russell Owen [ krzys, pschella, rowen ] Pim Schellart, Russell Owen [ pschella, rowen ]
            pschella Pim Schellart [X] (Inactive) made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            jbosch Jim Bosch made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]
            jbosch Jim Bosch made changes -
            Link This issue relates to DM-6782 [ DM-6782 ]

              People

              Assignee:
              jbosch Jim Bosch
              Reporter:
              rowen Russell Owen
              Reviewers:
              Pim Schellart [X] (Inactive), Russell Owen
              Watchers:
              Fred Moolekamp, Jim Bosch, Krzysztof Findeisen, Pim Schellart [X] (Inactive), Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.